← back to Exo
adding diable to chatbox and send if download is in progress
12bb315d5dcee4d81260fafe5c59bebd85ee1033 · 2024-12-05 13:44:07 -0800 · Caden MacKenzie
Files touched
M exo/tinychat/index.html
Diff
commit 12bb315d5dcee4d81260fafe5c59bebd85ee1033
Author: Caden MacKenzie <cadenmackenzie@gmail.com>
Date: Thu Dec 5 13:44:07 2024 -0800
adding diable to chatbox and send if download is in progress
---
exo/tinychat/index.html | 59 ++++++++++++++++++++++++++++++++-----------------
1 file changed, 39 insertions(+), 20 deletions(-)
diff --git a/exo/tinychat/index.html b/exo/tinychat/index.html
index 226de380..e738b597 100644
--- a/exo/tinychat/index.html
+++ b/exo/tinychat/index.html
@@ -276,27 +276,46 @@
<i class="fas fa-times"></i>
</button>
</div>
-<textarea :disabled="generating" :placeholder="generating ? 'Generating...' : 'Say something'" @input="
- home = (home === 0) ? 1 : home
- if (cstate.messages.length === 0 && $el.value === '') home = -1;
+<textarea
+ :disabled="generating || (downloadProgress?.length > 0 && downloadProgress.some(p => !p.isComplete))"
+ :placeholder="
+ generating ? 'Generating...' :
+ (downloadProgress?.length > 0 && downloadProgress.some(p => !p.isComplete)) ? 'Download in progress...' :
+ 'Say something'
+ "
+ @input="
+ home = (home === 0) ? 1 : home
+ if (cstate.messages.length === 0 && $el.value === '') home = -1;
- if ($el.value !== '') {
- const messages = [...cstate.messages];
- messages.push({ role: 'user', content: $el.value });
- // updateTotalTokens(messages);
- } else {
- if (cstate.messages.length === 0) total_tokens = 0;
- // else updateTotalTokens(cstate.messages);
- }
- " @keydown.enter="await handleEnter($event)" @keydown.escape.window="$focus.focus($el)" autofocus="" class="input-form" id="input-form" rows="1" x-autosize="" x-effect="
- console.log(generating);
- if (!generating) $nextTick(() => {
- $el.focus();
- setTimeout(() => $refs.messages.scrollTo({ top: $refs.messages.scrollHeight, behavior: 'smooth' }), 100);
- });
- " x-ref="inputForm"></textarea>
-<button :disabled="generating" @click="await handleSend()" class="input-button">
-<i :class="generating ? 'fa-spinner fa-spin' : 'fa-paper-plane'" class="fas"></i>
+ if ($el.value !== '') {
+ const messages = [...cstate.messages];
+ messages.push({ role: 'user', content: $el.value });
+ // updateTotalTokens(messages);
+ } else {
+ if (cstate.messages.length === 0) total_tokens = 0;
+ // else updateTotalTokens(cstate.messages);
+ }
+ "
+ @keydown.enter="await handleEnter($event)"
+ @keydown.escape.window="$focus.focus($el)"
+ autofocus=""
+ class="input-form"
+ id="input-form"
+ rows="1"
+ x-autosize=""
+ x-effect="
+ console.log(generating);
+ if (!generating) $nextTick(() => {
+ $el.focus();
+ setTimeout(() => $refs.messages.scrollTo({ top: $refs.messages.scrollHeight, behavior: 'smooth' }), 100);
+ });
+ "
+ x-ref="inputForm"></textarea>
+<button
+ :disabled="generating || (downloadProgress?.length > 0 && downloadProgress.some(p => !p.isComplete))"
+ @click="await handleSend()"
+ class="input-button">
+ <i :class="generating ? 'fa-spinner fa-spin' : 'fa-paper-plane'" class="fas"></i>
</button>
</div>
</div>
← f8d195ee only collect topology when peers changed
·
back to Exo
·
always show desc1/desc2 in tui 68d70be9 →