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
8af16467
Commit
8af16467
authored
Nov 29, 2023
by
Timothy J. Baek
Browse files
feat: tts support
parent
61cc24c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
src/lib/components/chat/Messages.svelte
src/lib/components/chat/Messages.svelte
+29
-0
No files found.
src/lib/components/chat/Messages.svelte
View file @
8af16467
...
...
@@ -28,6 +28,11 @@
})();
}
const
speakMessage
=
(
message
)
=>
{
const
speak
=
new
SpeechSynthesisUtterance
(
message
);
speechSynthesis
.
speak
(
speak
);
};
const
createCopyCodeBlockButton
=
()
=>
{
// use a class selector if available
let
blocks
=
document
.
querySelectorAll
(
'
pre
'
);
...
...
@@ -692,6 +697,30 @@
>
</button>
<button
class=
"{messageIdx + 1 === messages.length
? 'visible'
: 'invisible group-hover:visible'} p-1 rounded dark:hover:bg-gray-800 transition"
on:click=
{()
=
>
{
speakMessage(message.content);
}}
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
viewBox=
"0 0 24 24"
stroke-width=
"1.5"
stroke=
"currentColor"
class=
"w-4 h-4"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
d=
"M19.114 5.636a9 9 0 010 12.728M16.463 8.288a5.25 5.25 0 010 7.424M6.75 8.25l4.72-4.72a.75.75 0 011.28.53v15.88a.75.75 0 01-1.28.53l-4.72-4.72H4.51c-.88 0-1.704-.507-1.938-1.354A9.01 9.01 0 012.25 12c0-.83.112-1.633.322-2.396C2.806 8.756 3.63 8.25 4.51 8.25H6.75z"
/>
</svg>
</button>
{#if messageIdx + 1 === messages.length}
<button
type=
"button"
...
...
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