diff --git a/agent-mobile/artimobile/VoiceHandler.js b/agent-mobile/artimobile/VoiceHandler.js index 82fe92d..0ab7efc 100644 --- a/agent-mobile/artimobile/VoiceHandler.js +++ b/agent-mobile/artimobile/VoiceHandler.js @@ -11,7 +11,7 @@ process.env.TTS_BACKEND_URL = "https://tts.d-popov.com/asr" process.env.LLM_ENDPOINT = "https://ws.ai.d-popov.com/api/chat"; // const LLM_ENDPOINT = "http://192.168.0.11:11434/api/chat"; -process.env.LOG_ENDPOINT = "http://192.168.0.11:3005/log"; +process.env.LOG_ENDPOINT = "https://dev.d-popov.com/log"; class VoiceHandler extends Component { constructor(props) { @@ -21,6 +21,7 @@ class VoiceHandler extends Component { recognized: '', started: '', results: [], + response:[], isRecording: false, isProcessing: false, }; @@ -47,12 +48,13 @@ class VoiceHandler extends Component { this.setState({ status: "Recognized" }); - console.log("onSpeechRecognized()"); + this.logRemote("onSpeechRecognized()"); } onSpeechResults(e) { this.setState({ - recognized: [...recognized, e.value], + results: e.value, + recognized: recognized + " " + e.value, status: this.state.status+ "\nonSpeechResults():" + e.value }); @@ -100,11 +102,11 @@ class VoiceHandler extends Component { this.setState({ isRecording: false, isProcessing:true, - status: this.state.status+ "\nstopRecognizing()" + this.state.recognized + recognized: this.state.results.join(' ') }); // Assuming you have the audio data, send it to your backend - this._sendTranscribedTextToLLM("who is the president of thr USA"); - //this._sendTranscribedTextToLLM(this.state.recognized); + // this._sendTranscribedTextToLLM("who is the president of thr USA"); + this._sendTranscribedTextToLLM(this.state.results.join(' ')); } catch (e) { console.error(e); } @@ -139,7 +141,7 @@ class VoiceHandler extends Component { // Handle error appropriately in your app } else { // Handle successful response - console.log('LLM Response:', responseJson.message); + this.logRemote('LLM Response:', responseJson.message); // Update your app state or UI based on LLM response this.setState(prevState => ({ status: "LLM responded", @@ -177,7 +179,7 @@ class VoiceHandler extends Component { }) .then(response => response.text()) .then(body => { - console.log('Audio sent to backend, response:', body); + this.logRemote('Audio sent to backend, response:', body); this.setState(prevState => ({ results: [...prevState.results, body], // Append the response to the existing results })); diff --git a/web/server.js b/web/server.js index c6a2d48..7a85922 100644 --- a/web/server.js +++ b/web/server.js @@ -120,7 +120,7 @@ app.get('/', (req, res) => { //accept LOG messages on /log app.post('/log', (req, res) => { - console.log(req.body.message); + console.log("log>" + req.body.message); res.send('OK', 200, { 'Content-Type': 'text/plain' }); });