Discussions

Ask a Question
Back to All

more tutorials on chat.d-id

I was following the stream code example to create a chatbot that I can talk to, similar with chat.d-id. How to I replace the mp3 audio input with real time text-to-speech of chatgpt's response? The code example gives a static mp3 audio input.

const talkResponse = await fetch(`${DID_API.url}/talks/streams/${streamId}`,
      {
        method: 'POST',
        headers: { Authorization: `Basic ${DID_API.key}`, 'Content-Type': 'application/json' },
        body: JSON.stringify({
          'script': {
            'type': 'audio',
            'audio_url': 'https://d-id-public-bucket.s3.us-west-2.amazonaws.com/webrtc.mp3',
          },
          'driver_url': 'bank://lively/',
          'config': {
            'stitch': true,
          },
          'session_id': sessionId
        })
      }