feat(nodes): add background investigation node

Change-Id: I96e08e22fc7c52647edbf9be4f385a8fae9b449a
This commit is contained in:
Zhao Longjie
2025-04-27 20:15:42 +08:00
parent ada5e34eeb
commit 899438eca0
7 changed files with 90 additions and 8 deletions

View File

@@ -63,6 +63,7 @@ async def chat_stream(request: ChatRequest):
request.auto_accepted_plan,
request.interrupt_feedback,
request.mcp_settings,
request.enable_background_investigation,
),
media_type="text/event-stream",
)
@@ -76,6 +77,7 @@ async def _astream_workflow_generator(
auto_accepted_plan: bool,
interrupt_feedback: str,
mcp_settings: dict,
enable_background_investigation,
):
input_ = {
"messages": messages,
@@ -84,12 +86,13 @@ async def _astream_workflow_generator(
"current_plan": None,
"observations": [],
"auto_accepted_plan": auto_accepted_plan,
"enable_background_investigation": enable_background_investigation,
}
if not auto_accepted_plan and interrupt_feedback:
resume_msg = f"[{interrupt_feedback}]"
# add the last message to the resume message
if messages:
resume_msg += f" {messages[-1]["content"]}"
resume_msg += f" {messages[-1]['content']}"
input_ = Command(resume=resume_msg)
async for agent, _, event_data in graph.astream(
input_,

View File

@@ -47,6 +47,9 @@ class ChatRequest(BaseModel):
mcp_settings: Optional[dict] = Field(
None, description="MCP settings for the chat request"
)
enable_background_investigation: Optional[bool] = Field(
True, description="Whether to get background investigation before plan"
)
class TTSRequest(BaseModel):