feat(vela): mock push-to-talk transcript updates
This commit is contained in:
@@ -14,6 +14,22 @@ const WEBSOCKET_GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11';
|
||||
const MOCKED_USER_TRANSCRIPT = '[mocked user] What is the current mocked vertical slice?';
|
||||
const MOCKED_ASSISTANT_RESPONSE = '[mocked assistant] This is a deterministic mocked response from the gateway vertical slice.';
|
||||
|
||||
function createPlaceholderPartialTranscript(audioChunkCount) {
|
||||
return audioChunkCount === 1
|
||||
? '[mocked partial] Placeholder push-to-talk transcript in progress.'
|
||||
: `[mocked partial] Placeholder push-to-talk transcript in progress (${audioChunkCount} chunks).`;
|
||||
}
|
||||
|
||||
function createPlaceholderFinalTranscript(audioChunkCount) {
|
||||
if (audioChunkCount === 0) {
|
||||
return '[mocked final] Placeholder push-to-talk transcript completed without appended audio.';
|
||||
}
|
||||
|
||||
return audioChunkCount === 1
|
||||
? '[mocked final] Placeholder push-to-talk transcript completed from 1 appended chunk.'
|
||||
: `[mocked final] Placeholder push-to-talk transcript completed from ${audioChunkCount} appended chunks.`;
|
||||
}
|
||||
|
||||
function createSessionRecord() {
|
||||
return {
|
||||
id: crypto.randomUUID(),
|
||||
@@ -238,6 +254,9 @@ function handleClientMessage(socket, session, rawMessage) {
|
||||
|
||||
session.audioChunkCount += 1;
|
||||
updateSessionState(socket, session, 'listening');
|
||||
sendSocketMessage(socket, 'transcript.partial', {
|
||||
text: createPlaceholderPartialTranscript(session.audioChunkCount)
|
||||
});
|
||||
break;
|
||||
case 'input_audio.commit':
|
||||
if (session.mockedTurnInFlight) {
|
||||
@@ -245,6 +264,9 @@ function handleClientMessage(socket, session, rawMessage) {
|
||||
break;
|
||||
}
|
||||
|
||||
sendSocketMessage(socket, 'transcript.final', {
|
||||
text: createPlaceholderFinalTranscript(session.audioChunkCount)
|
||||
});
|
||||
session.audioChunkCount = 0;
|
||||
updateSessionState(socket, session, 'idle');
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user