OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.43k stars 221 forks source link

I want to use other api to transcribe my voice,how can I extend the speechToText api? #55

Closed wysstartgo closed 10 months ago

wysstartgo commented 10 months ago

Is there any way to extend the speechToText api?

speechToText
Type: true | {
     webSpeech?: true | [WebSpeechOptions](https://deepchat.dev/docs/speech#WebSpeechOptions),
     [azure?: AzureOptions](https://deepchat.dev/docs/speech#AzureOptions),
     [textColor?: TextColor](https://deepchat.dev/docs/speech#TextColor),
     displayInterimResults?: boolean,
     translations?: {[key: string]: string},
     [commands?: Commands](https://deepchat.dev/docs/speech#Commands),
     [button?: ButtonStyles](https://deepchat.dev/docs/speech#ButtonStyles)
}

Default: {webSpeech: true}

Transcribe your voice into text and control chat with commands.
webSpeech utilises [Web Speech API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API/Using_the_Web_Speech_API) to transcribe your speech.
azure utilises [Azure Cognitive Speech Services API](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-to-text) to transcribe your speech.
textColor is used to set the color of interim and final results text.
displayInterimResults controls whether interim results are displayed.
translations is a case-sensitive one-to-one mapping of words that will automatically be translated to others.
commands is used to set the phrases that will trigger various chat functionality.
button defines the styling used for the microphone button.

I just want to use my self host api,is there any standard interface?

OvidijusParsiunas commented 10 months ago

Hi @wysstartgo. The speechToText property uses the Speech To Element library to facilitate its real-time transcription capabilities. We may extend that library in the future, but for now self-hosted speech capabilities are limited to Web Speech API and Azure Speech Services API.

If you want to implement this functionality yourself, you can fork/clone the project and edit the speechToText.ts file. Running this project is very easy and it is described in the Create your own Deep Chat component section of the README.md.

I will close this issue but if you have any further questions, let me know!

wysstartgo commented 10 months ago

okay,thanks!