Parcourir la source

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

王晓东 il y a 2 mois
Parent
commit
879ead021a
1 fichiers modifiés avec 8 ajouts et 9 suppressions
  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,