diff --git a/agent-mobile/artimobile/VoiceHandler.js b/agent-mobile/artimobile/VoiceHandler.js index 2d38305..f4223ac 100644 --- a/agent-mobile/artimobile/VoiceHandler.js +++ b/agent-mobile/artimobile/VoiceHandler.js @@ -3,13 +3,15 @@ import React, { Component } from 'react'; import { View, Text, Button } from 'react-native'; import Voice from '@react-native-voice/voice'; -import Config from 'react-native-config'; -process.env.TTS_BACKEND_URL = Config.TTS_BACKEND_URL; +// import Config from 'react-native-config'; +// process.env.TTS_BACKEND_URL = Config.TTS_BACKEND_URL; +process.env.TTS_BACKEND_URL = "http://192.168.0.10:9008/asr" class VoiceHandler extends Component { constructor(props) { super(props); this.state = { + status: '', recognized: '', started: '', results: [], @@ -66,7 +68,8 @@ class VoiceHandler extends Component { await Voice.stop(); this.setState({ isRecording: false, - isProcessing:true + isProcessing:true, + recognized: this.state.results.join(' ') }); // Assuming you have the audio data, send it to your backend this._sendTranscribedTextToLLM(this.state.results.join(' ')); @@ -83,6 +86,9 @@ class VoiceHandler extends Component { messages: [{ role: "user", content: "I have a request: " + transcribedText }], stream: false, }; + this.setState({ + status: ["sending to LLM:" + transcribedText] + }) try { console.log('sending text to LLM at ', LLM_ENDPOINT, ": '", transcribedText, "'"); @@ -104,6 +110,7 @@ class VoiceHandler extends Component { console.log('LLM Response:', responseJson.message); // Update your app state or UI based on LLM response this.setState(prevState => ({ + status: "LLM responded", results: [...prevState.results, responseJson.message.content], // Append the response to the existing results })); } @@ -155,6 +162,7 @@ class VoiceHandler extends Component { title={this.state.isRecording ? "Stop Recognizing" : "Start Recognizing"} color={this.state.isRecording ? "red" : this.state.isProcessing ? "orange" : "blue"} // Change color based on state /> + Status: {this.state.status} Recognized: {this.state.recognized} Started: {this.state.started} Results: {this.state.results.join(' ')} diff --git a/agent-mobile/artimobile/package.json b/agent-mobile/artimobile/package.json index 19b48e6..db2e8d9 100644 --- a/agent-mobile/artimobile/package.json +++ b/agent-mobile/artimobile/package.json @@ -12,8 +12,7 @@ "dependencies": { "@react-native-voice/voice": "^3.2.4", "react": "18.2.0", - "react-native": "0.73.4", - "react-native-config": "^1.5.1" + "react-native": "0.73.4" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/agent-mobile/idea.md b/agent-mobile/idea.md index f065e7e..7e77ab6 100644 --- a/agent-mobile/idea.md +++ b/agent-mobile/idea.md @@ -53,8 +53,8 @@ tar -xzf jdk-17.0.8_linux-x64_bin.tar.gz -C /home/androidusr/download export JAVA_HOME=/home/androidusr/download/jdk-17.0.8 export PATH=$JAVA_HOME/bin:$PATH source ~/.bashrc -cd /opt/android/tools/bin -yes | ./sdkmanager --licenses +#cd /opt/android/tools/bin +#yes | ./sdkmanager --licenses cd /home/androidusr/tmp npx react-native run-android @@ -71,5 +71,5 @@ react-native link @react-native-voice/voice The SDK directory is not writable (/opt/android) >> sudo chown -R androidusr:androidusr /opt/android # release build -cd android +cd ~/tmp/android ./gradlew assembleRelease