interstellar_ai/app/backend/voice_backend.ts

22 lines
661 B
TypeScript
Raw Normal View History

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...");
2024-09-26 09:28:18 +02:00
const dataSend = { audio:audio_data, option:"offline", recognition_type: "basic" }
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;