feat(gateway,admin-web): 面板可编辑 provider 推理形状 / 角色级路由 / multimodal 真语义(裁决 03.4.2/03.4.1)
- 后端:AdminLlmProvider 暴露 reasoning{kind}(恒下发,""=未声明=auto)、personaModels、personaProviders;
顶层新增 reasoningKinds / personaProviderOptions 两个**取值域**(唯一来源= runtimeconfig 导出枚举,
校验错误文案也由枚举拼接 ⇒ 不可能漂移)
- 读写共用同一映射(admin_llm_provider.go),避免「读侧少一个键 ⇒ 面板一保存就抹掉」
- 写侧语义:缺失=保留、给出=整块/整表替换;非法值一律 runtimeconfig.Group.Validate() ⇒ 400 bad_request
(实测非法 kind 返回 400 且 models.json 完全不动,而非 500 静默失败)
- 前端:新增 LlmProviderRouting(推理形状下拉 + multimodal 开关 + 按角色路由编辑器);
目录能力位改三态(true/false/未标注),「未标注」不再谎称「不支持」;目录/角色清单不可用时
**不阻塞编辑**且与「字段为空」是不同状态;绝无 mock/sample 回退
- 复核:build/vet 绿 + gateway/config 包测试绿 + tsc 0 错 + vite build 成功;2 条变异反证(删 reasoning
补丁 → 2 例红;删 Group.Validate → 该 400 用例红)已还原
- 注意(主会话已知):npm run build 把新 SPA 写进 frontend/web/dist,而运行中的二进制优先从磁盘读该目录
⇒ :10942 目前是「新面板 + 旧后端」,等阶段 5 全绿后按红线「先 build 到位、再一次 restart」切换
This commit is contained in:
1 parent
8890c30bb5
commit
1ac02bd77e
12 files changed
+998
-85
No files matched your search
@@ -54,6 +54,28 @@ const (
|
||||
ReasoningKindDashScope = "dashscope"
|
||||
)
|
||||
|
||||
// ReasoningKinds 返回本 build 接受的 reasoning.kind 取值全集(auto 在首位,
|
||||
// 与面板下拉框的推荐顺序一致)。它是**校验与面板的同一来源**:管理端点把这份
|
||||
// 清单随配置一起下发,面板据此渲染下拉框,因此「面板能选的」与「配置层接受的」
|
||||
// 不可能漂移。空串(未声明)不在此列——它是「不声明形状」而不是一个形状名,
|
||||
// 面板另行给出该选项。返回新切片,调用方改不动包内状态。
|
||||
func ReasoningKinds() []string {
|
||||
return []string{
|
||||
ReasoningKindAuto,
|
||||
ReasoningKindDeepSeek,
|
||||
ReasoningKindOpenAI,
|
||||
ReasoningKindVLLM,
|
||||
ReasoningKindDashScope,
|
||||
}
|
||||
}
|
||||
|
||||
// ProviderNames 返回本 build 承认的 wire 协议名,用作 per-persona 路由
|
||||
// (personaProviders)的合法值域。与面板共用同一来源,避免面板给出一个
|
||||
// 配置层会拒收的协议名。
|
||||
func ProviderNames() []string {
|
||||
return []string{ProviderOpenAI, ProviderAnthropic}
|
||||
}
|
||||
|
||||
// ReasoningOptions 是一个 provider 组的推理开关形状声明。它是「按提供商
|
||||
// 独立适配」的配置载体(裁决 03.4.2 / 08.4.1):面板与 models.json 对每个
|
||||
// 供应商各写一份,因此 vLLM 端点与 DashScope 端点可以同时存在、各自下发
|
||||
@@ -150,7 +172,7 @@ func validateReasoning(provider string, r ReasoningOptions) error {
|
||||
case "", ReasoningKindAuto, ReasoningKindDeepSeek, ReasoningKindOpenAI,
|
||||
ReasoningKindVLLM, ReasoningKindDashScope:
|
||||
default:
|
||||
return fmt.Errorf("reasoning.kind %q must be one of auto/deepseek/openai/vllm/dashscope", kind)
|
||||
return fmt.Errorf("reasoning.kind %q must be one of %s", kind, strings.Join(ReasoningKinds(), "/"))
|
||||
}
|
||||
if provider == ProviderAnthropic && kind != "" && kind != ReasoningKindAuto {
|
||||
return fmt.Errorf("reasoning.kind %q applies to the openai-compatible provider only", kind)
|
||||
|
||||
Reference in new issue
Block a user