http log over https
This commit is contained in:
@ -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
|
||||
}));
|
||||
|
Reference in New Issue
Block a user