forked from React-Group/interstellar_ai
28 lines
No EOL
708 B
TypeScript
28 lines
No EOL
708 B
TypeScript
import axios from "axios";
|
|
|
|
class VoiceSend {
|
|
|
|
voiceDataTemplate = {
|
|
type: "basic",
|
|
audio_data: null,
|
|
option: "offline"
|
|
}
|
|
|
|
sendToVoiceRecognition(audio_data: Blob, data: any) {
|
|
var dataSend = data
|
|
dataSend['audio_data'] = audio_data
|
|
axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", dataSend)
|
|
.then((response: any) => {
|
|
console.log(response['response'])
|
|
return response['response']
|
|
})
|
|
.catch(error => {
|
|
console.log("Error calling API:", error)
|
|
postMessage({ status: 500 })
|
|
})
|
|
}
|
|
|
|
}
|
|
|
|
|
|
export default VoiceSend; |