Skip to main content

Dify chatbot

This guide shows you how to enable voice interactions with your Dify applications in TEN Agent. By connecting speech recognition and synthesis to your Dify chatbot, users can have natural voice conversations with applications built on the Dify platform.

Prerequisites

Before starting, ensure you have:

  • TEN Agent playground running. See the Agent quickstart.

  • API keys for your voice services:

  • Dify API Key for your application from your Dify workspace.

    You can use any application created on the Dify platform, including agents or chat assistants. Each application has its own unique API key in the Dify dashboard.

Set up your Dify bot with voice

Connect your Dify application to voice capabilities:

  1. Open the playground at http://localhost:3000

  2. Select the voice_assistant graph type

  3. Configure modules:

    1. Click Module Picker
    2. Select your preferred STT and TTS modules
    3. For the LLM module, select Dify Chat Bot
    4. Click Save Changes
  4. Configure Dify properties:

    1. Click the settings button next to the graph selector
    2. Enter your Dify API Key
    3. Click Save Changes
  5. Start your voice-enabled application:

    1. Click Connect to initialize the agent
    2. Wait a few seconds for startup
    3. Begin speaking to your Dify application

Azure STT integration

For Azure speech recognition:

  1. Select the voice_assistant_integrated_stt graph type
  2. Configure Azure credentials in the RTC module
  3. Follow the remaining configuration steps above

Troubleshooting

Common issues and solutions:

IssueSolution
No response from Dify
  • Verify your Dify API Key is correct
  • Check that your Dify application has a valid model configured
  • Ensure the application is published in Dify
Knowledge retrieval issues
  • Verify datasets are properly uploaded and indexed in Dify
  • Check retrieval settings in your Dify application
  • Test the application directly in Dify to isolate the issue
Audio problems
  • Confirm STT and TTS modules are properly configured
  • Verify Agora credentials in your .env file
  • Check browser microphone permissions
Application behavior
  • Adjust application settings in Dify dashboard
  • Modify prompts and context in Dify
  • Update datasets or tools as needed