This commit is contained in:
Saifeddine ALOUI 2024-02-17 00:09:41 +01:00
parent b105dfdbaa
commit 023e35a179
6 changed files with 257 additions and 205 deletions

@ -1 +1 @@
Subproject commit 56a53bb35e56a294d4917bd568fbd9667a7c31f9
Subproject commit 61c2f0ed2ad24c6125309650f0a58fad4a84c02a

5
web/dist/assets/deaf_off-c2c46908.svg vendored Normal file
View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<path d="M16 16s-1.5-2-4-2-4 2-4 2"></path>
<line x1="9" y1="9" x2="15" y2="15"></line>
</svg>

After

Width:  |  Height:  |  Size: 300 B

5
web/dist/assets/deaf_on-7481cb29.svg vendored Normal file
View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="red" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<path d="M16 16s-1.5-2-4-2-4 2-4 2" stroke="currentColor"></path>
<line x1="9" y1="9" x2="15" y2="15" stroke="currentColor"></line>
</svg>

After

Width:  |  Height:  |  Size: 335 B

File diff suppressed because one or more lines are too long

2
web/dist/index.html vendored
View File

@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-524e92f5.js"></script>
<script type="module" crossorigin src="/assets/index-19afe86a.js"></script>
<link rel="stylesheet" href="/assets/index-015056f5.css">
</head>
<body>

View File

@ -15,6 +15,16 @@
>
<i data-feather="mic"></i>
</button>
<button
type="button"
@click="startRecording"
:class="{ 'text-green-500': isLesteningToVoice }"
class="w-6 hover:text-secondary duration-75 active:scale-90 cursor-pointer text-red-500"
>
<img v-if="!pending" :src="is_deaf_transcribing?deaf_on:deaf_off" height="25">
<img v-if="pending" :src="loading_icon" height="25">
</button>
<button
type="button"
@click="startRecording"
@ -237,6 +247,11 @@ import html5_block from '@/assets/html5_block.png';
import LaTeX_block from '@/assets/LaTeX_block.png';
import bash_block from '@/assets/bash_block.png';
import deaf_on from '@/assets/deaf_on.svg';
import deaf_off from '@/assets/deaf_off.svg';
import rec_on from '@/assets/rec_on.svg';
import rec_off from '@/assets/rec_off.svg';
import loading_icon from '@/assets/loading.svg';
@ -391,6 +406,7 @@ export default {
return {
pending:false,
is_recording:false,
is_deaf_transcribing:false,
cpp_block:cpp_block,
html5_block:html5_block,
@ -401,6 +417,9 @@ export default {
python_block:python_block,
bash_block:bash_block,
deaf_off:deaf_off,
deaf_on:deaf_on,
rec_off:rec_off,
rec_on:rec_on,
loading_icon:loading_icon,
@ -867,6 +886,29 @@ export default {
}
},
startRecordingAndTranscribing(){
this.pending = true;
if(!this.is_recording){
axios.get('/start_recording').then(response => {
this.is_deaf_transcribing = true;
this.pending = false;
}).catch(ex=>{
this.$refs.toast.showToast(`Error: ${ex}`,4,false)
});
}
else{
axios.get('/stop_recording').then(response => {
this.is_deaf_transcribing = false;
this.pending = false;
this.text = response.data.text
this.read()
}).catch(ex=>{
this.$refs.toast.showToast(`Error: ${ex}`,4,false)
});
}
},
startSpeechRecognition() {
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {