Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/uipath/runtime/chat/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from uipath.core.chat import (
UiPathConversationMessageEvent,
)
from uipath.core.triggers import UiPathResumeTrigger


class UiPathChatProtocol(Protocol):
Expand All @@ -32,17 +31,6 @@ async def emit_message_event(
"""
...

async def emit_interrupt_event(
self,
resume_trigger: UiPathResumeTrigger,
) -> None:
"""Wrap and send an interrupt event.

Args:
resume_trigger: UiPathResumeTrigger to wrap and send
"""
...

async def emit_exchange_end_event(self) -> None:
"""Send an exchange end event."""
...
Expand All @@ -52,5 +40,5 @@ async def emit_exchange_error_event(self, error: Exception) -> None:
...

async def wait_for_resume(self) -> dict[str, Any]:
"""Wait for the interrupt_end event to be received."""
"""Wait for a confirmToolCall event to be received."""
...
2 changes: 0 additions & 2 deletions src/uipath/runtime/chat/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ async def stream(
resume_map: dict[str, Any] = {}

for trigger in api_triggers:
await self.chat_bridge.emit_interrupt_event(trigger)

resume_data = (
await self.chat_bridge.wait_for_resume()
)
Expand Down
17 changes: 0 additions & 17 deletions tests/test_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def make_chat_bridge_mock() -> UiPathChatProtocol:
bridge_mock.connect = AsyncMock()
bridge_mock.disconnect = AsyncMock()
bridge_mock.emit_message_event = AsyncMock()
bridge_mock.emit_interrupt_event = AsyncMock()
bridge_mock.wait_for_resume = AsyncMock()

return cast(UiPathChatProtocol, bridge_mock)
Expand Down Expand Up @@ -331,7 +330,6 @@ async def test_chat_runtime_handles_api_trigger_suspension():
cast(AsyncMock, bridge.connect).assert_awaited_once()
cast(AsyncMock, bridge.disconnect).assert_awaited_once()

cast(AsyncMock, bridge.emit_interrupt_event).assert_awaited_once()
cast(AsyncMock, bridge.wait_for_resume).assert_awaited_once()

# Message events emitted (one before suspend, one after resume)
Expand Down Expand Up @@ -563,15 +561,8 @@ async def test_chat_runtime_handles_multiple_api_triggers():
assert resume_input["api-call"] == {"approved": True}

# Bridge should have been called 3 times (once per trigger)
assert cast(AsyncMock, bridge.emit_interrupt_event).await_count == 3
assert cast(AsyncMock, bridge.wait_for_resume).await_count == 3

# Verify each emit_interrupt_event received a trigger
emit_calls = cast(AsyncMock, bridge.emit_interrupt_event).await_args_list
assert emit_calls[0][0][0].interrupt_id == "email-confirm"
assert emit_calls[1][0][0].interrupt_id == "file-delete"
assert emit_calls[2][0][0].interrupt_id == "api-call"


@pytest.mark.asyncio
async def test_chat_runtime_filters_non_api_triggers():
Expand Down Expand Up @@ -603,12 +594,4 @@ async def test_chat_runtime_filters_non_api_triggers():
assert result.triggers[0].trigger_type == UiPathResumeTriggerType.QUEUE_ITEM

# Bridge should have been called only 2 times (for 2 API triggers)
assert cast(AsyncMock, bridge.emit_interrupt_event).await_count == 2
assert cast(AsyncMock, bridge.wait_for_resume).await_count == 2

# Verify only API triggers were emitted
emit_calls = cast(AsyncMock, bridge.emit_interrupt_event).await_args_list
assert emit_calls[0][0][0].interrupt_id == "email-confirm"
assert emit_calls[0][0][0].trigger_type == UiPathResumeTriggerType.API
assert emit_calls[1][0][0].interrupt_id == "file-delete"
assert emit_calls[1][0][0].trigger_type == UiPathResumeTriggerType.API
Loading