Merge remote-tracking branch 'origin/feat/support-agent-sandbox' into feat/support-agent-sandbox

This commit is contained in:
zhsama
2026-01-20 17:07:30 +08:00
2 changed files with 14 additions and 1 deletions

View File

@ -138,7 +138,14 @@ class StreamEventBuffer:
self._current_reasoning += text self._current_reasoning += text
self._last_event_type = "thought" self._last_event_type = "thought"
def record_tool_call(self, tool_call_id: str, tool_name: str, tool_arguments: str) -> None: def record_tool_call(
self,
tool_call_id: str,
tool_name: str,
tool_arguments: str,
tool_icon: str | dict | None = None,
tool_icon_dark: str | dict | None = None,
) -> None:
"""Record a tool call event.""" """Record a tool call event."""
if not tool_call_id: if not tool_call_id:
return return
@ -161,6 +168,8 @@ class StreamEventBuffer:
"arguments": tool_arguments or "", "arguments": tool_arguments or "",
"result": "", "result": "",
"elapsed_time": None, "elapsed_time": None,
"icon": tool_icon,
"icon_dark": tool_icon_dark,
} }
self.tool_calls.append(tool_call) self.tool_calls.append(tool_call)
idx = len(self.tool_calls) - 1 idx = len(self.tool_calls) - 1
@ -542,6 +551,8 @@ class AdvancedChatAppGenerateTaskPipeline(GraphRuntimeStateSupport):
tool_call_id=tool_call_id, tool_call_id=tool_call_id,
tool_name=tool_name, tool_name=tool_name,
tool_arguments=tool_arguments, tool_arguments=tool_arguments,
tool_icon=tool_icon,
tool_icon_dark=tool_icon_dark,
) )
case ChunkType.TOOL_RESULT: case ChunkType.TOOL_RESULT:
self._stream_buffer.record_tool_result( self._stream_buffer.record_tool_result(

View File

@ -43,6 +43,8 @@ class ToolCallDetail(BaseModel):
arguments: str = Field(default="", description="JSON string of tool arguments") arguments: str = Field(default="", description="JSON string of tool arguments")
result: str = Field(default="", description="Result from the tool execution") result: str = Field(default="", description="Result from the tool execution")
elapsed_time: float | None = Field(default=None, description="Elapsed time in seconds") elapsed_time: float | None = Field(default=None, description="Elapsed time in seconds")
icon: str | dict | None = Field(default=None, description="Icon of the tool")
icon_dark: str | dict | None = Field(default=None, description="Dark theme icon of the tool")
class LLMGenerationDetailData(BaseModel): class LLMGenerationDetailData(BaseModel):