Repository navigation
fix: 模型目录不再被硬编码白名单裁剪(/v1/models 全量暴露上游模型) - #5
Closed
jhwan1644-beep wants to merge 1 commit into
Closed
jhwan1644-beep wants to merge 1 commit into
jhwan1644-beep wants to merge 1 commit into
Conversation
问题:/v1/models 既不全也不准,上游已可调用的新模型进不来,已下线的模型出不去。
根因:catalogToModels() 里 VERIFIED_AVAILABLE 是 2026-09-13 手测后写死的 24 个模型,
其后紧跟 `if (region == INTERNATIONAL && id !in VERIFIED_AVAILABLE) continue`,
把活拉的目录直接裁成静态名单——名单编译期固定、目录运行时变化,于是:
· 假阴性:上游新模型被 continue 丢掉,只能重新发版才能出现;
· 假阳性:上游已下线的仍在暴露。
实测(app 1.2.1-dev,本机 8788):
· GET /v1/models 返回 24 个(全国际版);
· 直连 POST /v1/chat/completions 打不在列表里的模型,全部 200:
gpt-6-luna / gpt-6-sol / grok-4.7 / gemini-3.8-flash;
· 白名单里的 gpt-5.1-codex 反而已下线:上游 11102 model service info not found;
· 对照绑国际池的目录:远端 30 个 vs 本机 24 个,缺 13 个
(gpt-6-sol、gpt-6-luna、gpt-6-astra、grok-4.7、gemini-3.8-flash、glm-5.3-flash、
hy4-preview、hy4-preview-f、kimi-k2.8-preview、deepseek-v4.1-flash-sg、
gpt-image-2.5-sunburst、seedance-2.5,以及 default-model 即 auto)。
修复:
· 删掉那句 continue,改为以活目录为准全量暴露(仍跳过 disabled);
· VERIFIED_AVAILABLE 降级为提示字段 verified,交给 UI,不再充当过滤条件;
· 模型页对 verified=false 的模型标「未经本机实测」——不隐藏,但提示可能撞 11102;
· 不可用模型由上游 11102 原样透传,客户端本来就会如实报错,比静默消失可诊断。
版本号 6→7 / 1.2.1-dev→1.2.2-dev:按 build.gradle.kts 里既有的约定递增,
方便装上后在「设置 → 关于 → 版本」确认拿到的是新版。
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.
问题:
/v1/models既不全也不准上游已能正常调用的新模型不在列表里;列表里却留着已经下线的模型。用户看到的就是「模型不全/不对」。
根因
NativeCore.kt→catalogToModels():目录是从上游活拉的,名单是编译期固定的。于是两个方向都错:
continue丢掉,只能重新发版才能出现;实测证据(app 1.2.1-dev,本机
127.0.0.1:8788)GET /v1/models返回 24 个(全部国际版)。POST /v1/chat/completions打不在列表里的模型,全部成功:gpt-6-lunagpt-6-solgrok-4.7gemini-3.8-flashgpt-5.1-codex(在名单里)11102 model service info not foundgpt-6-sol、gpt-6-luna、gpt-6-astra、grok-4.7、gemini-3.8-flash、glm-5.3-flash、hy4-preview、hy4-preview-f、kimi-k2.8-preview、deepseek-v4.1-flash-sg、gpt-image-2.5-sunburst、seedance-2.5,以及default-model(即 App 内的auto)。改动
continue,改为以活目录为准全量暴露(仍跳过上游标了disabled的);VERIFIED_AVAILABLE降级为提示字段verified,不再充当过滤条件;verified=false的模型标一行「未经本机实测」——不隐藏(隐藏正是旧病),只是提示可能撞 11102;11102原样透传:客户端本来就会如实报错,比静默消失可诊断得多;versionCode 6→7、1.2.1-dev→1.2.2-dev(按build.gradle.kts里既有的约定递增,便于装机后在「设置 → 关于 → 版本」确认拿到新版)。为什么这样是对的
判断「能不能用」只能实际发一次请求,目录只代表「上游存在这个模型」。把目录当过滤器必然两头都错,而且错得会随时间越来越严重(名单不会自己更新)。这与原作者在 Python 版里已经确立的原则一致:
CODE_REVIEW_TODO.md写明「不硬编码模型清单」,AGENTS.md明确「模型目录 ≠ 模型可用性……绝不能据此把模型置灰或禁用」。附带的次要点
app/src/main/assets/codebuddy-international-models.json(@tencent-ai/codebuddy-code@2.150.0,2026-09-13 生成)也已明显落后于上游,仅在上游拉取失败时兜底;有条件时建议一并重新生成(本 PR 未改动它,避免混淆主次)。