瀏覽代碼

refactor: 发送提问不带历史消息

王晓东 2 月之前
父節點
當前提交
879ead021a
共有 1 個文件被更改,包括 8 次插入9 次删除
  1. 8 9
      src/pages/chat/components/InputBar/useChatInput.ts

+ 8 - 9
src/pages/chat/components/InputBar/useChatInput.ts

@@ -120,14 +120,14 @@ export const useChatInput = ({
     let isFirstChunk = true;
     console.log('==== start new chat ====')
     // 取最后两条消息带上
-    const allMessages = [...historyList.reverse(), ...list];
-    const prevMessages = allMessages
-    .slice(Math.max(0, allMessages.length - 2)) // 确保不会负数
-    .map(item => ({
-      content: item.content as string,
-      contentType: item.contentType ?? EContentType.TextPlain,
-      role: item.role,
-    }));
+    // const allMessages = [...historyList.reverse(), ...list];
+    // const prevMessages = allMessages
+    // .slice(Math.max(0, allMessages.length - 2)) // 确保不会负数
+    // .map(item => ({
+    //   content: item.content as string,
+    //   contentType: item.contentType ?? EContentType.TextPlain,
+    //   role: item.role,
+    // }));
     // 发起文本聊天
     const request = requestTextToChat({
       params: {
@@ -137,7 +137,6 @@ export const useChatInput = ({
         isEnableThinking: false,
         loginId,
         messages: [
-          ...prevMessages,
         {
           content: message,
           contentType: EContentType.TextPlain,