ojin-client 0.1.7.dev0__tar.gz → 0.1.7.dev2__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.dev2}/PKG-INFO +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/ojin_persona_client.py +16 -4
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin_client.egg-info/PKG-INFO +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/pyproject.toml +1 -1
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/README.md +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/__init__.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/cacert.pem +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/entities/interaction_messages.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/entities/session_messages.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin/ojin_persona_messages.py +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin_client.egg-info/SOURCES.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin_client.egg-info/dependency_links.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin_client.egg-info/requires.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/ojin_client.egg-info/top_level.txt +0 -0
- {ojin_client-0.1.7.dev0 → ojin_client-0.1.7.dev2}/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 = True
|
|
89
90
|
|
|
90
91
|
async def connect(self) -> None:
|
|
91
92
|
"""Establish WebSocket connection and authenticate with the service."""
|
|
@@ -261,11 +262,19 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
261
262
|
payload=message.to_proxy_message()
|
|
262
263
|
)
|
|
263
264
|
|
|
264
|
-
if self._message_queue.empty():
|
|
265
|
-
self._message_queue = asyncio.Queue()
|
|
266
|
-
|
|
267
265
|
await self._ws.send(cancel_input.model_dump_json())
|
|
268
266
|
|
|
267
|
+
logger.info(f"Message sent {message.interaction_id}")
|
|
268
|
+
|
|
269
|
+
while not self._message_queue.empty():
|
|
270
|
+
try:
|
|
271
|
+
self._message_queue.get_nowait()
|
|
272
|
+
except asyncio.QueueEmpty:
|
|
273
|
+
break
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
self._cancelled = False
|
|
277
|
+
|
|
269
278
|
return
|
|
270
279
|
|
|
271
280
|
if isinstance(message, StartInteractionMessage):
|
|
@@ -281,6 +290,7 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
281
290
|
|
|
282
291
|
if isinstance(message, OjinPersonaInteractionInputMessage):
|
|
283
292
|
logger.info("InteractionMessage")
|
|
293
|
+
logger.info(f"Message sent {message.interaction_id}")
|
|
284
294
|
if not message.audio_int16_bytes:
|
|
285
295
|
raise ValueError("Audio cannot be empty")
|
|
286
296
|
|
|
@@ -321,7 +331,7 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
321
331
|
)
|
|
322
332
|
raise Exception(error)
|
|
323
333
|
|
|
324
|
-
async def receive_message(self) -> BaseModel:
|
|
334
|
+
async def receive_message(self) -> BaseModel | None:
|
|
325
335
|
"""Receive the next message from the OJIN Persona service.
|
|
326
336
|
|
|
327
337
|
Returns:
|
|
@@ -331,6 +341,8 @@ class OjinPersonaClient(IOjinPersonaClient):
|
|
|
331
341
|
asyncio.QueueEmpty: If no messages are available
|
|
332
342
|
|
|
333
343
|
"""
|
|
344
|
+
if self._cancelled:
|
|
345
|
+
return None
|
|
334
346
|
return await self._message_queue.get()
|
|
335
347
|
|
|
336
348
|
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
|
|
File without changes
|