mirror of
https://github.com/ZhuLinsen/daily_stock_analysis
synced 2026-09-20 10:53:33 +08:00
Relax LiteLLM version constraint (#1201)
* chore: relax litellm version constraint * chore: cap litellm constraint to 1.x
This commit is contained in:
@@ -98,7 +98,7 @@ GEMINI_API_KEY=
|
||||
# - Moonshot API / 模型文档:https://platform.kimi.ai/docs/guide/kimi-k2-6-quickstart
|
||||
# - Moonshot 官方模型卡(评测默认 temperature = 1.0):https://huggingface.co/moonshotai/Kimi-K2.6
|
||||
# - LiteLLM OpenAI-Compatible 规范:https://docs.litellm.ai/docs/providers/openai_compatible
|
||||
# 当前仓库运行时依赖窗口:litellm>=1.80.10,<1.82.7(见 requirements.txt),本次兼容修复按该范围验证。
|
||||
# 当前仓库运行时依赖约束:litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0(显式排除 PyPI 事故版本,见 requirements.txt)。
|
||||
# 因此 kimi-k2.6 会自动改用 1.0,避免 API 拒绝请求;其他模型和 fallback 仍使用你配置的 LLM_TEMPERATURE。
|
||||
# Web 设置页 / 桌面端导入不会静默清空或改写 LLM_TEMPERATURE;只在真正发请求前按 Kimi 要求临时归一化。
|
||||
# 如果主模型切回非 Kimi,原本配置的温度会自动恢复;最小回滚方式是回退本次 Kimi 固定温度改动。
|
||||
|
||||
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
<!-- 新条目格式:- [类型] 描述(类型取值:新功能/改进/修复/文档/测试/chore)-->
|
||||
<!-- 每条独立一行追加到本段末尾,无需分类标题,合并时冲突最小 -->
|
||||
- [改进] 放宽 LiteLLM 依赖约束,保留 `>=1.80.10` 最低版本并显式排除 PyPI 事故版本 `1.82.7` / `1.82.8`,允许安装后续 1.x 修复版本。
|
||||
|
||||
## [3.15.0] - 2026-05-05
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ OLLAMA_API_BASE=http://localhost:11434
|
||||
LITELLM_MODEL=ollama/qwen3:8b
|
||||
```
|
||||
|
||||
> **重要**:Ollama 必须使用 `OLLAMA_API_BASE` 配置,**不要**使用 `OPENAI_BASE_URL`,否则系统会错误拼接 URL(如 404、`api/generate/api/show`)。远程 Ollama 时,将 `OLLAMA_API_BASE` 设为实际地址(如 `http://192.168.1.100:11434`)。当前依赖要求 LiteLLM ≥1.80.10(与 requirements.txt 一致)。
|
||||
> **重要**:Ollama 必须使用 `OLLAMA_API_BASE` 配置,**不要**使用 `OPENAI_BASE_URL`,否则系统会错误拼接 URL(如 404、`api/generate/api/show`)。远程 Ollama 时,将 `OLLAMA_API_BASE` 设为实际地址(如 `http://192.168.1.100:11434`)。当前依赖约束为 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(与 requirements.txt 一致)。
|
||||
|
||||
> **恭喜!小白读到这里就可以去运行程序了!**
|
||||
> 想测测看通没通?在主目录打开命令行输入:`python test_env.py --llm`
|
||||
@@ -98,18 +98,18 @@ LITELLM_MODEL=ollama/qwen3:8b
|
||||
|
||||
- 预设里的 provider / Base URL / 示例模型只用于**初始化表单**;真正落盘时仍是你当前输入的 `LLM_{CHANNEL}_PROTOCOL`、`LLM_{CHANNEL}_BASE_URL`、`LLM_{CHANNEL}_MODELS`、`LLM_{CHANNEL}_API_KEY(S)`,不会在后台偷偷改成别的 provider 名或 URL。
|
||||
- 设置页的“获取模型”只对 `OpenAI Compatible` / `DeepSeek` 渠道调用 `{base_url}/models`;“测试连接”默认只发一次最小聊天请求。可选的“运行时能力检测”必须由用户显式选择后触发,会额外发起 JSON / tools / stream / vision smoke 请求,结果仅代表当前账号、模型和 endpoint 的一次 best-effort 检测。上述检测返回的 `stage / error_code / details / latency_ms / capability_results` 仅用于结构化诊断提示,**不会写回** `.env`,也不会阻止保存。
|
||||
- 运行时能力检测会产生真实 LLM 请求,可能带来 token / 图像输入费用、RPM/TPM 限流、余额不足或超时。检测失败可能来自账号权限、模型未开通、endpoint 区域、余额、服务商兼容层或 LiteLLM 转换路径,不等于该 provider 全局不支持对应能力。P3 未对所有真实 provider 做在线 smoke;兼容依据来自当前依赖窗口 `litellm>=1.80.10,<1.82.7` 下的 LiteLLM `completion()` / OpenAI I/O format / streaming / exception mapping,以及 OpenAI Chat Completions 的 JSON mode、tool calling、streaming 和 vision input 形状。
|
||||
- 运行时能力检测会产生真实 LLM 请求,可能带来 token / 图像输入费用、RPM/TPM 限流、余额不足或超时。检测失败可能来自账号权限、模型未开通、endpoint 区域、余额、服务商兼容层或 LiteLLM 转换路径,不等于该 provider 全局不支持对应能力。P3 未对所有真实 provider 做在线 smoke;兼容依据来自当前依赖约束 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` 下的 LiteLLM `completion()` / OpenAI I/O format / streaming / exception mapping,以及 OpenAI Chat Completions 的 JSON mode、tool calling、streaming 和 vision input 形状。
|
||||
- 相关外部来源:LiteLLM Python SDK / OpenAI I/O format / streaming / exception mapping:<https://docs.litellm.ai/>;LiteLLM OpenAI-compatible 路由:<https://docs.litellm.ai/docs/providers/openai_compatible>;OpenAI Chat Completions:<https://platform.openai.com/docs/api-reference/chat/create>;JSON mode:<https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat>;tool calling:<https://platform.openai.com/docs/guides/function-calling?api-mode=chat>;streaming:<https://platform.openai.com/docs/guides/streaming-responses?api-mode=chat>;vision input:<https://platform.openai.com/docs/guides/images-vision?api-mode=chat>。
|
||||
- 保存渠道时,只会更新这次提交的 key;不会因为切换渠道模式而静默迁移整个旧配置。唯一会被**同步清理**的是运行时模型引用:如果 `LITELLM_MODEL`、`AGENT_LITELLM_MODEL`、`VISION_MODEL` 或 `LITELLM_FALLBACK_MODELS` 指向了当前已启用渠道里已经不存在的模型,设置页会在保存前把这些失效引用清空/移除,避免运行时继续指向无效模型;即使当前启用渠道没有任何可选模型,也会清理缺少 legacy Key 支撑的托管 provider 旧值。`cohere/*`、`google/*`、`xai/*` 这类直连模型仅用于说明历史 `direct-env` 兼容保留语义,不等于可用性承诺,是否可用请按各厂商官方模型/API 文档再做实际验证。
|
||||
- 后端一致性依据:配置校验链路在 `SystemConfigService._validate_llm_runtime_selection`(`src/services/system_config_service.py`)中通过 `_uses_direct_env_provider`(`src/config.py`)判断运行时来源;当前仅 `gemini`、`vertex_ai`、`anthropic`、`openai`、`deepseek` 属于托管 key provider,`cohere`、`google`、`xai` 不在该白名单中,因此会保留为直连模型。
|
||||
- 回退方式也保持最小:把对应渠道模型列表改回去后重新选择主模型 / fallback,或直接用桌面端导出备份 / 手动 `.env` 还原之前的 `LLM_*`、`LITELLM_MODEL`、`AGENT_LITELLM_MODEL`、`VISION_MODEL`、`LLM_TEMPERATURE` 即可,不需要额外跑迁移脚本。
|
||||
- 当前仓库对此链路的依赖窗口是 `litellm>=1.80.10,<1.82.7`(见 `requirements.txt`);回归覆盖包括 `tests/test_system_config_service.py`、`tests/test_system_config_api.py` 和 `apps/dsa-web/src/components/settings/__tests__/LLMChannelEditor.test.tsx`。
|
||||
- 当前仓库对此链路的依赖约束是 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(见 `requirements.txt`);回归覆盖包括 `tests/test_system_config_service.py`、`tests/test_system_config_api.py` 和 `apps/dsa-web/src/components/settings/__tests__/LLMChannelEditor.test.tsx`。
|
||||
|
||||
> **外部 provider 示例模型说明**:`cohere/*`、`google/*`、`xai/*` 等 provider 前缀值仅用于说明当前保存清理语义,**不代表该窗口内的逐型号可用性保证**。文档或测试中的具体模型名都是配置保留行为样例,不是生产推荐;实际可用性请以对应官方模型文档为准,并结合仓库依赖窗口 `litellm>=1.80.10,<1.82.7` 复核。
|
||||
> **外部 provider 示例模型说明**:`cohere/*`、`google/*`、`xai/*` 等 provider 前缀值仅用于说明当前保存清理语义,**不代表该依赖约束内的逐型号可用性保证**。文档或测试中的具体模型名都是配置保留行为样例,不是生产推荐;实际可用性请以对应官方模型文档为准,并结合仓库依赖约束 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` 复核。
|
||||
|
||||
### 回退与兼容性证据
|
||||
|
||||
- 兼容窗口与静默清理范围:在 `litellm>=1.80.10,<1.82.7` 时,保存仅清理失效的 runtime 模型引用(`LITELLM_MODEL`、`AGENT_LITELLM_MODEL`、`VISION_MODEL`、`LITELLM_FALLBACK_MODELS`),`cohere/*`、`google/*`、`xai/*` 等非渠道直连模型会被保留。
|
||||
- 依赖约束与静默清理范围:在 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` 下,保存仅清理失效的 runtime 模型引用(`LITELLM_MODEL`、`AGENT_LITELLM_MODEL`、`VISION_MODEL`、`LITELLM_FALLBACK_MODELS`),`cohere/*`、`google/*`、`xai/*` 等非渠道直连模型会被保留。
|
||||
- 回退方式:可直接用桌面端导出备份后通过 `POST /api/v1/system/config/import` 恢复;也可手动把 `.env` 中历史 `LITELLM_* / AGENT_LITELLM_MODEL / VISION_MODEL / LLM_TEMPERATURE` 回填后重启生效。
|
||||
- 回退回归证据:`tests/test_system_config_service.py::test_import_desktop_env_restores_runtime_models_after_cleanup` 覆盖“清理后用桌面导出备份恢复 runtime 引用”。
|
||||
- 直连 provider 回归证据:`tests/test_system_config_service.py::SystemConfigServiceTestCase::test_validate_accepts_minimax_model_as_direct_env_provider`、`test_validate_accepts_cohere_model_as_direct_env_provider`、`test_validate_accepts_google_model_as_direct_env_provider`、`test_validate_accepts_xai_model_as_direct_env_provider` 覆盖直连 provider 保留语义。
|
||||
@@ -196,7 +196,7 @@ LITELLM_MODEL=ollama/qwen3:8b
|
||||
- Moonshot 官方说明 Kimi API 兼容 OpenAI 接口,Base URL 使用 `https://api.moonshot.ai/v1`:<https://platform.kimi.ai/docs/guide/kimi-k2-6-quickstart>
|
||||
- LiteLLM 官方要求 OpenAI Compatible 渠道模型名使用 `openai/` 前缀:<https://docs.litellm.ai/docs/providers/openai_compatible>
|
||||
- Moonshot 官方兼容性文档区分两种固定值:**thinking 模式固定 `1.0`,non-thinking 模式固定 `0.6`**;传其它值会被接口拒绝:<https://platform.moonshot.ai/docs/guide/compatibility#parameters-differences-in-request-body>
|
||||
- 当前仓库的运行时依赖窗口是 `litellm>=1.80.10,<1.82.7`(见 `requirements.txt`);本次兼容逻辑按该范围回归验证了主分析、大盘复盘、Agent 直连 LiteLLM,以及系统设置页的渠道连通性测试。
|
||||
- 当前仓库的运行时依赖约束是 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(见 `requirements.txt`);本次兼容逻辑按该约束回归验证了主分析、大盘复盘、Agent 直连 LiteLLM,以及系统设置页的渠道连通性测试。
|
||||
- 因此本项目会在请求发出前按**实际请求模式**归一化 `kimi-k2.6` 及其 `kimi-k2.6-*` 变体:默认 / thinking 路径使用 `temperature=1.0`;如果你的 LiteLLM YAML 路由别名里显式写了 `litellm_params.extra_body.thinking.type: disabled`(或等价 non-thinking 配置),则自动切到 `temperature=0.6`。你在 `.env` 或 Web 设置里保存的 `LLM_TEMPERATURE` 不会被改写。
|
||||
- `SystemConfigService` 在 Web 设置保存 / 桌面端 `.env` 导入时只更新你提交的 key,不会因为切到 Kimi 静默清空、迁移或重写已有 `LLM_TEMPERATURE`;渠道测试请求里临时使用的 `1.0/0.6` 也不会回写到配置文件。
|
||||
- 非 Kimi 主模型、非 Kimi fallback 以及切回普通模型后的请求,仍继续使用你配置的温度;也就是说旧配置无需迁移,切换模型即可自动恢复原行为。
|
||||
@@ -205,7 +205,7 @@ LITELLM_MODEL=ollama/qwen3:8b
|
||||
|
||||
### 兼容性与回退复核清单(按 PR 审核口径)
|
||||
|
||||
- 运行时依赖窗口:`litellm>=1.80.10,<1.82.7`(与 `requirements.txt` 一致)。
|
||||
- 运行时依赖约束:`litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(与 `requirements.txt` 一致)。
|
||||
- 回归验证入口:
|
||||
- 渠道模型发现与连接:`tests/test_llm_channel_config.py`
|
||||
- 运行时源清理与恢复(含桌面导出备份链路):`tests/test_system_config_service.py`
|
||||
|
||||
@@ -75,7 +75,7 @@ OLLAMA_API_BASE=http://localhost:11434
|
||||
LITELLM_MODEL=ollama/qwen3:8b
|
||||
```
|
||||
|
||||
> **Important**: Ollama must be configured with `OLLAMA_API_BASE`. **Do not** use `OPENAI_BASE_URL`, or the system will concatenate URLs incorrectly (e.g. 404, `api/generate/api/show`). For remote Ollama, set `OLLAMA_API_BASE` to the actual address (e.g. `http://192.168.1.100:11434`). Current dependency requirement is LiteLLM ≥1.80.10 (matches requirements.txt).
|
||||
> **Important**: Ollama must be configured with `OLLAMA_API_BASE`. **Do not** use `OPENAI_BASE_URL`, or the system will concatenate URLs incorrectly (e.g. 404, `api/generate/api/show`). For remote Ollama, set `OLLAMA_API_BASE` to the actual address (e.g. `http://192.168.1.100:11434`). Current dependency constraint is `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` (matches requirements.txt).
|
||||
|
||||
> **Congratulations! If you're a beginner, you can stop reading here and run the program!**
|
||||
> Want to test the connection? Open your terminal in the root directory and run: `python test_env.py --llm`
|
||||
@@ -98,18 +98,18 @@ The backend exposes a read-only status endpoint at `GET /api/v1/system/config/se
|
||||
|
||||
- The preset provider / Base URL / sample models are **form defaults only**. What gets persisted is still exactly what you submit in `LLM_{CHANNEL}_PROTOCOL`, `LLM_{CHANNEL}_BASE_URL`, `LLM_{CHANNEL}_MODELS`, and `LLM_{CHANNEL}_API_KEY(S)`; the editor does not silently rewrite them to a different provider name or URL.
|
||||
- "Discover models" only calls `{base_url}/models` for `OpenAI Compatible` / `DeepSeek` channels, and the default "Test connection" action only sends one minimal chat completion request. Optional runtime capability checks must be explicitly selected by the user and send additional JSON / tools / stream / vision smoke requests; the result only represents a best-effort check for the current account, model, and endpoint at that moment. The returned `stage / error_code / details / latency_ms / capability_results` fields are for structured diagnostics only, are **never persisted** back into `.env`, and do not block saving.
|
||||
- Runtime capability checks send real LLM requests and may incur token / image-input cost, RPM/TPM rate limiting, insufficient balance errors, or timeouts. A failed check may come from account permissions, model entitlement, endpoint region, balance, provider compatibility layers, or LiteLLM translation behavior; it does not prove that the provider globally lacks that capability. P3 does not include online smoke coverage for every real provider. Its compatibility basis is the repository dependency window `litellm>=1.80.10,<1.82.7`, LiteLLM `completion()` / OpenAI I/O format / streaming / exception mapping, and the OpenAI Chat Completions shapes for JSON mode, tool calling, streaming, and vision input.
|
||||
- Runtime capability checks send real LLM requests and may incur token / image-input cost, RPM/TPM rate limiting, insufficient balance errors, or timeouts. A failed check may come from account permissions, model entitlement, endpoint region, balance, provider compatibility layers, or LiteLLM translation behavior; it does not prove that the provider globally lacks that capability. P3 does not include online smoke coverage for every real provider. Its compatibility basis is the repository dependency constraint `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`, LiteLLM `completion()` / OpenAI I/O format / streaming / exception mapping, and the OpenAI Chat Completions shapes for JSON mode, tool calling, streaming, and vision input.
|
||||
- External references: LiteLLM Python SDK / OpenAI I/O format / streaming / exception mapping: <https://docs.litellm.ai/>; LiteLLM OpenAI-compatible routing: <https://docs.litellm.ai/docs/providers/openai_compatible>; OpenAI Chat Completions: <https://platform.openai.com/docs/api-reference/chat/create>; JSON mode: <https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat>; tool calling: <https://platform.openai.com/docs/guides/function-calling?api-mode=chat>; streaming: <https://platform.openai.com/docs/guides/streaming-responses?api-mode=chat>; vision input: <https://platform.openai.com/docs/guides/images-vision?api-mode=chat>.
|
||||
- Saving channels only updates the keys submitted in that save operation; there is no whole-config silent migration when you switch channel settings. The one deliberate cleanup is runtime model references: if `LITELLM_MODEL`, `AGENT_LITELLM_MODEL`, `VISION_MODEL`, or `LITELLM_FALLBACK_MODELS` point to models that no longer exist in the currently enabled channels, the editor clears/removes those stale references before saving so runtime calls do not keep targeting invalid models. Even when enabled channels expose no selectable models, stale managed-provider values without a matching legacy key are cleaned. `cohere/*`, `google/*`, and `xai/*` are kept as explicit direct-env compatibility examples for legacy retention behavior only, and are not a runtime availability guarantee.
|
||||
- Backend consistency basis: runtime validation in `SystemConfigService._validate_llm_runtime_selection` (`src/services/system_config_service.py`) relies on `_uses_direct_env_provider` (`src/config.py`). Only `gemini`, `vertex_ai`, `anthropic`, `openai`, and `deepseek` are treated as managed key-backed providers; `cohere`, `google`, and `xai` are not in that allowlist, so they remain valid direct provider runtime entries.
|
||||
- Rollback stays minimal: restore the previous channel model list and re-select the runtime models, or restore the previous `LLM_*`, `LITELLM_MODEL`, `AGENT_LITELLM_MODEL`, `VISION_MODEL`, and `LLM_TEMPERATURE` values from your desktop export / manual `.env` backup. No extra migration script is required.
|
||||
- The current dependency window for this flow in the repository is `litellm>=1.80.10,<1.82.7` (see `requirements.txt`). Regression coverage for it lives in `tests/test_system_config_service.py`, `tests/test_system_config_api.py`, and `apps/dsa-web/src/components/settings/__tests__/LLMChannelEditor.test.tsx`.
|
||||
- The current dependency constraint for this flow in the repository is `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` (see `requirements.txt`). Regression coverage for it lives in `tests/test_system_config_service.py`, `tests/test_system_config_api.py`, and `apps/dsa-web/src/components/settings/__tests__/LLMChannelEditor.test.tsx`.
|
||||
|
||||
> **External provider model examples notice**: `cohere/*`, `google/*`, and `xai/*` provider-prefixed values are included here only to describe current runtime retention behavior and are **not** a global availability guarantee. Specific model names in docs or tests are configuration-retention examples, not production recommendations. Check the provider's official model/API docs and validate against the repository dependency window `litellm>=1.80.10,<1.82.7` before production use.
|
||||
> **External provider model examples notice**: `cohere/*`, `google/*`, and `xai/*` provider-prefixed values are included here only to describe current runtime retention behavior and are **not** a global availability guarantee. Specific model names in docs or tests are configuration-retention examples, not production recommendations. Check the provider's official model/API docs and validate against the repository dependency constraint `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` before production use.
|
||||
|
||||
### Rollback & compatibility evidence
|
||||
|
||||
- Scope and cleanup behavior under `litellm>=1.80.10,<1.82.7`: only runtime references (`LITELLM_MODEL`, `AGENT_LITELLM_MODEL`, `VISION_MODEL`, `LITELLM_FALLBACK_MODELS`) are sanitized during save; non-channel direct providers such as `cohere/*`, `google/*`, and `xai/*` are preserved.
|
||||
- Scope and cleanup behavior under `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`: only runtime references (`LITELLM_MODEL`, `AGENT_LITELLM_MODEL`, `VISION_MODEL`, `LITELLM_FALLBACK_MODELS`) are sanitized during save; non-channel direct providers such as `cohere/*`, `google/*`, and `xai/*` are preserved.
|
||||
- Rollback path: export desktop config, then restore the backup through `POST /api/v1/system/config/import`; or manually restore historical `.env` entries (`LITELLM_*`, `AGENT_LITELLM_MODEL`, `VISION_MODEL`, `LLM_TEMPERATURE`) and restart.
|
||||
- Rollback evidence: `tests/test_system_config_service.py::test_import_desktop_env_restores_runtime_models_after_cleanup` covers restore from exported desktop backup after runtime cleanup.
|
||||
- Direct-provider evidence: `tests/test_system_config_service.py::SystemConfigServiceTestCase::test_validate_accepts_minimax_model_as_direct_env_provider`, `test_validate_accepts_cohere_model_as_direct_env_provider`, `test_validate_accepts_google_model_as_direct_env_provider`, and `test_validate_accepts_xai_model_as_direct_env_provider` cover the preserved direct-provider behavior.
|
||||
@@ -196,7 +196,7 @@ LITELLM_MODEL=ollama/qwen3:8b
|
||||
- Moonshot officially documents Kimi as an OpenAI-compatible API, with `https://api.moonshot.ai/v1` as the base URL: <https://platform.kimi.ai/docs/guide/kimi-k2-6-quickstart>
|
||||
- LiteLLM officially requires the `openai/` prefix for OpenAI-compatible model routing: <https://docs.litellm.ai/docs/providers/openai_compatible>
|
||||
- Moonshot's compatibility docs distinguish two fixed values: **thinking mode must use `1.0`, while non-thinking mode must use `0.6`**; other values are rejected by the API: <https://platform.moonshot.ai/docs/guide/compatibility#parameters-differences-in-request-body>
|
||||
- The current runtime dependency window in this repository is `litellm>=1.80.10,<1.82.7` (see `requirements.txt`); this compatibility fix is regression-covered in that range across the main analyzer, market review, direct Agent LiteLLM calls, and the system-settings channel connectivity test path.
|
||||
- The current runtime dependency constraint in this repository is `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0` (see `requirements.txt`); this compatibility fix is regression-covered under that constraint across the main analyzer, market review, direct Agent LiteLLM calls, and the system-settings channel connectivity test path.
|
||||
- This repository therefore normalizes `kimi-k2.6` and `kimi-k2.6-*` right before dispatch based on the **actual request mode**: default / thinking requests use `temperature=1.0`; if your LiteLLM YAML route alias explicitly sets `litellm_params.extra_body.thinking.type: disabled` (or an equivalent non-thinking override), it automatically switches to `temperature=0.6`. Your saved `LLM_TEMPERATURE` value in `.env` or the Web settings is not rewritten.
|
||||
- `SystemConfigService` only updates keys that you actually submit when saving from the Web settings page or importing a desktop `.env`; switching to Kimi does not silently clear, migrate, or rewrite an existing `LLM_TEMPERATURE`. The temporary `1.0/0.6` used for Kimi channel tests is request-scoped and is not persisted back into the config file.
|
||||
- Non-Kimi primary models, non-Kimi fallbacks, and any request after switching away from Kimi still use your configured temperature. Existing configs do not need migration; changing the model restores the original behavior automatically.
|
||||
|
||||
@@ -204,7 +204,7 @@ class CommandDispatcher:
|
||||
- `LLM_CHANNELS`
|
||||
- legacy provider 键(`GEMINI_API_KEY` / `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `DEEPSEEK_API_KEY`)
|
||||
- 当主模型(`LITELLM_MODEL` 或 `AGENT_LITELLM_MODEL`)在当前激活层无可用来源时,会展示“AI 服务未配置”,并保留用户可见原因行。
|
||||
- 本仓库 `requirements.txt` 的运行时依赖窗口为 `litellm>=1.80.10,<1.82.7`,该窗口内本链路以现有兼容行为为准。
|
||||
- 本仓库 `requirements.txt` 的运行时依赖约束为 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`,该约束内本链路以现有兼容行为为准。
|
||||
- 该诊断规则与 `GET /api/v1/system/config/setup/status` 的 LLM 检查保持一致:`LITELLM_CONFIG`/`LLM_CHANNELS` 为高优先级;模式切换时不会做静默迁移,切回旧模式由用户显式恢复历史值或回滚。
|
||||
|
||||
### 回退与迁移边界
|
||||
|
||||
@@ -173,7 +173,7 @@ class BotCommand(ABC):
|
||||
- `LLM_CHANNELS`
|
||||
- legacy provider keys (`GEMINI_API_KEY` / `OPENAI_API_KEY` / `ANTHROPIC_API_KEY` / `DEEPSEEK_API_KEY`)
|
||||
- If the primary model (`LITELLM_MODEL` or `AGENT_LITELLM_MODEL`) has no configured source in the active layer, `/status` shows `AI 服务未配置` and keeps the explicit reason line.
|
||||
- Runtime dependency range in this repository is `litellm>=1.80.10,<1.82.7`; current status semantics are aligned with this window.
|
||||
- Runtime dependency constraint in this repository is `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`; current status semantics are aligned with this constraint.
|
||||
- This diagnostic follows the same readiness rules as `GET /api/v1/system/config/setup/status` for LLM checks: channels/yaml are active higher priority than legacy keys, and no silent migration is performed when toggling modes.
|
||||
|
||||
### Fallback and migration boundary
|
||||
|
||||
@@ -87,7 +87,7 @@ OpenAI-compatible Base URL 只填到服务商兼容入口,不额外拼接 `/ch
|
||||
| OpenRouter | [Models API](https://openrouter.ai/docs/api/api-reference/models/get-models) | OpenRouter 支持 `~anthropic/claude-sonnet-latest`、`~openai/gpt-latest` 等 latest router alias;2026-05-03 的一次手动 live smoke 以 Claude Sonnet latest 作为默认示例通过,GPT latest 保留为可按账号权限切换的备选。 |
|
||||
| LiteLLM | [OpenAI-Compatible Endpoints](https://docs.litellm.ai/docs/providers/openai_compatible) | OpenAI-compatible 端点需要把运行时模型写成 `openai/<model>`,Base URL 只填到服务商兼容入口,不额外拼接 `/chat/completions`。 |
|
||||
|
||||
本页预设只保证配置形状与当前依赖的 OpenAI-compatible 路由规则一致;实际连通性仍取决于服务商账号权限、地域、额度和模型开通状态。当前 LiteLLM 版本约束以 `requirements.txt` 为准。
|
||||
本页预设只保证配置形状与当前依赖的 OpenAI-compatible 路由规则一致;实际连通性仍取决于服务商账号权限、地域、额度和模型开通状态。当前 LiteLLM 版本约束为 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(见 `requirements.txt`),保留历史最低版本、显式排除 PyPI 事故版本,并避免未来大版本自动进入。
|
||||
|
||||
## OpenAI-compatible 与 LiteLLM 规则
|
||||
|
||||
@@ -149,6 +149,7 @@ Ollama 默认 Base URL `http://127.0.0.1:11434` 主要面向本地、Docker 或
|
||||
- 检测结果只代表当前账号、模型和 endpoint 的一次 best-effort 运行时结果。
|
||||
- 检测结果不会写回 `.env`,也不会阻止保存配置。
|
||||
- 能力检测失败不等于 provider 全局不支持;失败可能来自账号权限、模型未开通、endpoint 区域、余额、服务商兼容层或 LiteLLM 转换路径。
|
||||
- 当前实现未对所有真实 provider 做在线 smoke,兼容依据是 `litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0`(见 `requirements.txt`)、[LiteLLM Python SDK / OpenAI I/O format](https://docs.litellm.ai/)、[LiteLLM OpenAI-compatible 路由](https://docs.litellm.ai/docs/providers/openai_compatible),以及 OpenAI Chat Completions 的 [JSON mode](https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat)、[tool calling](https://platform.openai.com/docs/guides/function-calling?api-mode=chat)、[streaming](https://platform.openai.com/docs/guides/streaming-responses?api-mode=chat) 和 [vision input](https://platform.openai.com/docs/guides/images-vision?api-mode=chat) 请求形状。
|
||||
|
||||
## 回滚方式
|
||||
|
||||
|
||||
@@ -30,9 +30,8 @@ numpy>=1.24.0 # 数值计算
|
||||
json-repair>=0.55.1 # JSON 修复
|
||||
|
||||
# AI 分析
|
||||
# Restore official PyPI install after the quarantined 1.82.7 / 1.82.8 builds were removed.
|
||||
# Keep the historical minimum version and add a safe upper bound.
|
||||
litellm>=1.80.10,<1.82.7 # Unified LLM client (Gemini/Anthropic/OpenAI/DeepSeek etc.)
|
||||
# Keep the historical minimum version while excluding quarantined builds and avoiding future major breaks.
|
||||
litellm>=1.80.10,!=1.82.7,!=1.82.8,<2.0.0 # Unified LLM client (Gemini/Anthropic/OpenAI/DeepSeek etc.)
|
||||
tiktoken>=0.8.0,<0.12.0 # BPE tokenizer for LLM token counting (pin <0.12 to avoid plugin registration issues, #537)
|
||||
openai>=1.0.0 # OpenAI SDK (transitive dependency of litellm, kept explicit)
|
||||
PyYAML>=6.0 # YAML parser for LITELLM_CONFIG support
|
||||
|
||||
Reference in New Issue
Block a user