第三十一轮: 虚拟模型 id(别名 wjd)—— 客户端固定模型名,映射到哪个真实模型由管理员在页面上选

- config: AliasSpec{enabled,target,note} + GatewayConfig.aliases + resolve_alias/alias_of;
  保存期四条硬规则(目标存在 / 必须是文本模型且支持 chat/completions / 不得与真实模型 id 重名 /
  启用却没写 target);停用时跳过 target 校验。别名不进 _model_index —— 必须显式 resolve_alias()。
- main: chat 线(含 batch)入口换 id 转发;messages/responses 打别名 400 指路(不打上游);
  images/videos 明确 400 拒绝;/v1/models 注入别名条目(alias_of + 继承目标能力);
  流式 chunk 统一回显请求名(非别名调用零变化);_log_alias_changes 记指向变更(含谁改的)。
- settings: 面板 aliases 段(按段合并,不提交则沿用原文)+ 渲染 yaml 时带说明注释。
- web: Models 页「虚拟模型 id(别名)」卡片(admin 开关 + 目标下拉,非 chat/completions 置灰;
  member 只读一行);别名不进模型计数/测速列表/模型表;i18n 中英 753/753。
- tests: +8 条(规则与解析/目录继承/chat 端到端/另两线 400 且不打上游/媒体拒绝/测速说明/
  流式唯一模型名/面板往返 + 非法目标 400 不写盘)→ 187 passed / 0 failed。
- 生产: wjd → agnes-3.0-flash;后端 pid 1872300、前端 index-BJNJXWEY.js。
This commit is contained in:
小银 committed 2026-09-18 23:42:34 +08:00
1 parent 0bf607e35f
commit 73dd2053e6
10 files changed
+1251 -321

No files matched your search

+19
View File
@@ -407,6 +407,25 @@ export default {
protocolNaHint: 'Image / video models use the dedicated /v1/images/generations and /v1/videos endpoints and are not tied to the three protocol lines',
protocolHintRow: 'Supported formats: {lines} ',
probedLine: 'probed via {p}',
// Round 31: virtual model id (alias) — clients always send model: wjd, the gateway
// forwards to the model an admin picks. An alias is not a model: it never shows up in
// the speed-test list or the model counts, only in this card and its read-only row.
aliasCard: 'Virtual model id (alias)',
aliasSub: 'Clients always send model: {id}; the gateway forwards to the model you pick',
aliasLine: 'Only the chat/completions (OpenAI) format is supported: calling {id} on /v1/messages or /v1/responses is rejected with 400 at the gateway (it never translates formats).',
aliasInherit: 'Vision, forced params and pricing all follow the target model — the alias stores no configuration of its own, so switching the target switches everything.',
aliasName: 'Alias id',
aliasTarget: 'Target model',
aliasTargetPick: 'Pick a text model that supports chat/completions',
aliasPickHint: 'Only text models that support chat/completions can be picked; everything else is greyed out (image/video models, and models that only speak messages or responses).',
aliasCurrentTarget: 'Currently points to',
aliasEnabled: 'Enabled',
aliasDisabled: 'Disabled',
aliasNotConfigured: 'No target model configured yet — clients sending model: {id} get "unknown model".',
aliasReadonly: 'Read-only: the mapping is chosen by an admin in the gateway config',
aliasSave: 'Save mapping',
aliasSaved: '{id} → {target} is live',
aliasSaveFail: 'Save failed',
},
history: {
saveFail: 'History could not be saved to the gateway (it may be lost on refresh) — check your session or network',
+18
View File
@@ -406,6 +406,24 @@ export default {
protocolNaHint: '图像 / 视频模型走 /v1/images/generations、/v1/videos 专用端点,不涉及这三条协议线',
protocolHintRow: '支持的格式:{lines} ',
probedLine: '本次测速走 {p}',
// 第三十一轮:虚拟模型 id(别名)—— 客户端固定写 model: wjd,实际转发到管理员选的模型。
// 别名不是模型:不进测速列表、不进模型计数,只有这一张卡片和它的只读行。
aliasCard: '虚拟模型 id(别名)',
aliasSub: '客户端固定写 model: {id},网关转发到你选的模型',
aliasLine: '只支持 chat/completions(OpenAI)格式:用 /v1/messages、/v1/responses 打 {id} 会在入口直接 400(网关不做跨格式转换)。',
aliasInherit: '视觉能力、强制参数与定价都跟随目标模型 —— 别名不另存一份配置,改目标即可整体切换。',
aliasName: '别名 ID',
aliasTarget: '目标模型',
aliasTargetPick: '选择一个支持 chat/completions 的文本模型',
aliasPickHint: '只有支持 chat/completions 的文本模型可选;其余在列表里置灰(图像/视频模型与只认 messages、responses 的模型)。',
aliasCurrentTarget: '当前指向',
aliasEnabled: '启用',
aliasDisabled: '已停用',
aliasNotConfigured: '尚未配置目标模型 —— 此时客户端写 model: {id} 会得到「未知模型」。',
aliasReadonly: '只读:映射由管理员在网关配置里选择',
aliasSave: '保存映射',
aliasSaved: '{id} → {target} 已生效',
aliasSaveFail: '保存失败',
},
history: {
saveFail: '历史未能保存到服务端(刷新后可能丢失),请检查登录状态或网络',