agent: 更智能的 LLM provider 调度(byModel 精确路由 + AUTO 优先级链)

吸收 llmsproxy 的调度思想适配 HomeAgent“一源一模型”结构:
- RoutableProvider{Model,Priority} 次级接口(不破坏既有 Provider 实现)
- ProviderManager.OrderedProviders 改为按 (优先级 desc, 可用, 默认优先) 稳定排序,
  AUTO/空模型走该优先级链
- 新增 ProviderManager.ResolveForModel:精确模型名路由到归属源,找不到回落 AUTO 链
- LuaAdaptedProvider 不再无条件覆写 req.Model;显式模型名原样转发
- LLMSource.Priority + core.llm.sources.<name>.priority 配置项
- process.go: 显式模型走 ResolveForModel,AUTO 走 OrderedProviders
- 新增路由单测(优先级排序 + byModel 解析)

验证: go test ./... 27 包 0 失败;Windows 交叉编译通过;部署后服务健康
This commit is contained in:
root
2026-08-10 11:54:45 +08:00
parent f0dacef281
commit f960fde785
7 changed files with 154 additions and 19 deletions

View File

@ -105,6 +105,7 @@ type LLMSource struct {
AdapterPath string `json:"adapter_path,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
MaxConcurrent int `json:"max_concurrent,omitempty"`
Priority int `json:"priority,omitempty"`
ThinkingEnabled bool `json:"thinking_enabled,omitempty"`
}