代码合并

This commit is contained in:
董宏凯 committed 2026-09-08 09:40:31 +08:00
1 parent b0970de677
commit 8859c13cfb
26 files changed
+1707 -334

No files matched your search

@@ -302,7 +302,29 @@ async def send_message(
agent_run_id=body.agent_run_id,
node_run_id=body.target_node_id,
)
await RequirementResolver(store).handle_user_message(session_id, user_message=created, idempotency_key=key)
decision = await RequirementResolver(
store,
config=get_app_config().report_collaboration,
planner_llm_factory=getattr(request.app.state, "report_collaboration_planner_llm", None),
).handle_user_message(session_id, user_message=created, idempotency_key=key)
# 确认完意图直接规划工作流(设计 v2 衔接):ready 且尚无方案时,
# 同一次请求内自动发起规划,用户不用再手动点「生成候选方案」。
if decision is not None and decision.action == "ready":
record = await store.get_session_record(session_id)
plans = await store.list_plans(session_id)
if not plans and record and not record.get("selected_plan_id"):
command = await store.enqueue_plan_request(
session_id,
idempotency_key=f"{key}:autoplan",
expected_revision=decision.requirement.revision,
)
if command.get("status") == "pending":
await PlanProposalService(
store,
agent_store=getattr(request.app.state, "agent_store", None),
config=get_app_config().report_collaboration,
llm_factory=getattr(request.app.state, "report_collaboration_planner_llm", None),
).fulfill(session_id, user_id=user_id, command_id=command["command_id"], idempotency_key=f"{key}:autoplan")
return created
except Exception as exc:
return _map_store_error(exc)
@@ -333,6 +355,8 @@ async def request_plans(
await PlanProposalService(
store,
agent_store=getattr(request.app.state, "agent_store", None),
config=get_app_config().report_collaboration,
llm_factory=getattr(request.app.state, "report_collaboration_planner_llm", None),
).fulfill(session_id, user_id=user_id, command_id=command["command_id"], idempotency_key=key)
return Response(status_code=204)
except Exception as exc: