fix(llm): 修复自定义/Anthropic/OpenAI 规范 LLM 连接失败问题 - #3
Open
AWDSCAN wants to merge 1 commit into
Open
Conversation
根因:src/llm/client.py 的 _litellm_kwargs() 把自定义 provider ID 拼成 '<custom-id>/<model>' 前缀(litellm 无法识别),且 type 字段无法路由到 Anthropic 格式端点,导致自定义/OpenAI/Anthropic 规范全部连不上。 后端修复(路由单点收口,Agent 层零改动): - LLMConfig / LLMConfigUpdate 新增 llm_format(openai | anthropic) - config_service.get_llm_runtime_config 读取 LLM_format - 重写 _litellm_kwargs 路由: · 内置 provider -> litellm 原生 provider/model · 自定义 + OpenAI 兼容 -> custom_llm_provider=openai + 裸模型名 + base_url · 自定义 + Anthropic -> custom_llm_provider=anthropic + 裸模型名 + base_url · 自定义未指定格式 -> 按 base_url 启发式(含 /anthropic 视作 anthropic) - /llm/test 返回路由诊断(model/provider/base_url/format + 回复 + 用量) 前端:自定义 Provider 新增「API 格式」下拉,base_url placeholder 随格式联动 已用 DeepSeek key 对内置/自定义+OpenAI/自定义+Anthropic/启发式 5 场景回归验证通过
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因:src/llm/client.py 的 _litellm_kwargs() 把自定义 provider ID 拼成 '/' 前缀(litellm 无法识别),且 type 字段无法路由到 Anthropic 格式端点,导致自定义/OpenAI/Anthropic 规范全部连不上。
后端修复(路由单点收口,Agent 层零改动):
前端:自定义 Provider 新增「API 格式」下拉,base_url placeholder 随格式联动