mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-15 09:31:21 +00:00
refac
This commit is contained in:
parent
ee8b69e718
commit
e5a2e6438e
2 changed files with 11 additions and 2 deletions
|
|
@ -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]:
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue