Merge commit 'ec57286ef39f869d0e4436ac62a22e6e664edc5d'

This commit is contained in:
Dobromir Popov 2024-02-16 21:20:15 +02:00
commit c8fd2d2594

View File

@ -8,10 +8,10 @@ import Voice from '@react-native-voice/voice';
// process.env.TTS_BACKEND_URL = "http://192.168.0.10:9008/asr" // process.env.TTS_BACKEND_URL = "http://192.168.0.10:9008/asr"
process.env.TTS_BACKEND_URL = "https://tts.d-popov.com/asr" process.env.TTS_BACKEND_URL = "https://tts.d-popov.com/asr"
const LLM_ENDPOINT = "https://ws.ai.d-popov.com/api/chat"; process.env.LLM_ENDPOINT = "https://ws.ai.d-popov.com/api/chat";
// const LLM_ENDPOINT = "http://192.168.0.11:11434/api/chat"; // const LLM_ENDPOINT = "http://192.168.0.11:11434/api/chat";
const LOG_ENDPOINT = "ws://192.168.0.11:3005/log"; process.env.LOG_ENDPOINT = "http://192.168.0.11:3005/log";
class VoiceHandler extends Component { class VoiceHandler extends Component {
constructor(props) { constructor(props) {
@ -62,14 +62,13 @@ class VoiceHandler extends Component {
async logRemote(message){ async logRemote(message){
try{ try{
fetch(LOG_ENDPOINT, { fetch(process.env.LOG_ENDPOINT, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
body: JSON.stringify({"message":message}), body: JSON.stringify({"message":message}),
}); });
} }
catch(e){ catch(e){
console.log("error logging:" + e); console.log("error logging:" + e);
@ -124,8 +123,8 @@ class VoiceHandler extends Component {
}) })
try { try {
this.logRemote('sending text to LLM at ', LLM_ENDPOINT, ": '", transcribedText, "'"); this.logRemote('sending text to LLM at ' + process.env.LLM_ENDPOINT + ": '" + transcribedText + "'");
const response = await fetch(LLM_ENDPOINT, { const response = await fetch(process.env.LLM_ENDPOINT, {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',