auto-sync: 2026-05-17 18:37:34
This commit is contained in:
@@ -231,6 +231,26 @@ class Dispatcher:
|
||||
"reason": "Unknown dispatch level",
|
||||
}
|
||||
|
||||
def _resolve_by_capability(self, task: Task) -> str:
|
||||
"""两级路由:capability_map 匹配 → fallback 庞统"""
|
||||
task_type = getattr(task, 'task_type', '') or ''
|
||||
|
||||
# Tier 1: task_type → capability_map
|
||||
if task_type in self.capability_map:
|
||||
candidates = self.capability_map[task_type]
|
||||
# 过滤只保留注册的 Agent
|
||||
registered = [a for a in candidates if a in self.registered_agents]
|
||||
if registered:
|
||||
# 多候选时选负载最低的
|
||||
if self.counter and len(registered) > 1:
|
||||
best = min(registered,
|
||||
key=lambda a: self.counter.active_count(a))
|
||||
return best
|
||||
return registered[0]
|
||||
|
||||
# Tier 2: fallback 庞统
|
||||
return "pangtong-fujunshi"
|
||||
|
||||
def _build_retry_context(self, task: Task) -> str:
|
||||
"""构建重试上下文(前轮产出摘要 + 审查意见)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user