Skip to content

Commit e2bff55

Browse files
authored
fix: restore pypi litellm install path (#858)
* fix: restore pypi litellm install path * chore: relax litellm lower bound to historical minimum
1 parent 8b51d51 commit e2bff55

3 files changed

Lines changed: 8 additions & 72 deletions

File tree

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
1111

1212
### 修复
1313

14+
- 📦 **恢复 LiteLLM 官方 PyPI 安装并锁定安全上限**`requirements.txt` 重新使用 `pip install litellm` 的官方 PyPI 安装路径,并在保留历史最低要求 `>=1.80.10` 的同时增加 `<1.82.7` 的安全上限,避免误装已被移除的 `1.82.7` / `1.82.8` 风险版本;Windows 桌面打包脚本也同步回退到标准 `pip install -r requirements.txt` 链路,减少特殊下载分支带来的维护成本。
1415
- 📨 **Telegram Markdown 解析失败回退纯文本**(fixes #850)— `src/notification_sender/telegram_sender.py` 现在会在 Telegram 返回 `HTTP 400` 且包含 `can't parse entities` / Markdown 解析错误时,自动去掉 `parse_mode` 后重试纯文本发送,避免 `*ST` 等正文内容直接导致整条通知失败。
1516
- 🔢 **A 股同码实时行情保留交易所提示**(fixes #852)— `DataFetcherManager``TushareFetcher` 现在会保留 `SZ000001` / `000001.SZ` 这类显式沪深提示,旧版 Tushare 实时行情降级分支不再把深市 `000001` 误判成 `sh000001` 上证指数。
1617
- 🎯 **多 Agent 次优买点不再盲目复制理想买点**(fixes #851)— 当多智能体结果缺少独立 `secondary_buy` 时,仪表盘现在优先展示 `N/A` 而不是把 fallback 值硬拷贝成与 `ideal_buy` 完全相同,减少误导性的双买点展示。

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ numpy>=1.24.0 # 数值计算
2929
json-repair>=0.55.1 # JSON 修复
3030

3131
# AI 分析
32-
# PyPI project was quarantined on 2026-03-24; install from the upstream GitHub stable tag for now.
33-
litellm @ https://github.com/BerriAI/litellm/archive/refs/tags/v1.82.3-stable.patch.2.tar.gz # Unified LLM client (Gemini/Anthropic/OpenAI/DeepSeek etc.)
32+
# Restore official PyPI install after the quarantined 1.82.7 / 1.82.8 builds were removed.
33+
# Keep the historical minimum version and add a safe upper bound.
34+
litellm>=1.80.10,<1.82.7 # Unified LLM client (Gemini/Anthropic/OpenAI/DeepSeek etc.)
3435
tiktoken>=0.8.0,<0.12.0 # BPE tokenizer for LLM token counting (pin <0.12 to avoid plugin registration issues, #537)
3536
openai>=1.0.0 # OpenAI SDK (transitive dependency of litellm, kept explicit)
3637
PyYAML>=6.0 # YAML parser for LITELLM_CONFIG support

scripts/build-backend.ps1

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ if ([string]::IsNullOrWhiteSpace($pythonBin)) {
1515

1616
Write-Host "Using Python: $pythonBin"
1717

18-
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
19-
$requirementsPath = Join-Path $repoRoot 'requirements.txt'
20-
2118
function Test-PythonCode {
2219
param(
2320
[string]$Python,
@@ -32,79 +29,16 @@ function Test-PythonCode {
3229
}
3330
}
3431

35-
function Install-PatchedLiteLLMFromGitHubSource {
36-
param(
37-
[string]$Python,
38-
[string]$Tag
39-
)
40-
41-
$tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) "dsa-litellm-$Tag"
42-
$archivePath = Join-Path ([System.IO.Path]::GetTempPath()) "dsa-litellm-$Tag.zip"
43-
$extractRoot = Join-Path $tempRoot 'src'
44-
45-
if (Test-Path $tempRoot) {
46-
Remove-Item -Recurse -Force $tempRoot
47-
}
48-
New-Item -ItemType Directory -Path $extractRoot -Force | Out-Null
49-
50-
$downloadUrl = "https://github.com/BerriAI/litellm/archive/refs/tags/$Tag.zip"
51-
Write-Host "Downloading patched LiteLLM source: $downloadUrl"
52-
Invoke-WebRequest -Uri $downloadUrl -OutFile $archivePath
53-
54-
Expand-Archive -Path $archivePath -DestinationPath $extractRoot -Force
55-
$sourceDir = Get-ChildItem -Path $extractRoot -Directory | Select-Object -First 1
56-
if (-not $sourceDir) {
57-
throw "Unable to locate extracted LiteLLM source under $extractRoot."
58-
}
59-
60-
$enterpriseDir = Join-Path $sourceDir.FullName 'enterprise'
61-
if (Test-Path $enterpriseDir) {
62-
# Work around Poetry wheel build failures on Windows when the upstream source archive
63-
# includes LiteLLM's optional enterprise package tree.
64-
Remove-Item -Recurse -Force $enterpriseDir
65-
}
66-
67-
& $Python -m pip install $sourceDir.FullName
68-
if ($LASTEXITCODE -ne 0) {
69-
throw "Patched LiteLLM install failed with exit code $LASTEXITCODE."
70-
}
71-
}
72-
73-
function Install-BackendDependencies {
74-
param(
75-
[string]$Python,
76-
[string]$RequirementsFile
77-
)
78-
79-
$tempRequirements = Join-Path ([System.IO.Path]::GetTempPath()) 'dsa-desktop-backend-requirements.txt'
80-
$litellmTag = $null
81-
$filteredLines = foreach ($line in Get-Content $RequirementsFile) {
82-
if ($line -match '^\s*litellm\s*@\s*https://github\.com/BerriAI/litellm/archive/refs/tags/([^/\s]+)\.tar\.gz') {
83-
$litellmTag = $Matches[1]
84-
continue
85-
}
86-
$line
87-
}
88-
89-
Set-Content -Path $tempRequirements -Value $filteredLines
90-
91-
& $Python -m pip install -r $tempRequirements
92-
if ($LASTEXITCODE -ne 0) {
93-
throw "pip install -r $tempRequirements failed with exit code $LASTEXITCODE."
94-
}
95-
96-
if ($litellmTag) {
97-
Install-PatchedLiteLLMFromGitHubSource -Python $Python -Tag $litellmTag
98-
}
99-
}
100-
10132
Write-Host 'Building backend executable...'
10233
if (-not (Test-PythonCode -Python $pythonBin -Code "import PyInstaller")) {
10334
& $pythonBin -m pip install pyinstaller
10435
}
10536

10637
Write-Host 'Installing backend dependencies...'
107-
Install-BackendDependencies -Python $pythonBin -RequirementsFile $requirementsPath
38+
& $pythonBin -m pip install -r requirements.txt
39+
if ($LASTEXITCODE -ne 0) {
40+
throw "pip install -r requirements.txt failed with exit code $LASTEXITCODE."
41+
}
10842

10943
Write-Host 'Checking python-multipart availability...'
11044
if (-not (Test-PythonCode -Python $pythonBin -Code "import multipart, multipart.multipart")) {

0 commit comments

Comments
 (0)