andito HF Staff commited on
Commit
2c1477e
·
1 Parent(s): 2d6bb64

Trigger greeting after session creation

Browse files
Files changed (1) hide show
  1. ws/s2s-ws-client.js +6 -3
ws/s2s-ws-client.js CHANGED
@@ -629,13 +629,16 @@ export class S2sWsRealtimeClient extends EventTarget {
629
  // out). We only push the user-tunable bits: voice + instructions.
630
  this._sendSessionUpdate();
631
  this._sessionConfigured = true;
 
 
 
 
632
  if (this._status === "connecting") this._setStatus("connected");
633
  break;
634
 
635
  case "session.updated":
636
- // Wait for this acknowledgement so the real system instructions are in
637
- // place before the greeting request warms their prompt prefix.
638
- this._sendStartupGreeting();
639
  break;
640
 
641
  case "input_audio_buffer.speech_started":
 
629
  // out). We only push the user-tunable bits: voice + instructions.
630
  this._sendSessionUpdate();
631
  this._sessionConfigured = true;
632
+ // The s2s server does not echo session.updated. WebSocket messages are
633
+ // ordered, so this hidden item and response.create are handled only
634
+ // after the session.update sent immediately above.
635
+ this._sendStartupGreeting();
636
  if (this._status === "connecting") this._setStatus("connected");
637
  break;
638
 
639
  case "session.updated":
640
+ // Some Realtime servers acknowledge session.update; s2s currently does
641
+ // not. The greeting is already queued from session.created.
 
642
  break;
643
 
644
  case "input_audio_buffer.speech_started":