Просмотр исходного кода

server : (webui) allow typing and submitting during llm response (#11626)

Woof Dog 11 месяцев назад
Родитель
Сommit
1d1e6a90bc

BIN
examples/server/public/index.html.gz


+ 0 - 1
examples/server/webui/index.html

@@ -154,7 +154,6 @@
             placeholder="Type a message (Shift+Enter to add a new line)"
             v-model="inputMsg"
             @keydown.enter.exact.prevent="sendMessage"
-            :disabled="isGenerating"
             id="msg-input"
             dir="auto"
           ></textarea>

+ 8 - 0
examples/server/webui/src/main.js

@@ -469,6 +469,14 @@ const mainApp = createApp({
     },
     async sendMessage() {
       if (!this.inputMsg) return;
+
+      if (this.isGenerating) {
+        this.stopGeneration();
+        while (this.isGenerating) {
+          await new Promise((resolve) => setTimeout(resolve, 10));
+        }
+      }
+
       const currConvId = this.viewingConvId;
 
       StorageUtils.appendMsg(currConvId, {