auto-sync: 2026-05-17 21:41:58

This commit is contained in:
cfdaily
2026-05-17 21:41:58 +08:00
parent 075446306e
commit 37d3dcb0cb
+40 -4
View File
@@ -118,13 +118,49 @@ async def lifespan(app: FastAPI):
max_global=daemon_config.get("max_global_agents", 5),
max_per_agent=daemon_config.get("max_per_agent", 2),
)
registered_agents = daemon_config.get("registered_agents", [])
capability_map = daemon_config.get("capability_map", {})
# 构建 Agent 能力画像(v2.6.1 路由)
agent_profiles_config = daemon_config.get("agent_profiles", {})
agent_profiles = {}
for aid, prof in agent_profiles_config.items():
agent_profiles[aid] = AgentProfile(
agent_id=aid,
capabilities=prof.get("capabilities", []),
can_review=prof.get("can_review", False),
max_concurrent=prof.get("max_concurrent", 1),
is_fallback=prof.get("is_fallback", False),
)
# 构建 LLM DriverMode A 路由)
routing_config = daemon_config.get("routing", {})
llm_driver = None
routing_model = routing_config.get("model", "")
if routing_model:
llm_driver = LLMDriver(
model=routing_model,
api_base=routing_config.get("api_base", ""),
api_key=routing_config.get("api_key", ""),
timeout=routing_config.get("timeout", 5.0),
max_tokens=routing_config.get("max_tokens", 200),
temperature=routing_config.get("temperature", 0.1),
)
logger.info("LLM routing driver initialized (model=%s)", routing_model)
# 构建 Router + Dispatcher
router = AgentRouter(
agent_profiles=agent_profiles,
llm_driver=llm_driver,
counter=counter,
)
# 获取项目级 DB 路径(用于路由审计日志)
default_db_path = DATA_ROOT / "default" / "blackboard.db"
dispatcher = Dispatcher(
registered_agents=registered_agents,
router=router,
spawner=spawner,
counter=counter,
capability_map=capability_map,
db_path=default_db_path,
)
ticker = Ticker(