voice recorder (WIP)
This commit is contained in:
parent
2c72090de4
commit
16177ccacc
2 changed files with 74 additions and 2 deletions
28
app/backend/voice_backend.ts
Normal file
28
app/backend/voice_backend.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
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;
|
Loading…
Add table
Add a link
Reference in a new issue