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:
Autumn-27 committed 2026-08-11 12:15:38 -04:00
1 parent 289cf6a24f
commit c84bba477f
10 files changed
+238 -55

No files matched your search

+2
View File
@@ -304,6 +304,7 @@ type AgentDTO struct {
RunSecs int `json:"run_seconds"`
WebSearch bool `json:"web_search"`
InteractiveShell bool `json:"interactive_shell"`
LLMProfileID *int64 `json:"llm_profile_id"` // 绑定的 LLM 配置;null=跟随任务/全局
// P3 触发后处理策略(仅自定义 agent 有意义)。
TriggerRunMode string `json:"trigger_run_mode"`
TriggerMergeMode string `json:"trigger_merge_mode"`
@@ -327,6 +328,7 @@ func agentDTO(a *db.Agent) AgentDTO {
RunSecs: a.RunSecs,
WebSearch: a.WebSearch,
InteractiveShell: a.InteractiveShell,
LLMProfileID: a.LLMProfileID,
TriggerRunMode: a.TriggerRunMode,
TriggerMergeMode: a.TriggerMergeMode,
TriggerMaxParallel: a.TriggerMaxParallel,