Skip to content

Commit c0c4ecc

Browse files
author
Guiners
committed
adding samples, test, lints
1 parent 88cc52f commit c0c4ecc

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

genai/live/live-conversation-audio-with-audio.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,33 +83,34 @@ async function generateContent(
8383
async function handleTurn() {
8484
const audioFrames = [];
8585
let done = false;
86-
86+
//todo
8787
while (!done) {
8888
const message = await waitMessage();
8989
const sc = message.serverContent;
9090

91-
if (sc.inputTranscription) {
91+
if (sc?.inputTranscription) {
9292
console.log('Input transcription', sc.inputTranscription);
9393
}
94-
if (sc.outputTranscription) {
94+
if (sc?.outputTranscription) {
9595
console.log('Output transcription', sc.outputTranscription);
9696
}
97-
if (sc.modelTurn.parts) {
97+
if (sc?.modelTurn?.parts) {
9898
for (const part of sc.modelTurn.parts) {
99-
if (part.inlineData.data) {
99+
if (part.inlineData?.data) {
100100
const audioData = Buffer.from(part.inlineData.data, 'base64');
101101
audioFrames.push(audioData);
102102
}
103103
}
104104
}
105-
if (sc.turnComplete) {
105+
if (sc?.turnComplete) {
106106
done = true;
107107
}
108108
}
109109

110110
return audioFrames;
111111
}
112112

113+
113114
const session = await client.live.connect({
114115
model: MODEL,
115116
config: {

0 commit comments

Comments
 (0)