Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
eacce66a
Commit
eacce66a
authored
Jun 06, 2024
by
Timothy J. Baek
Browse files
refac
parent
4f19a92d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
src/lib/components/chat/MessageInput/CallOverlay.svelte
src/lib/components/chat/MessageInput/CallOverlay.svelte
+11
-6
No files found.
src/lib/components/chat/MessageInput/CallOverlay.svelte
View file @
eacce66a
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
let confirmed = false;
let confirmed = false;
let rmsLevel = 0;
let rmsLevel = 0;
let hasStartedSpeaking = false;
let audioContext;
let audioContext;
let analyser;
let analyser;
...
@@ -82,7 +83,7 @@
...
@@ -82,7 +83,7 @@
const timeDomainData = new Uint8Array(analyser.fftSize);
const timeDomainData = new Uint8Array(analyser.fftSize);
let lastSoundTime = Date.now();
let lastSoundTime = Date.now();
let
hasStartedSpeaking = false;
hasStartedSpeaking = false;
const detectSound = () => {
const detectSound = () => {
const processFrame = () => {
const processFrame = () => {
...
@@ -162,7 +163,11 @@
...
@@ -162,7 +163,11 @@
audioChunks = [];
audioChunks = [];
analyseAudio(stream);
analyseAudio(stream);
};
};
mediaRecorder.ondataavailable = (event) => audioChunks.push(event.data);
mediaRecorder.ondataavailable = (event) => {
if (hasStartedSpeaking) {
audioChunks.push(event.data);
}
};
mediaRecorder.onstop = async () => {
mediaRecorder.onstop = async () => {
console.log('Recording stopped');
console.log('Recording stopped');
...
@@ -227,12 +232,12 @@
...
@@ -227,12 +232,12 @@
{:else}
{:else}
<div
<div
class=" {rmsLevel * 100 > 4
class=" {rmsLevel * 100 > 4
? 'size-
48
'
? '
size-
52
'
: rmsLevel * 100 > 2
: rmsLevel * 100 > 2
? 'size-
[11.5rem]
'
? 'size-
48
'
: rmsLevel * 100 > 1
: rmsLevel * 100 > 1
? 'size-
44
'
? 'size-
[11.5rem]
'
: 'size-
[10.5rem]
'} transition-all bg-black dark:bg-white rounded-full"
: 'size-
44
'} transition-all bg-black dark:bg-white rounded-full"
/>
/>
{/if}
{/if}
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment