Skip to content
Open
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
2 changes: 1 addition & 1 deletion packages/uipath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.10.8"
version = "2.10.9"
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
47 changes: 47 additions & 0 deletions packages/uipath/src/uipath/_cli/_chat/_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from urllib.parse import urlparse

from uipath.core.chat import (
UiPathConversationErrorEvent,
UiPathConversationErrorStartEvent,
UiPathConversationEvent,
UiPathConversationExchangeEndEvent,
UiPathConversationExchangeEvent,
Expand Down Expand Up @@ -246,6 +248,51 @@ async def emit_exchange_end_event(self) -> None:
logger.error(f"Error sending conversation event to WebSocket: {e}")
raise RuntimeError(f"Failed to send conversation event: {e}") from e

async def emit_exchange_error_event(
self, error_id: str, message: str, details: Any | None = None
) -> None:
"""Send an exchange error event to signal an error to the UI.

Args:
error_id: Identifier for the error type
message: Human-readable error message
details: Optional additional error details
"""
if self._client is None:
raise RuntimeError("WebSocket client not connected. Call connect() first.")

if not self._connected_event.is_set() and not self._websocket_disabled:
raise RuntimeError("WebSocket client not in connected state")

try:
exchange_error_event = UiPathConversationEvent(
conversation_id=self.conversation_id,
exchange=UiPathConversationExchangeEvent(
exchange_id=self.exchange_id,
error=UiPathConversationErrorEvent(
error_id=error_id,
start=UiPathConversationErrorStartEvent(
message=message, details=details
),
),
),
)

event_data = exchange_error_event.model_dump(
mode="json", exclude_none=True, by_alias=True
)

if self._websocket_disabled:
logger.info(
f"SocketIOChatBridge is in debug mode. Not sending event: {json.dumps(event_data)}"
)
else:
await self._client.emit("ConversationEvent", event_data)

except Exception as e:
logger.error(f"Error sending exchange error event to WebSocket: {e}")
raise RuntimeError(f"Failed to send exchange error event: {e}") from e

async def emit_interrupt_event(self, resume_trigger: UiPathResumeTrigger):
if self._client and self._connected_event.is_set():
try:
Expand Down
8 changes: 4 additions & 4 deletions packages/uipath/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading