This commit is contained in:
Timothy Jaeryang Baek 2026-11-01 19:33:45 +09:00
parent ee8b69e718
commit e5a2e6438e
2 changed files with 11 additions and 2 deletions

View file

@ -493,7 +493,15 @@ async def realtime_call(ws: WebSocket):
if event == {'type': 'bridge.ping'}:
await ws.send_json({'type': 'bridge.pong'})
continue
command = protocol.command(event)
try:
command = protocol.command(event)
except (ValueError, TypeError):
if not isinstance(event, dict) or event.get('type') != 'conversation.item.truncate':
raise
await ws.send_json(
{'type': 'bridge.error', 'message': 'Invalid audio truncation request', 'fatal': False}
)
continue
if event['type'] == 'bridge.result':
protocol.requested.add(f'result:{event["call_id"]}')
for item in command if isinstance(command, list) else [command]:

View file

@ -334,7 +334,8 @@ export class RealtimeCall {
private event(event: any) {
const type = event.type;
if (type === 'bridge.error') {
this.fail(event.message);
if (event.fatal === false) this.options.error(event.message);
else this.fail(event.message);
return;
}
if (type === 'bridge.pong') {