Bladeren bron

RAG增加停止对话

李富豪 7 maanden geleden
bovenliggende
commit
75ba1389f4
1 gewijzigde bestanden met toevoegingen van 13 en 3 verwijderingen
  1. 13 3
      app/components/chat.tsx

+ 13 - 3
app/components/chat.tsx

@@ -1587,6 +1587,10 @@ function _Chat() {
     return appList.find(item => item.value === value)?.desc;
   }
 
+  const couldStop = ChatControllerPool.hasPending();
+
+  const stopAll = () => ChatControllerPool.stopAll();
+
   return (
     <div className={styles.chat} key={session.id}>
       <div className="window-header" data-tauri-drag-region>
@@ -2061,11 +2065,17 @@ function _Chat() {
             </div>
           )}
           <IconButton
-            icon={<SendWhiteIcon />}
-            text='发送'
+            icon={couldStop ? <div style={{ width: 13, height: 13, background: '#FFFFFF', borderRadius: 2 }}></div> : <SendWhiteIcon />}
+            text={couldStop ? '停止' : '发送'}
             className={styles["chat-input-send"]}
             type="primary"
-            onClick={() => doSubmit(userInput)}
+            onClick={() => {
+              if (couldStop) {
+                stopAll();
+              } else {
+                doSubmit(userInput);
+              }
+            }}
           />
         </label>
       </div>