ojin-client 0.1.7.dev1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ojin-client
3
- Version: 0.1.7.dev1
3
+ Version: 0.1.7.dev2
4
4
  Summary: Ojin platform services
5
5
  Author: Journee
6
6
  License: Apache-2.0
@@ -86,7 +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
+ self._cancelled = True
90
90
 
91
91
  async def connect(self) -> None:
92
92
  """Establish WebSocket connection and authenticate with the service."""
@@ -261,16 +261,20 @@ class OjinPersonaClient(IOjinPersonaClient):
261
261
  cancel_input = CancelInteractionMessage(
262
262
  payload=message.to_proxy_message()
263
263
  )
264
- self._cancelled = True
264
+
265
+ await self._ws.send(cancel_input.model_dump_json())
266
+
267
+ logger.info(f"Message sent {message.interaction_id}")
268
+
265
269
  while not self._message_queue.empty():
266
270
  try:
267
271
  self._message_queue.get_nowait()
268
272
  except asyncio.QueueEmpty:
269
273
  break
270
274
 
271
- await self._ws.send(cancel_input.model_dump_json())
272
275
 
273
276
  self._cancelled = False
277
+
274
278
  return
275
279
 
276
280
  if isinstance(message, StartInteractionMessage):
@@ -286,6 +290,7 @@ class OjinPersonaClient(IOjinPersonaClient):
286
290
 
287
291
  if isinstance(message, OjinPersonaInteractionInputMessage):
288
292
  logger.info("InteractionMessage")
293
+ logger.info(f"Message sent {message.interaction_id}")
289
294
  if not message.audio_int16_bytes:
290
295
  raise ValueError("Audio cannot be empty")
291
296
 
@@ -319,8 +324,6 @@ class OjinPersonaClient(IOjinPersonaClient):
319
324
  await self.close()
320
325
  error = ErrorResponseMessage(
321
326
  payload=ErrorResponse(
322
- interaction_id="",
323
- details={},
324
327
  code="UNKNOWN",
325
328
  message="The message is Unknown",
326
329
  timestamp=int(time.monotonic() * 1000),
@@ -210,7 +210,7 @@ class IOjinPersonaClient(ABC):
210
210
  """
211
211
 
212
212
  @abstractmethod
213
- async def receive_message(self) -> BaseModel | None:
213
+ async def receive_message(self) -> BaseModel:
214
214
  """Receive a message from the server.
215
215
 
216
216
  Returns:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ojin-client
3
- Version: 0.1.7.dev1
3
+ Version: 0.1.7.dev2
4
4
  Summary: Ojin platform services
5
5
  Author: Journee
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ojin-client"
3
- version = "0.1.7dev1"
3
+ version = "0.1.7dev2"
4
4
  description = "Ojin platform services"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"