岗位会商

This commit is contained in:
fengxiangdebaozi committed 2026-07-22 15:40:00 +08:00
1 parent 1cd99a5a90
commit 1bc203b5cd
23 files changed
+2230 -401

No files matched your search

@@ -55,7 +55,8 @@ import re
import time
import traceback
import uuid
from typing import Any, AsyncIterator
from collections.abc import AsyncIterator
from typing import Any
import httpx
from fastapi import APIRouter, Body, HTTPException, Request
@@ -65,10 +66,9 @@ from langgraph.checkpoint.base import empty_checkpoint
from app.gateway.roundtable_diag import record_foreground_diag
from app.gateway.roundtable_model_fallback import fallback_model_chain, is_llm_error_message, reason_text
from app.gateway.roundtable_run_policy import merge_skill_stop_names, roundtable_run_policy
from deerflow.agents.roundtable_orchestrator.extraction_spec import build_summary_directive
from app.gateway.roundtable_seat_skills import append_seat_skill_directive
from app.gateway.routers._roundtable_seed import (
ACTION_PLAN_AGENT_ID,
COORDINATOR_AGENT_ID,
DASHBOARD_AGENT_ID,
REPORT_AGENT_ID,
@@ -76,6 +76,7 @@ from app.gateway.routers._roundtable_seed import (
SUMMARY_AGENT_ID,
ensure_roundtable_functional_agents,
)
from deerflow.agents.roundtable_orchestrator.extraction_spec import build_summary_directive
from deerflow.config import get_app_config
from deerflow.runtime.user_context import get_effective_user_id
from deerflow.tools.builtins.clarification_utils import resolve_allow_multiple
@@ -95,6 +96,8 @@ def _stage_for_agent(agent_type: str, agent_name: str) -> str:
return "step3_report"
if agent_name == SUMMARY_AGENT_ID:
return "step3_summary"
if agent_name == ACTION_PLAN_AGENT_ID:
return "position_action_plan"
if agent_name == DASHBOARD_AGENT_ID:
return "step3_dashboard"
if agent_name == STRUCTURE_AGENT_ID:
@@ -995,6 +998,32 @@ async def init_summary_thread(request: Request) -> dict[str, str]:
return {"agent_name": SUMMARY_AGENT_ID, "thread_id": thread_id}
@router.post("/position-action-plan/init")
async def init_position_action_plan_thread(request: Request) -> dict[str, str]:
"""Create the reusable thread for the position-roundtable action planner.
The planner is a built-in singleton agent just like ``roundtable-summary``;
only its thread is per session. The position workspace persists this id
after the first successful run so follow-up revisions retain the original
plan context.
"""
try:
ensure_roundtable_functional_agents()
thread_id = await _create_thread_direct(request, metadata=_ROUNDTABLE_THREAD_METADATA)
except Exception as exc:
await record_foreground_diag(
request,
stage="position_action_plan",
level="error",
event="thread_init_failed",
message=f"创建岗位行动规划线程失败:{exc}",
detail={"type": type(exc).__name__, "error": str(exc)},
agent_id=ACTION_PLAN_AGENT_ID,
)
raise
return {"agent_name": ACTION_PLAN_AGENT_ID, "thread_id": thread_id}
@router.post("/dashboard/init")
async def init_dashboard_thread(request: Request) -> dict[str, str]:
"""为 Step 3「大屏多页」创建一个供大屏多页数据智能体(``roundtable-dashboard``)
@@ -1806,6 +1835,8 @@ async def _special_run(
role = "report"
elif agent_name == SUMMARY_AGENT_ID:
role = "summary"
elif agent_name == ACTION_PLAN_AGENT_ID:
role = "action_plan"
elif agent_name == DASHBOARD_AGENT_ID:
# 大屏多页数据智能体:纯「研讨成果 → report-json」提炼,禁用一切工具。
role = "dashboard"