PaoloG
12/03/2024, 11:21 AMclient.updateSession({
modalities: isEnabled ? ['text'] : ['text', 'audio'],
input_audio_transcription: isEnabled ? null : { model: 'whisper-1' },
turn_detection: isEnabled ? null : turnDetectionType === 'server_vad' ? { type: 'server_vad' } : null,
input_audio_format: isEnabled ? undefined : 'pcm16',
output_audio_format: isEnabled ? undefined : 'pcm16',
voice: isEnabled ? undefined : 'alloy',
});
Vapi
12/03/2024, 11:24 AMjavascript
vapi.on("message", (msg) => {
if (msg.type === "audio") {
// Ignore audio messages
return;
}
if (msg.type === "transcript") {
// Handle text transcript messages
// Update your chat interface with the text response
}
// Handle other message types as needed
});
By doing this, you can effectively create a chat-only interface without modifying the VAPI agent's behavior. The audio is still generated but not utilized in your chat interface. If you're looking for a more efficient solution that prevents audio generation altogether, please ask support for more info on this.Vapi
12/03/2024, 11:24 AMPaoloG
12/03/2024, 11:35 AMVapi
12/03/2024, 11:35 AMShubham Bajaj
12/05/2024, 5:45 PM