fix(backend): 模型名含斜杠时按 OpenAI 兼容兜底路由 + 模型测试改 ping 语义 - #85
Merged
Merged
Conversation
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.
What & why
修复 #83(两个提交):
① resolver 应用层 OpenAI 兼容兜底(
fix):resolve_litellm_model原先对含/的 model_id 一律原样透传,跳过 provider 路由——「组织/模型」命名(网关常见格式)被 litellm 按首段当未知 provider 解析,报BadRequestError: LLM Provider NOT provided。新规则:litellm_model显式覆写优先(不变);openai/前缀(组织/模型命名同样走这里);/:首段命中 litellm 注册表(带缓存,取.value)→ 原样透传(旧语义保留);首段未知 → 兜底openai/前缀(应用层「未知即 OpenAI 兼容」约定,讨论见 [P1][LLM] 模型名含斜杠的自定义网关模型被 litellm 拒绝:Provider NOT provided #83 评论);② 模型测试改 ping 语义(
chore):现有POST /models/{id}/test即连通性检查(复用而非新造端点),提示词改为ping、max_tokens 200→16——输出压到短语级,成本趋近于零、推理型模型不再长思考;思考占满导致空正文时沿用既有 note 分支提示重试。Refs #83。Closes #83。
Area
Verification
make test-backend(TEST_PG_PORT=5341,退出码落盘/tmp/final-full.exit)= 0Verifier verdict
CI 门禁即机器 Verifier;路由规则由新旧共 10 个 resolver 单测钉死。本 PR 按新规则停在合并前等所有者审批。
Checklist
issue-<number>-<short-slug>and PR links the issueexample-org/example-29b占位)