RealtimeSession: persist user/assistant transcripts; emit assistant_done

This commit is contained in:
2026-06-11 21:35:40 +00:00
parent 24b8acdf60
commit b078f9aa78
2 changed files with 78 additions and 0 deletions
+18
View File
@@ -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;
}
}
}