소스 검색

首页会话功能历史数据-深度思考

bobo04052021@163.com 2 주 전
부모
커밋
045645ba08
1개의 변경된 파일27개의 추가작업 그리고 9개의 파일을 삭제
  1. 27 9
      src/layouts/default/sider/bottomSider2.vue

+ 27 - 9
src/layouts/default/sider/bottomSider2.vue

@@ -160,7 +160,7 @@ let userId = unref(userStore.getUserInfo).id;
 type MessageItem = {
   id: string; // 唯一标识时间戳
   type: 'user' | 'system';
-  content: string;
+  content?: string;
   content1?: string;
   Origintype?: string;
   Origintype1?: string;
@@ -465,15 +465,33 @@ async function sessionsHistory(id: string) {
           content: item.content,
           timestamp: Date.now(),
         });
-      } else {
+      } else if (item.role === 'assistant') {
         // role== assistant 机器回答
-        messageList.value.push({
-          id: `system_${Date.now()}`,
-          type: 'system',
-          content: item.content,
-          content1: item.thinking_content,
-          timestamp: Date.now(),
-        });
+        if (item.thinking_enabled) {
+          messageList.value.push({
+            id: `system_${Date.now()}_thinking`,
+            type: 'system',
+            content: item.thinking_content,
+            Origintype: 'thinking',
+            timestamp: Date.now(),
+          });
+          messageList.value.push({
+            id: `system_${Date.now()}_text`,
+            type: 'system',
+            content1: item.content,
+            Origintype1: 'text',
+            timestamp: Date.now(),
+          });
+        } else {
+          messageList.value.push({
+            id: `system_${Date.now()}`,
+            type: 'system',
+            content: item.content,
+            timestamp: Date.now(),
+          });
+        }
+
+        console.log(item.content);
       }
     });
   }