This commit is contained in:
Saifeddine ALOUI 2024-05-27 02:04:19 +02:00
parent 4cbcae569f
commit 90e8387516
7 changed files with 230 additions and 229 deletions

View File

@ -77,6 +77,7 @@ def add_events(sio:socketio):
lollmsElfServer.info("Stopping audio capture") lollmsElfServer.info("Stopping audio capture")
lollmsElfServer.rt_com.stop_recording() lollmsElfServer.rt_com.stop_recording()
lollmsElfServer.rt_com = None lollmsElfServer.rt_com = None
lollmsElfServer.emit_socket_io_info("rtcom_status_changed",{"status":False}, client.client_id)
return {"status":False,"error":"Already running"} return {"status":False,"error":"Already running"}
try: try:

@ -1 +1 @@
Subproject commit 9d458ac979f0afbd427f188ee75747b13d2fd4e8 Subproject commit 3f72d1788eaf4ee94eb8189f6ab6ee69313f5226

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title> <title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-ae79f596.js"></script> <script type="module" crossorigin src="/assets/index-36bd57a7.js"></script>
<link rel="stylesheet" href="/assets/index-0469c5c8.css"> <link rel="stylesheet" href="/assets/index-f365ccbb.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View File

@ -292,21 +292,18 @@
</button> </button>
<div class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"><p class="max-w-sm text-sm text-gray-800 dark:text-gray-200">Press and talk.</p></div> <div class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"><p class="max-w-sm text-sm text-gray-800 dark:text-gray-200">Press and talk.</p></div>
</div> </div>
<div class="group relative w-max"> <div v-if="$store.state.config.active_tts_service!='None'" class="group relative w-max">
<button v-if="$store.state.config.active_tts_service!='None' && !$store.state.is_rt_on" <button v-if="is_rt"
type="button" type="button"
@click="startRTCom" @click="stopRTCom"
:class="{ 'text-red-500': isListeningToVoice }" class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-red-500 border borderred700 rounded-md"
class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-green-500 border border-green-700 rounded-md"
> >
<i data-feather="mic"></i> <i data-feather="mic"></i>
</button> </button>
<div class="pointer-events-none absolute -top-20 left-1/2 w-max -translate-x-1/2 rounded-md bg-gray-100 p-2 opacity-0 transition-opacity group-hover:opacity-100 dark:bg-gray-800"><p class="max-w-sm text-sm text-gray-800 dark:text-gray-200">Real time bidirectional audio mode.</p></div> <button v-else
<button v-if="$store.state.config.active_tts_service!='None' && $store.state.is_rt_on"
type="button" type="button"
@click="stopRTCom" @click="startRTCom"
:class="{ 'text-red-500': isListeningToVoice }" class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-green-500 border border-green-700 rounded-md"
class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer transform transition-transform hover:translate-y-[-5px] active:scale-90 bg-red-500 border border-red-700 rounded-md"
> >
<i data-feather="mic"></i> <i data-feather="mic"></i>
</button> </button>
@ -438,6 +435,7 @@ export default {
}, },
data() { data() {
return { return {
is_rt:false,
personalityHoveredIndex:null, personalityHoveredIndex:null,
loader_v0:loader_v0, loader_v0:loader_v0,
sendGlobe:sendGlobe, sendGlobe:sendGlobe,
@ -927,18 +925,20 @@ export default {
this.$emit('createEmptyAIMessage') this.$emit('createEmptyAIMessage')
}, },
startRTCom(){ startRTCom(){
this.is_rt = true
console.log("is_rt:",this.is_rt)
socket.emit('start_bidirectional_audio_stream'); socket.emit('start_bidirectional_audio_stream');
nextTick(() => { nextTick(() => {
feather.replace() feather.replace()
} })
)
}, },
stopRTCom(){ stopRTCom(){
this.is_rt = false
console.log("is_rt:",this.is_rt)
socket.emit('stop_bidirectional_audio_stream'); socket.emit('stop_bidirectional_audio_stream');
nextTick(() => { nextTick(() => {
feather.replace() feather.replace()
} }
) )
}, },
startSpeechRecognition() { startSpeechRecognition() {
@ -1184,13 +1184,13 @@ export default {
}) })
console.log("Chatbar mounted") console.log("Chatbar mounted")
socket.on('rtcom_status_changed', (data)=>{ socket.on('rtcom_status_changed', (data)=>{
console.log("rtcom_status_changed")
console.log("rtcom_status_changed: ",data.status)
this.$store.dispatch('fetchisRTOn'); this.$store.dispatch('fetchisRTOn');
console.log("rtcom_status_changed: ",data.status)
console.log("active_tts_service: ",this.$store.state.config.active_tts_service) console.log("active_tts_service: ",this.$store.state.config.active_tts_service)
console.log("is_rt_on: ",this.$store.state.is_rt_on) console.log("is_rt_on: ",this.$store.state.is_rt_on)
this.isAudioActive = data.status; this.is_rt = this.$store.state.is_rt_on
}); });
this.$store.dispatch('fetchisRTOn');
}, },
activated() { activated() {
nextTick(() => { nextTick(() => {

View File

@ -273,7 +273,7 @@ export const store = createStore({
console.log("response", response) console.log("response", response)
const is_rt_on = response.data.status; const is_rt_on = response.data.status;
console.log("languages", is_rt_on) console.log("is_rt_on", is_rt_on)
commit('setRTOn', is_rt_on); commit('setRTOn', is_rt_on);
}, },
async fetchLanguages({ commit }) { async fetchLanguages({ commit }) {