http Logs
This commit is contained in:
parent
e72b03f5dc
commit
adfaff4277
2
.env
2
.env
@ -7,4 +7,4 @@ TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu
|
||||
TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu
|
||||
WS_URL=ws://localhost:8081
|
||||
SERVER_PORT_WS=8081
|
||||
SERVER_PORT_HTTP=8080
|
||||
SERVER_PORT_HTTP=3005
|
13
.vscode/launch.json
vendored
13
.vscode/launch.json
vendored
@ -25,7 +25,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Docker Python Launch with venv",
|
||||
"type": "python",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/agent-py-bot/agent.py",
|
||||
"console": "integratedTerminal",
|
||||
@ -33,7 +33,16 @@
|
||||
"env": {
|
||||
"PYTHONUNBUFFERED": "1"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "node: Launch server.js",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"program": "conda activate node && node web/server.js",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
]
|
||||
|
||||
}
|
||||
]
|
||||
}
|
@ -11,7 +11,7 @@ process.env.TTS_BACKEND_URL = "https://tts.d-popov.com/asr"
|
||||
const LLM_ENDPOINT = "https://ws.ai.d-popov.com/api/chat";
|
||||
// const LLM_ENDPOINT = "http://192.168.0.11:11434/api/chat";
|
||||
|
||||
const LOG_ENDPOINT = "ws://192.168.0.11:9999";
|
||||
const LOG_ENDPOINT = "ws://192.168.0.11:3005/log";
|
||||
|
||||
class VoiceHandler extends Component {
|
||||
constructor(props) {
|
||||
@ -30,6 +30,8 @@ class VoiceHandler extends Component {
|
||||
Voice.onSpeechResults = this.onSpeechResults.bind(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
componentWillUnmount() {
|
||||
Voice.destroy().then(Voice.removeAllListeners);
|
||||
}
|
||||
@ -53,7 +55,26 @@ class VoiceHandler extends Component {
|
||||
recognized: [...recognized, e.value],
|
||||
status: this.state.status+ "\nonSpeechResults():" + e.value
|
||||
});
|
||||
console.log("onSpeechResults():" + e.value);
|
||||
|
||||
this.logRemote("onSpeechResults():" + e.value);
|
||||
}
|
||||
|
||||
|
||||
async logRemote(message){
|
||||
try{
|
||||
fetch(LOG_ENDPOINT, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({"message":message}),
|
||||
});
|
||||
|
||||
}
|
||||
catch(e){
|
||||
console.log("error logging:" + e);
|
||||
}
|
||||
console.log( message );
|
||||
}
|
||||
|
||||
async _startRecognizing(e) {
|
||||
@ -103,7 +124,7 @@ class VoiceHandler extends Component {
|
||||
})
|
||||
|
||||
try {
|
||||
console.log('sending text to LLM at ', LLM_ENDPOINT, ": '", transcribedText, "'");
|
||||
this.logRemote('sending text to LLM at ', LLM_ENDPOINT, ": '", transcribedText, "'");
|
||||
const response = await fetch(LLM_ENDPOINT, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@ -142,6 +163,7 @@ class VoiceHandler extends Component {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_sendAudioToBackend(results) {
|
||||
// Placeholder: Convert `results` or actual audio data to a format acceptable by your backend
|
||||
const formData = new FormData();
|
||||
|
Loading…
x
Reference in New Issue
Block a user