Skip to content

Commit

Permalink
Add backward compatible for #1426 (#1493)
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin authored Dec 6, 2024
2 parents 0b4220b + f85c46f commit 57e18d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions backend/routers/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ async def receive_audio_bytes():

# Transcript
if header_type == 100:
segments = json.loads(bytes(data[4:]).decode("utf-8"))
asyncio.run_coroutine_threadsafe(trigger_realtime_integrations(uid, segments, None), loop)
asyncio.run_coroutine_threadsafe(realtime_transcript_webhook(uid, segments), loop)
continue
if header_type == 102:
res = json.loads(bytes(data[4:]).decode("utf-8"))
segments = res.get('segments')
memory_id = res.get('memory_id')
Expand Down
4 changes: 2 additions & 2 deletions backend/routers/transcribe_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ async def transcript_consume():
await asyncio.sleep(1)
if transcript_ws and len(segment_buffers) > 0:
try:
# 100|data
# 102|data
data = bytearray()
data.extend(struct.pack("I", 100))
data.extend(struct.pack("I", 102))
data.extend(bytes(json.dumps({"segments":segment_buffers,"memory_id":in_progress_memory_id}), "utf-8"))
segment_buffers = [] # reset
await transcript_ws.send(data)
Expand Down

0 comments on commit 57e18d8

Please sign in to comment.