RealtimeSession: persist user/assistant transcripts; emit assistant_done
This commit is contained in:
@@ -121,6 +121,24 @@ public class RealtimeSession
|
||||
case "response.audio.delta":
|
||||
await ForwardAudioDeltaAsync(evt, ct);
|
||||
break;
|
||||
case "conversation.item.input_audio_transcription.completed":
|
||||
{
|
||||
var text = (string?)evt["transcript"];
|
||||
if (_conversation is not null && !string.IsNullOrEmpty(text))
|
||||
await _log.AppendUserAsync(_conversation.Id, text!, ct);
|
||||
break;
|
||||
}
|
||||
case "response.audio_transcript.done":
|
||||
{
|
||||
var text = (string?)evt["transcript"];
|
||||
if (_conversation is not null && !string.IsNullOrEmpty(text))
|
||||
await _log.AppendAssistantAsync(_conversation.Id, text!, ct);
|
||||
break;
|
||||
}
|
||||
case "response.done":
|
||||
await _output.WriteEnvelopeAsync(
|
||||
new JsonObject { ["type"] = "assistant_done" }, ct);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user