ojin-client 0.1.7.dev0__tar.gz → 0.1.7.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/PKG-INFO +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/ojin_persona_client.py +13 -4
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/ojin_persona_messages.py +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin_client.egg-info/PKG-INFO +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/pyproject.toml +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/README.md +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/__init__.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/cacert.pem +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/entities/interaction_messages.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin/entities/session_messages.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin_client.egg-info/SOURCES.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin_client.egg-info/dependency_links.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin_client.egg-info/requires.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/ojin_client.egg-info/top_level.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev1}/setup.cfg +0 -0
|
@@ -86,6 +86,7 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
86
86
|
self._running = False
|
|
87
87
|
self._receive_task: Optional[asyncio.Task] = None
|
|
88
88
|
self._inference_server_ready: bool = False
|
|
89
|
+
self._cancelled: bool = False
|
|
89
90
|
|
|
90
91
|
async def connect(self) -> None:
|
|
91
92
|
"""Establish WebSocket connection and authenticate with the service."""
|
|
@@ -260,12 +261,16 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
260
261
|
cancel_input = CancelInteractionMessage(
|
|
261
262
|
payload=message.to_proxy_message()
|
|
262
263
|
)
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
self._cancelled = True
|
|
265
|
+
while not self._message_queue.empty():
|
|
266
|
+
try:
|
|
267
|
+
self._message_queue.get_nowait()
|
|
268
|
+
except asyncio.QueueEmpty:
|
|
269
|
+
break
|
|
266
270
|
|
|
267
271
|
await self._ws.send(cancel_input.model_dump_json())
|
|
268
272
|
|
|
273
|
+
self._cancelled = False
|
|
269
274
|
return
|
|
270
275
|
|
|
271
276
|
if isinstance(message, StartInteractionMessage):
|
|
@@ -314,6 +319,8 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
314
319
|
await self.close()
|
|
315
320
|
error = ErrorResponseMessage(
|
|
316
321
|
payload=ErrorResponse(
|
|
322
|
+
interaction_id="",
|
|
323
|
+
details={},
|
|
317
324
|
code="UNKNOWN",
|
|
318
325
|
message="The message is Unknown",
|
|
319
326
|
timestamp=int(time.monotonic() * 1000),
|
|
@@ -321,7 +328,7 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
321
328
|
)
|
|
322
329
|
raise Exception(error)
|
|
323
330
|
|
|
324
|
-
async def receive_message(self) -> BaseModel:
|
|
331
|
+
async def receive_message(self) -> BaseModel | None:
|
|
325
332
|
"""Receive the next message from the OJIN Persona service.
|
|
326
333
|
|
|
327
334
|
Returns:
|
|
@@ -331,6 +338,8 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
331
338
|
asyncio.QueueEmpty: If no messages are available
|
|
332
339
|
|
|
333
340
|
"""
|
|
341
|
+
if self._cancelled:
|
|
342
|
+
return None
|
|
334
343
|
return await self._message_queue.get()
|
|
335
344
|
|
|
336
345
|
def is_connected(self) -> bool:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|