fix(llm): Agent 绑定优先于任务 LLM 配置链
任务内各角色解析 LLM 的顺序由「任务链 → Agent 绑定 → 全局」改为 「Agent 绑定 → 任务链 → 全局」:显式绑定了模型的角色始终跑在该模型上, 未绑定的角色才落到任务链,任务链为空时再落到全局配置。 - 拆分 fallbackProviderForAgent 为 agentBindingProvider / globalProvider, 让三个层级可按新顺序自由组合 - current()、CompactionWindow()、taskRuntimeAvailable() 统一按新顺序解析; taskRuntimeAvailable 改为逐角色判断,有可用绑定的角色在任务链耗尽时仍可运行 - resolveTaskRoleLLM(UI 展示)与前端 mock 同步对调,避免显示与实际调用不一致 保留两处既有语义:绑定/全局路径仍返回 profileID=0,不推进任务链故障转移 (绑定自身的转移仍由 poolForBinding + llm_pool_bind_fallback 负责);未绑定 角色遇到任务链耗尽仍是硬停止,不静默降级到全局。 Claude-Session: https://claude.ai/code/session_01Q8nhYZfS4H8fsSCBJXxbSy
This commit is contained in:
1 parent
476a44577c
commit
adc8e3521d
5 files changed
+175
-49
No files matched your search
@@ -108,7 +108,14 @@ function mockProfileResolution(profileID: number | undefined, source: TaskLLMRes
|
||||
};
|
||||
}
|
||||
|
||||
// Mirrors the backend precedence in server/task_resolution.go:
|
||||
// Agent 绑定 → 任务 LLM 配置链 → 全局配置 → 环境配置。
|
||||
function mockRoleResolution(task: Task, agentKey: "mainagent" | "planner" | "worker"): TaskLLMResolution {
|
||||
const agent = D.agents.find((item) => item.key === agentKey);
|
||||
if (agent?.llm_profile_id) {
|
||||
const bound = mockProfileResolution(agent.llm_profile_id, "agent_binding");
|
||||
if (bound.available) return bound;
|
||||
}
|
||||
if (task.llm_profile_ids?.length) {
|
||||
if (task.active_llm_profile_id === undefined) {
|
||||
return {
|
||||
@@ -122,11 +129,6 @@ function mockRoleResolution(task: Task, agentKey: "mainagent" | "planner" | "wor
|
||||
}
|
||||
return mockProfileResolution(task.active_llm_profile_id, "task_chain");
|
||||
}
|
||||
const agent = D.agents.find((item) => item.key === agentKey);
|
||||
if (agent?.llm_profile_id) {
|
||||
const bound = mockProfileResolution(agent.llm_profile_id, "agent_binding");
|
||||
if (bound.available) return bound;
|
||||
}
|
||||
const globalProfile = D.llmProfiles.find((item) => item.is_default);
|
||||
if (globalProfile) return mockProfileResolution(Number(globalProfile.id), "global_profile");
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user