[BugFix] Fix leftovers of the legacy OpenAI realtime API event names (#7426)
Signed-off-by: Nick Cao <ncao@redhat.com> Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
1 parent
78e1a0ae5c
commit
d3493384cf
10 files changed
+103
-48
No files matched your search
@@ -176,7 +176,7 @@ class RealtimeConnection(VllmRealtimeConnection):
|
||||
sent_audio = True
|
||||
await self.send_json(
|
||||
{
|
||||
"type": "response.audio.delta",
|
||||
"type": "response.output_audio.delta",
|
||||
"audio": self._pcm16_b64(chunk),
|
||||
"format": "pcm16",
|
||||
"sample_rate_hz": sample_rate,
|
||||
@@ -194,7 +194,7 @@ class RealtimeConnection(VllmRealtimeConnection):
|
||||
await self.send(TranscriptionDone(text=full_text, usage=usage))
|
||||
|
||||
if sent_audio:
|
||||
await self.send_json({"type": "response.audio.done", "has_audio": True})
|
||||
await self.send_json({"type": "response.output_audio.done", "has_audio": True})
|
||||
audio_done_sent = True
|
||||
except Exception as e:
|
||||
logger.exception("Error in generation: %s", e)
|
||||
@@ -213,9 +213,9 @@ class RealtimeConnection(VllmRealtimeConnection):
|
||||
# Always send terminal event so clients don't hang forever.
|
||||
if self._is_connected and not audio_done_sent:
|
||||
try:
|
||||
await self.send_json({"type": "response.audio.done", "has_audio": sent_audio})
|
||||
await self.send_json({"type": "response.output_audio.done", "has_audio": sent_audio})
|
||||
except Exception:
|
||||
logger.exception("Failed to send response.audio.done")
|
||||
logger.exception("Failed to send response.output_audio.done")
|
||||
while not self.audio_queue.empty():
|
||||
self.audio_queue.get_nowait()
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ Protocol:
|
||||
{"type": "response.start"}
|
||||
{"type": "response.text.delta", "delta": "..."}
|
||||
{"type": "response.text.done", "text": "..."}
|
||||
{"type": "response.audio.delta", "data": "...", "format": "wav"}
|
||||
{"type": "response.audio.done"}
|
||||
{"type": "response.output_audio.delta", "data": "...", "format": "wav"}
|
||||
{"type": "response.output_audio.done"}
|
||||
{"type": "session.done"}
|
||||
{"type": "error", "message": "..."}
|
||||
"""
|
||||
|
||||
@@ -21,8 +21,8 @@ Protocol:
|
||||
{"type": "response.start"}
|
||||
{"type": "response.text.delta", "delta": "..."}
|
||||
{"type": "response.text.done", "text": "..."}
|
||||
{"type": "response.audio.delta", "data": "...", "format": "wav"}
|
||||
{"type": "response.audio.done"}
|
||||
{"type": "response.output_audio.delta", "data": "...", "format": "wav"}
|
||||
{"type": "response.output_audio.done"}
|
||||
{"type": "session.done"}
|
||||
{"type": "error", "message": "..."}
|
||||
"""
|
||||
@@ -763,7 +763,7 @@ class OmniStreamingVideoHandler:
|
||||
if b64:
|
||||
await websocket.send_json(
|
||||
{
|
||||
"type": "response.audio.delta",
|
||||
"type": "response.output_audio.delta",
|
||||
"data": b64,
|
||||
"format": "wav",
|
||||
}
|
||||
@@ -807,7 +807,7 @@ class OmniStreamingVideoHandler:
|
||||
if b64:
|
||||
await websocket.send_json(
|
||||
{
|
||||
"type": "response.audio.delta",
|
||||
"type": "response.output_audio.delta",
|
||||
"data": b64,
|
||||
"format": "wav",
|
||||
}
|
||||
@@ -816,7 +816,7 @@ class OmniStreamingVideoHandler:
|
||||
logger.exception("Failed to coalesce off-path audio")
|
||||
|
||||
if audio_chunk_count > 0:
|
||||
await websocket.send_json({"type": "response.audio.done"})
|
||||
await websocket.send_json({"type": "response.output_audio.done"})
|
||||
|
||||
response_text = "".join(text_parts)
|
||||
self.on_turn_complete(message_history, user_message, response_text)
|
||||
|
||||
Reference in new issue
Block a user