mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(copilot): emit StreamLongRunningStart event in SDK path
Add logic to detect long-running tools in the SDK execution path and emit StreamLongRunningStart event to trigger UI feedback display. Changes: - Import StreamLongRunningStart and get_tool - Check if tool has is_long_running=True when StreamToolInputAvailable is received - Yield StreamLongRunningStart event to notify frontend This ensures the mini-game UI displays for long-running tools like create_agent when using the SDK execution path.
This commit is contained in:
@@ -25,12 +25,14 @@ from ..response_model import (
|
||||
StreamFinish,
|
||||
StreamFinishStep,
|
||||
StreamHeartbeat,
|
||||
StreamLongRunningStart,
|
||||
StreamStart,
|
||||
StreamTextDelta,
|
||||
StreamToolInputAvailable,
|
||||
StreamToolOutputAvailable,
|
||||
)
|
||||
from ..service import _build_system_prompt, _generate_session_title
|
||||
from ..tools import get_tool
|
||||
from ..tools.sandbox import WORKSPACE_PREFIX, make_session_path
|
||||
from ..tracking import track_user_message
|
||||
from .response_adapter import SDKResponseAdapter
|
||||
@@ -731,6 +733,15 @@ async def stream_chat_completion_sdk(
|
||||
|
||||
yield response
|
||||
|
||||
# Emit long-running notification for tools with is_long_running=True
|
||||
if isinstance(response, StreamToolInputAvailable):
|
||||
tool = get_tool(response.toolName)
|
||||
if tool and tool.is_long_running:
|
||||
yield StreamLongRunningStart(
|
||||
toolCallId=response.toolCallId,
|
||||
toolName=response.toolName,
|
||||
)
|
||||
|
||||
if isinstance(response, StreamTextDelta):
|
||||
delta = response.delta or ""
|
||||
# After tool results, start a new assistant
|
||||
|
||||
Reference in New Issue
Block a user