2024-09-25 12:33:52 +02:00
|
|
|
import axios from "axios";
|
|
|
|
|
|
|
|
class VoiceSend {
|
2024-09-26 08:57:28 +02:00
|
|
|
sendToVoiceRecognition(audio_data: Blob) {
|
|
|
|
console.log("sending recording...");
|
|
|
|
|
|
|
|
const dataSend = { audio_data }
|
2024-09-25 12:33:52 +02:00
|
|
|
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;
|