47 lines
1.7 KiB
Plaintext
47 lines
1.7 KiB
Plaintext
sequenceDiagram
|
|
autonumber
|
|
participant U as Browser / AudioWorklet
|
|
participant A as FastAPI / Live lifecycle
|
|
participant R as VoiceRuntime
|
|
participant P as OpenAI Realtime
|
|
participant S as Backend search
|
|
U->>A: Create conversation + reserve voice session
|
|
A->>A: Auth / ownership / request dedup / freeze profile
|
|
A-->>U: Session ID + stream_path
|
|
U->>A: Open authenticated WebSocket
|
|
A->>A: Origin + cookie + pinned profile checks
|
|
A->>R: Start runtime + server-side adapter
|
|
R->>P: session.update
|
|
P-->>R: session.updated / acknowledged setup
|
|
R-->>U: session_ready
|
|
loop Each user turn
|
|
U->>R: PCM16LE mono 24kHz
|
|
R->>P: input_audio_buffer.append
|
|
P-->>R: VAD + input commit + transcription events
|
|
R->>P: response.create after authority / cleanup gates
|
|
opt Document question
|
|
P-->>R: Tool call
|
|
R->>S: Validate args + trusted scope + durable dedup
|
|
S-->>R: Revalidated evidence or normalized error
|
|
R->>P: Private tool result
|
|
P-->>R: report_used_sources
|
|
R-->>U: Validated used-source subset
|
|
end
|
|
P-->>R: Streaming audio / transcript / response.done
|
|
R-->>U: Bounded audio + application JSON events
|
|
U->>R: Playback progress / actual played position
|
|
opt User interrupts
|
|
P-->>R: speech_started
|
|
R-->>U: turn_interrupted; discard unheard audio
|
|
R->>P: response.cancel if generation is active
|
|
P-->>R: Terminal confirmation; correlated race allowed
|
|
U->>R: Final playback position
|
|
R->>P: conversation.item.truncate
|
|
P-->>R: Exact truncation acknowledgement
|
|
R->>R: Release next response only after cleanup
|
|
Note over R,S: Same-topic pending search survives speech interruption
|
|
end
|
|
end
|
|
U->>A: Explicit close
|
|
A->>R: Cancel tasks / release provider / persist outcome
|