diff --git a/src/components/configurator/VoiceAgentProvider.tsx b/src/components/configurator/VoiceAgentProvider.tsx index a72462b..5ff35f9 100644 --- a/src/components/configurator/VoiceAgentProvider.tsx +++ b/src/components/configurator/VoiceAgentProvider.tsx @@ -27,6 +27,7 @@ interface VoiceAgentContextValue { endConversation: () => void; completedBrief: string | null; completedFormData: WizardFormData | null; + debugLog: string[]; } // ─── Context ───────────────────────────────────────────────────────────────── @@ -289,13 +290,14 @@ export default function VoiceAgentProvider({ locale, children }: VoiceAgentProvi }, 10_000); ws.onopen = () => { - console.log('[VoiceAgent] WebSocket opened, sending config...'); - // Send setup message — must use "config" key per Gemini Live API spec + console.log('[VoiceAgent] WebSocket opened, sending setup...'); ws.send(JSON.stringify({ - config: { + setup: { model: `models/${model}`, - responseModalities: config.responseModalities, - speechConfig: config.speechConfig, + generationConfig: { + responseModalities: config.responseModalities, + speechConfig: config.speechConfig, + }, systemInstruction: { parts: [{ text: config.systemInstruction }], }, @@ -320,7 +322,13 @@ export default function VoiceAgentProvider({ locale, children }: VoiceAgentProvi }; ws.onmessage = async (event) => { - const msg = JSON.parse(event.data as string); + let raw: string; + if (event.data instanceof Blob) { + raw = await event.data.text(); + } else { + raw = event.data as string; + } + const msg = JSON.parse(raw); console.log('[VoiceAgent] Message:', JSON.stringify(msg).slice(0, 200)); // Setup complete — Gemini sends back a setupComplete message