interstellar_ai/app/backend/voice_backend.ts

28 lines
708 B
TypeScript
Raw Normal View History

2024-09-25 12:33:52 +02:00
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;