Skip to content

QuecPython/AIChatBot-Volcengine-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QuecPython AI Chat

Table of Contents

Introduction

QuecPython has launched an AI chat solution based on Doubao Websocket. This solution implements voice dialogue based on Volcengine Websocket interface.

The module models that support this feature are as follows:

Series Model
EC800M EC800MCN_LE

Features

  • Supports voice question and answer (one question one answer).

  • Supports independent ASR (Automatic Speech Recognition).

  • Supports independent TTS (Text-to-Speech) playback.

  • Supports independent large language model.

  • Written in Python language, facilitating secondary development.

Quick Start

Prerequisites

Before you begin, please ensure you have the following prerequisites:

Installation

  1. Clone the repository:

    git clone https://github.com/QuecPython/AIChatBot-Volcengine-websocket.git
    cd AIChatBot-Volcengine-websocket
  2. Install USB driver

  3. Flash firmware: Flash the firmware to the development board according to the instructions.

Before use, please update Volcengine token and other parameters through the tiktok.config interface first.

Running the Application

  1. Connect the hardware: Connect the hardware according to the following diagram:

1. Connect the speaker to the pin headers marked `SPK+` and `SPK-` in the diagram.
2. Insert an available Nano SIM card in the position shown.
3. Connect the antenna to the antenna connector marked `LTE`.
4. Use a Type-C data cable to connect the development board and the computer.
  1. Download code to the device:

    • Launch the QPYcom debugging tool.

    • Connect the data cable to the computer.

    • Press the PWRKEY button on the development board to start the device.

    • Import all files in the code folder into the module file system according to the instructions, preserving the directory structure.

Note: If you need to improve the microphone sensitivity and avoid speech recognition errors, please import the audio_gain.nvm and audio_ve.nvm files under the nvm folder into the /usr directory of the module file system.

  1. Run the application:

    • Update parameters through the TiktokWS.config method.

    • Select the File tab.

    • Select the tiktok_websocket_demo.py script.

    • Right-click and select Run or use the Run shortcut button to execute the script.

  2. Reference runtime logs:

>>>from usr.tiktokws import TiktokWS
>>>tiktok=TiktokWS()
>>>tiktok.config(ModelId='ep-20250108223254-x4r5r')
True
# Select tiktok_websocket_demo.py script and right-click to run
>>>example.exec('/usr/tiktok_websocket_demo.py')
ai start success...
please press KEY S2 to start
# Press and hold KEY S2 to start speaking
>>> please speak to ai.
# Release KEY S2 to stop speaking, then the speaker plays the response audio
speak over and wait ai response.

Directory Structure

solution-AI/
├── code/
│   ├── ark_lib.py
│   ├── asr_lib.py
│   ├── logging.py
│   ├── ...
│   └── uwebsocket.py
├── media/
│   └── wire_connection.jpg
├── fw/
│   └── EC800MCNLER06A01M08_OCPU_QPY_TEST0228.zip
├── LICENSE
└── readme.md

Contributing

We welcome contributions to improve this project! Please follow these steps to contribute:

  1. Fork this repository.

  2. Create a new branch (git checkout -b feature/your-feature).

  3. Commit your changes (git commit -m 'Add your feature').

  4. Push to the branch (git push origin feature/your-feature).

  5. Open a Pull Request.

License

This project uses the Apache license. See the LICENSE file for details.

Support

If you have any questions or need support, please refer to the QuecPython Documentation or open an issue in this repository.

About

An AI chat bot based on volcengine's websocket protocol.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages