From c5f12a189d260be4775853bdaea486eafedb9343 Mon Sep 17 00:00:00 2001 From: Yaiko Date: Thu, 25 Jul 2024 16:43:24 -0400 Subject: [PATCH] server : add Speech Recognition & Synthesis to UI (fixes) --- examples/server/public/index.html | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/server/public/index.html b/examples/server/public/index.html index 986c682d65cab..07fec6a38bbcd 100644 --- a/examples/server/public/index.html +++ b/examples/server/public/index.html @@ -141,10 +141,8 @@ gap: 0.5em; } .message-controls > div:nth-child(2) > div { - margin-left: auto; - } - .message-controls > div:nth-child(2) > div:nth-child(1) { display: flex; + margin-left: auto; gap: 0.5em; } @@ -285,7 +283,7 @@ import { llama } from './completion.js'; import { SchemaConverter } from './json-schema-to-grammar.mjs'; - + let selected_image = false; var slot_id = -1; @@ -620,12 +618,12 @@ if (e) e.preventDefault(); talkActive.value = false; - talkRecognition?.stop(); + talkRecognition?.stop(); } const talk = (e) => { e.preventDefault(); - if (talkRecognition) + if (talkRecognition) talkRecognition.start(); else alert("Speech recognition is not supported by this browser."); @@ -685,17 +683,29 @@
-
- sendOnTalk.value = e.target.checked} /> - + { + e.preventDefault(); + alert(`STT supported by your browser: ${SpeechRecognition ? 'Yes' : 'No'}\n` + + `(TTS and speech recognition are not provided by llama.cpp)\n` + + `Note: STT requires HTTPS to work.`); + }}>[?] + +
+ sendOnTalk.value = e.target.checked} /> + +
- + { + e.preventDefault(); + alert(`TTS supported by your browser: ${tts ? 'Yes' : 'No'}\n(TTS and speech recognition are not provided by llama.cpp)`); + }}>[?] +