feat(agent): 支持为每个 agent 绑定 LLM 配置(agent 级默认模型)
按优先级 Agent 绑定 > 任务/会话指定 > 全局激活 解析每个 agent 运行的模型, 使 planner/worker/goals/mainagent/自定义 agent 可各自走不同 profile(如 plan 用 强模型、work 用弱模型)。未绑定时行为与原先完全一致。 - db: Agent 增 llm_profile_id + SetAgentLLMProfile;schema 幂等兜底 ALTER - server: 新增 effectiveProfileForAgent/providerForProfile/providerForAgent; buildPlannerWorker 让 planner/worker 各自解析 provider;provider 按 profile id 缓存以共享限速器;goals/会话链同步走绑定;绑定变更热重载 - api: agent 配置接口收 llm_profile_id(三态) + 返回可选 profile 列表 - web: agent 编辑器「配置与提示词」页新增「默认模型」下拉
This commit is contained in:
1 parent
289cf6a24f
commit
c84bba477f
10 files changed
+238
-55
No files matched your search
+9
-4
@@ -62,11 +62,16 @@ func (s *Server) createGoals(ctx context.Context, t *Task, emit func(db.Activity
|
||||
return specs
|
||||
}
|
||||
|
||||
// goalsLLMConfig resolves the LLM config for goal decomposition: the task's pinned
|
||||
// profile if any, else the global active profile (same source the engine runs on).
|
||||
// goalsLLMConfig resolves the LLM config for goal decomposition by the standard
|
||||
// precedence: the goals agent's own binding → the task's pinned profile → the global
|
||||
// active profile (same source the engine runs on).
|
||||
func (s *Server) goalsLLMConfig(t *Task) (agent.Config, bool) {
|
||||
if t != nil && t.LLMProfileID != nil {
|
||||
if cfg, ok := s.loadProfileConfig(*t.LLMProfileID); ok {
|
||||
var pin *int64
|
||||
if t != nil {
|
||||
pin = t.LLMProfileID
|
||||
}
|
||||
if eff := s.effectiveProfileForAgent("goals", pin); eff != nil {
|
||||
if cfg, ok := s.loadProfileConfig(*eff); ok {
|
||||
return cfg, true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user