refactor: 重构聊天模块支持 SSE 断线重连及用户上下文隔离

This commit is contained in:
zl-q
2026-03-30 09:06:10 +08:00
parent 1aac62f39e
commit 4285b4ec80
28 changed files with 1624 additions and 658 deletions
@@ -70,7 +70,6 @@ def _router_rules(llm_config: SystemAgentLLMConfig | None) -> list[str]:
"- Return key_entities and constraints that are execution-relevant; low confidence -> omit rather than guess.",
"- Set execution_mode by complexity: onestep / tool_assisted / multistep.",
"- Set result_typing.primary to the most suitable response shape; use clarification_request only when required info is missing.",
"- Set ui.ui_mode and ui.ui_decision_reason based on whether structured UI improves actionability.",
f"- task_typing.primary must use one TaskType enum: {_enum_values(TaskType)}.",
f"- task_typing.secondary max 3 enums: {_enum_values(TaskType)}.",
f"- result_typing.primary must use one ResultType enum: {_enum_values(ResultType)}.",
@@ -279,7 +279,7 @@ class AgentScopeRunner:
runtime_mode: RuntimeMode,
work_memory: WorkProfileContent | None,
) -> WorkerAgentOutputLite:
worker_output_model = resolve_worker_output_model(router_output.ui.ui_mode)
worker_output_model = resolve_worker_output_model(router_output.execution_mode)
await self._emit_step_event(
pipeline=pipeline,
run_input=run_input,
@@ -51,7 +51,10 @@ def _status_badge_needed(intent: UiHintIntent, status: UiHintStatus) -> bool:
def _status_label(status: str) -> str:
return status.upper()
normalized = status.strip().lower()
if not normalized:
return "ui.status.info"
return f"ui.status.{normalized}"
# ============================================================