第三十一轮: 虚拟模型 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 13789da6d1
commit 76ffbad4f7
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',