Block all prompt input while waiting for response
This commit is contained in:
parent
5120cc44c8
commit
ad1b3150e5
|
@ -398,7 +398,7 @@
|
||||||
// Remove updating indicator
|
// Remove updating indicator
|
||||||
updating = 1 // hide indicator, but still signal we're updating
|
updating = 1 // hide indicator, but still signal we're updating
|
||||||
updatingMessage = ''
|
updatingMessage = ''
|
||||||
console.log('ev.data', ev.data)
|
// console.log('ev.data', ev.data)
|
||||||
if (!chatResponse.hasFinished()) {
|
if (!chatResponse.hasFinished()) {
|
||||||
if (ev.data === '[DONE]') {
|
if (ev.data === '[DONE]') {
|
||||||
// ?? anything to do when "[DONE]"?
|
// ?? anything to do when "[DONE]"?
|
||||||
|
@ -441,6 +441,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const addNewMessage = () => {
|
const addNewMessage = () => {
|
||||||
|
if (updating) return
|
||||||
let inputMessage: Message
|
let inputMessage: Message
|
||||||
const lastMessage = chat.messages[chat.messages.length - 1]
|
const lastMessage = chat.messages[chat.messages.length - 1]
|
||||||
const uuid = uuidv4()
|
const uuid = uuidv4()
|
||||||
|
@ -550,6 +551,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const recordToggle = () => {
|
const recordToggle = () => {
|
||||||
|
if (updating) return
|
||||||
// Check if already recording - if so, stop - else start
|
// Check if already recording - if so, stop - else start
|
||||||
if (recording) {
|
if (recording) {
|
||||||
recognition?.stop()
|
recognition?.stop()
|
||||||
|
@ -619,7 +621,7 @@
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<p class="control mic" class:is-hidden={!recognition}>
|
<p class="control mic" class:is-hidden={!recognition}>
|
||||||
<button class="button" class:is-pulse={recording} on:click|preventDefault={recordToggle}
|
<button class="button" class:is-disabled={updating} class:is-pulse={recording} on:click|preventDefault={recordToggle}
|
||||||
><span class="icon"><Fa icon={faMicrophone} /></span></button
|
><span class="icon"><Fa icon={faMicrophone} /></span></button
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
@ -627,7 +629,7 @@
|
||||||
<button title="Chat/Profile Settings" class="button" on:click|preventDefault={showSettingsModal}><span class="icon"><Fa icon={faGear} /></span></button>
|
<button title="Chat/Profile Settings" class="button" on:click|preventDefault={showSettingsModal}><span class="icon"><Fa icon={faGear} /></span></button>
|
||||||
</p>
|
</p>
|
||||||
<p class="control queue">
|
<p class="control queue">
|
||||||
<button title="Queue message, don't send yet" class="button is-ghost" on:click|preventDefault={addNewMessage}><span class="icon"><Fa icon={faArrowUpFromBracket} /></span></button>
|
<button title="Queue message, don't send yet" class:is-disabled={updating} class="button is-ghost" on:click|preventDefault={addNewMessage}><span class="icon"><Fa icon={faArrowUpFromBracket} /></span></button>
|
||||||
</p>
|
</p>
|
||||||
{#if updating}
|
{#if updating}
|
||||||
<p class="control send">
|
<p class="control send">
|
||||||
|
|
Loading…
Reference in New Issue