Explorar el Código

修改ai加载动画及应用配置初始化编辑

yangg hace 8 meses
padre
commit
67acddadec

+ 1 - 1
.env.development

@@ -2,7 +2,7 @@
 ENV = 'development'
 port = 8080
 # base api
-VUE_APP_BASE_API = 'http://192.168.1.199:8084'
+VUE_APP_BASE_API = 'http://58.246.234.210:8084'
 #192.168.1.199
 
 #58.246.234.210

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/index.html


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/css/app.7fd9d64f.css


+ 0 - 1
dist/static/css/chunk-17263cbd.3e79a859.css

@@ -1 +0,0 @@
-.header[data-v-f75fa77e]{margin-left:20px}.header h2[data-v-f75fa77e]{margin-bottom:0}.center[data-v-f75fa77e]{margin:10px}.center[data-v-f75fa77e] .el-form--inline .el-form-item{display:block}.center[data-v-f75fa77e] .el-input-number--medium{width:150px}.footer[data-v-f75fa77e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin:0 100px 20px}[data-v-f75fa77e] .avatar-uploader .el-upload{border:1px dashed #d9d9d9;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-f75fa77e]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-f75fa77e]{font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center}.avatar[data-v-f75fa77e]{width:100px;height:100px;display:block}.hint[data-v-f75fa77e]{font-size:12px;color:#c0c4cc}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/css/chunk-36afbef8.9ee4b3fc.css


+ 1 - 0
dist/static/css/chunk-d9ef2ea8.ca62898c.css

@@ -0,0 +1 @@
+.header[data-v-af168464]{margin-left:20px}.header h2[data-v-af168464]{margin-bottom:0}.center[data-v-af168464]{margin:10px}.center[data-v-af168464] .el-form--inline .el-form-item{display:block}.center[data-v-af168464] .el-input-number--medium{width:150px}.footer[data-v-af168464]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;margin:0 100px 20px}[data-v-af168464] .avatar-uploader .el-upload{border:1px dashed #d9d9d9;border-radius:6px;cursor:pointer;position:relative;overflow:hidden}.avatar-uploader .el-upload[data-v-af168464]:hover{border-color:#409eff}.avatar-uploader-icon[data-v-af168464]{font-size:28px;color:#8c939d;width:100px;height:100px;line-height:100px;text-align:center}.avatar[data-v-af168464]{width:100px;height:100px;display:block}.hint[data-v-af168464]{font-size:12px;color:#c0c4cc}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/app.254608f5.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/app.41f79839.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-17263cbd.903034a7.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-36afbef8.6e838300.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-ca61fc30.a9d2d184.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
dist/static/js/chunk-d9ef2ea8.62dd27ef.js


+ 107 - 90
src/components/ai.vue

@@ -281,50 +281,54 @@ export default {
       const chatId = this.getUuid();
       const wsUrl = `${process.env.VUE_APP_BASE_API}/chatbot/chat`; //this.wsUrl//'http://58.246.234.210:7860/api/v1/run/3ef7369e-b617-40d2-9e2e-54f3ee76ed2e?stream=false'
       let message = this.userInput.trim();
-      if (message) {
-        // Markdown换行:在每个换行符之前添加两个空格
-        message = message.replace(/(\r\n|\r|\n)/g, "  \n");
-
-        this.messages.push({
-          time: Date.now(),
-          message: message,
-          messageType: "TEXT",
-          user: "user",
-          done: true,
-        });
-        this.userInput = "";
-        // 添加机器人的响应消息(初始为空)
-        const botMessage = {
-          user: "bot",
-          messageType: "TEXT",
-          message: "",
-          html: "",
-          time: Date.now(),
-          done: false,
-        };
-        this.messages.push(botMessage);
+      if (!message) return;
+
+      // 添加用户消息
+      this.messages.push({
+        time: Date.now(),
+        message: message.replace(/(\r\n|\r|\n)/g, "  \n"),
+        messageType: "TEXT",
+        user: "user",
+        done: true,
+      });
+      this.userInput = "";
+
+      // 添加机器人的响应消息
+      const botMessage = {
+        user: "bot",
+        messageType: "TEXT",
+        message: "",
+        html: "",
+        time: Date.now(),
+        done: false,
+      };
+      this.messages.push(botMessage);
 
-        // 开始模拟思考
-        const thinkingPromise = this.simulateThinking(botMessage);
-        // 通过 HTTP 发送消息
-        try {
-          ///send-message
-          const response = await fetch(`${wsUrl}`, {
-            method: "POST",
-            headers: {
-              "Content-Type": "application/json",
-            },
-            /*  mode: 'no-cors', */
-            /* credentials: "include", */
-            body: JSON.stringify({
-              /*  chatId: chatId, */
-              message: message,
-              /* output_type: "chat",
+      // 开始思考动画
+      const thinkingController = new AbortController();
+      const thinkingPromise = this.simulateThinking(
+        botMessage,
+        thinkingController.signal
+      );
+      // 通过 HTTP 发送消息
+      try {
+        ///send-message
+        const response = await fetch(`${wsUrl}`, {
+          method: "POST",
+          headers: {
+            "Content-Type": "application/json",
+          },
+          /*  mode: 'no-cors', */
+          /* credentials: "include", */
+          body: JSON.stringify({
+            /*  chatId: chatId, */
+            message: message,
+            /* output_type: "chat",
               input_type: "chat", */
-              chat_config_id: this.currentChat_id,
-              user_id: this.$store.state.user.id,
-              session_id: this.session_id || "",
-              /* tweaks:this.tweaks  {
+            chat_config_id: this.currentChat_id,
+            user_id: this.$store.state.user.id,
+            session_id: this.session_id || "",
+            /* tweaks:this.tweaks  {
                 "ChatInput-U82Vu": {},
                 "Prompt-b8Z1E": {},
                 "OllamaModel-z9SVx": {},
@@ -336,46 +340,49 @@ export default {
                 "ParseData-fH1vY": {},
                 "ChatOutput-ybzb9": {}
               } */
-            }),
-          });
-          const result = await response.json();
-          this.session_id = result.data.session_id;
-          console.log(result);
-          if (result.code !== 200) {
-            const errorText = await response.text(); // 获取错误文本
-            throw new Error(
-              `HTTP error! status: ${response.status}, message: ${errorText}`
-            );
-          }
+          }),
+        });
+        // 停止思考动画
+        thinkingController.abort();
+        await thinkingPromise;
+        const result = await response.json();
+        this.session_id = result.data.session_id;
+        console.log(result);
+        if (result.code !== 200) {
+          const errorText = await response.text(); // 获取错误文本
+          throw new Error(
+            `HTTP error! status: ${response.status}, message: ${errorText}`
+          );
+        }
 
-          // 等待思考动画完成
-          await thinkingPromise;
-          if (this.$route.name !== "ai") {
-            // 提取 additional_input 数据
-            const additionalInput = result.data.milvus_ids; //outputs?.[0]?.outputs?.[0]?.results?.message?.data?.additional_input;
+        // 等待思考动画完成
+        await thinkingPromise;
+        if (this.$route.name !== "ai") {
+          // 提取 additional_input 数据
+          const additionalInput = result.data.milvus_ids; //outputs?.[0]?.outputs?.[0]?.results?.message?.data?.additional_input;
 
-            // 处理字符串,提取 ID 值
-            this.idArray = additionalInput; /* .split('\n')  // 按换行符分割
+          // 处理字符串,提取 ID 值
+          this.idArray = additionalInput; /* .split('\n')  // 按换行符分割
           .map(line => line.trim())  // 去除每行首尾空白 */
-            /* .filter(line => line.startsWith('ID:'))  // 只保留以 'ID:' 开头的行
+          /* .filter(line => line.startsWith('ID:'))  // 只保留以 'ID:' 开头的行
           .map(line => line.substring(3).trim());  // 提取 'ID:' 后面的内容并去除空白 */
 
-            // 创建符合要求格式的对象
-            const idObject = { ids: this.idArray };
+          // 创建符合要求格式的对象
+          const idObject = { ids: this.idArray };
 
-            console.log("ID Object:", idObject);
+          console.log("ID Object:", idObject);
 
-            // 调用方法来获取 Minio URL,传递新的 idObject
-            await this.getMinioUrls(idObject);
-          }
-
-          this.handleResponse(result, botMessage);
-        } catch (error) {
-          console.error("Error sending message:", error);
-          // 如果发生错误,停止思考动画
-          botMessage.done = true;
-          botMessage.message = "抱歉,发生了错误,请稍后再试。";
+          // 调用方法来获取 Minio URL,传递新的 idObject
+          await this.getMinioUrls(idObject);
         }
+
+        this.handleResponse(result, botMessage);
+      } catch (error) {
+        console.error("Error sending message:", error);
+        thinkingController.abort();
+        await thinkingPromise;
+        botMessage.done = true;
+        botMessage.message = "抱歉,发生了错误,请稍后再试。";
       }
     },
     async getMinioUrls(idObject) {
@@ -413,27 +420,37 @@ export default {
         }
       }
     },
-    async simulateThinking(message) {
+    async simulateThinking(message, signal) {
       this.isThinking = true;
-      const thinkingTime = Math.random() * 1000 + 500; // 思考时间为 0.5-1.5 秒
       const dotInterval = 200; // 每 200ms 更新一次点
 
-      const updateDots = () => {
-        this.thinkingDots += ".";
-        if (this.thinkingDots.length > 3) {
-          this.thinkingDots = "";
-        }
-        message.message = this.thinkingDots;
-      };
-
-      const intervalId = setInterval(updateDots, dotInterval);
+      return new Promise((resolve) => {
+        const updateDots = () => {
+          if (signal.aborted) {
+            clearInterval(intervalId);
+            this.isThinking = false;
+            this.thinkingDots = "";
+            message.message = "";
+            resolve();
+            return;
+          }
 
-      await new Promise((resolve) => setTimeout(resolve, thinkingTime));
+          this.thinkingDots += ".";
+          if (this.thinkingDots.length > 3) {
+            this.thinkingDots = "";
+          }
+          message.message = "思考中" + this.thinkingDots;
+        };
 
-      clearInterval(intervalId);
-      this.isThinking = false;
-      this.thinkingDots = "";
-      message.message = "";
+        const intervalId = setInterval(updateDots, dotInterval);
+        signal.addEventListener("abort", () => {
+          clearInterval(intervalId);
+          this.isThinking = false;
+          this.thinkingDots = "";
+          message.message = "";
+          resolve();
+        });
+      });
     },
 
     async handleResponse(value, existingMessage) {

+ 43 - 31
src/views/appConfig/index.vue

@@ -235,13 +235,13 @@
                 <el-slider
                   style="width: 60%"
                   v-model="AIform.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   v-model="AIform.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-input-number>
@@ -257,14 +257,14 @@
                 <el-slider
                   style="width: 60%"
                   v-model="AIform.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   v-model="AIform.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-input-number>
               </div>
@@ -291,12 +291,12 @@
                   style="width: 60%"
                   v-model="AIform.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                 ></el-slider>
                 <el-input-number
-                  v-model="AIform.presence_penalty"
+                  v-model="AIform.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                   :step="1"
                 ></el-input-number>
               </div>
@@ -681,13 +681,13 @@
                 <el-slider
                   style="width: 60%"
                   v-model="editForm.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   v-model="editForm.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-input-number>
@@ -703,14 +703,14 @@
                 <el-slider
                   style="width: 60%"
                   v-model="editForm.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   v-model="editForm.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-input-number>
               </div>
@@ -737,12 +737,12 @@
                   style="width: 60%"
                   v-model="editForm.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                 ></el-slider>
                 <el-input-number
-                  v-model="editForm.presence_penalty"
+                  v-model="editForm.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                   :step="1"
                 ></el-input-number>
               </div>
@@ -832,10 +832,9 @@
               </div>
             </el-form-item>
           </el-col>
-         
         </el-row>
         <el-row :gutter="24">
-           <el-col :span="24">
+          <el-col :span="24">
             <el-form-item label="自定义提示模板:" prop="custom_prompt">
               <el-input
                 style="width: 100%"
@@ -1133,14 +1132,14 @@
                   disabled
                   style="width: 60%"
                   v-model="viewForm.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   disabled
                   v-model="viewForm.frequency_penalty"
-                  :min="-2"
+                  :min="0"
                   :max="2"
                   :step="0.1"
                 ></el-input-number>
@@ -1157,15 +1156,15 @@
                   disabled
                   style="width: 60%"
                   v-model="viewForm.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-slider>
                 <el-input-number
                   disabled
                   v-model="viewForm.presence_penalty"
-                  :min="-2"
-                  :max="2"
+                  :min="0"
+                  :max="1"
                   :step="0.1"
                 ></el-input-number>
               </div>
@@ -1194,13 +1193,13 @@
                   style="width: 60%"
                   v-model="viewForm.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                 ></el-slider>
                 <el-input-number
                   disabled
-                  v-model="viewForm.presence_penalty"
+                  v-model="viewForm.context_window"
                   :min="1"
-                  :max="4096"
+                  :max="10000"
                   :step="1"
                 ></el-input-number>
               </div>
@@ -2117,13 +2116,26 @@ export default {
     },
 
     async handleDirectoryAndDocumentSelection() {
+      // 检查是否为["全部"]的情况
       if (
-        !this.editForm.document_directories ||
-        this.editForm.document_directories.length === 0
+        this.editForm.document_directories.length === 1 &&
+        this.editForm.document_directories[0] === "全部"
       ) {
+        // 直接设置为"001"(全部)的ID,不需要查询接口
+        this.editForm.document_directories = "001";
+
+        // 如果文档为空或包含"全部",设置为all
+        if (
+          !this.editForm.documents ||
+          this.editForm.documents.length === 0 ||
+          this.editForm.documents.includes("全部")
+        ) {
+          this.editForm.documents = ["all"];
+        }
         return;
       }
 
+      // 其他情况保持原有逻辑
       const dirName = this.editForm.document_directories[0];
       const dir = this.editDirectoryList.find((dir) => dir.name === dirName);
 

+ 115 - 99
src/views/login/aiIndex.vue

@@ -67,7 +67,7 @@ import ChatBox from "@/components/webAi/index.vue";
 import LoginModal from "@/components/LoginModal";
 import MarkdownIt from "markdown-it";
 import { pcInnerAi, getMinioURl } from "@/api/api";
-import { modelList,get_default } from "@/api/knowledge";
+import { modelList, get_default } from "@/api/knowledge";
 import axios from "axios";
 const md = new MarkdownIt();
 
@@ -111,8 +111,8 @@ export default {
         documentDirectory: "",
         document: "",
       },
-      currentChat_id:'',
-      phone:''
+      currentChat_id: "",
+      phone: "",
     };
   },
   mounted() {
@@ -130,7 +130,7 @@ export default {
         if (AIData && AIData.data) {
           console.log(AIData);
           this.wsUrl = AIData.data.url || "";
-          this.phone=AIData.data.phone || ""
+          this.phone = AIData.data.phone || "";
           this.tweaks = AIData.data.tweaks || {};
         } else {
           console.error("Invalid AIData structure");
@@ -148,7 +148,7 @@ export default {
         this.tweaks = res.data.tweaks;
       });
     }
-    this.init()
+    this.init();
   },
   methods: {
     checkAIData() {
@@ -283,49 +283,53 @@ export default {
         }
       }
       const chatId = this.getUuid();
-      const wsUrl = `${process.env.VUE_APP_BASE_API}/chatbot/chat` //this.wsUrl;'http://58.246.234.210:7860/api/v1/run/3ef7369e-b617-40d2-9e2e-54f3ee76ed2e?stream=false'
+      const wsUrl = `${process.env.VUE_APP_BASE_API}/chatbot/chat`; //this.wsUrl;'http://58.246.234.210:7860/api/v1/run/3ef7369e-b617-40d2-9e2e-54f3ee76ed2e?stream=false'
       let message = this.userInput.trim();
-      if (message) {
-        // Markdown换行:在每个换行符之前添加两个空格
-        message = message.replace(/(\r\n|\r|\n)/g, "  \n");
-
-        this.messages.push({
-          time: Date.now(),
-          message: message,
-          messageType: "TEXT",
-          user: "user",
-          done: true,
-        });
-        this.userInput = "";
-        // 添加机器人的响应消息(初始为空)
-        const botMessage = {
-          user: "bot",
-          messageType: "TEXT",
-          message: "",
-          html: "",
-          time: Date.now(),
-          done: false,
-        };
-        this.messages.push(botMessage);
+      if (!message) return;
+
+      // 添加用户消息
+      this.messages.push({
+        time: Date.now(),
+        message: message.replace(/(\r\n|\r|\n)/g, "  \n"),
+        messageType: "TEXT",
+        user: "user",
+        done: true,
+      });
+      this.userInput = "";
+
+      // 添加机器人的响应消息
+      const botMessage = {
+        user: "bot",
+        messageType: "TEXT",
+        message: "",
+        html: "",
+        time: Date.now(),
+        done: false,
+      };
+      this.messages.push(botMessage);
 
-        // 开始模拟思考
-        const thinkingPromise = this.simulateThinking(botMessage);
-        // 通过 HTTP 发送消息
-        try {
-          ///send-message
-          const response = await fetch(`${wsUrl}`, {
-            method: "POST",
-            headers: {
-              "Content-Type": "application/json",
-            },
-            body: JSON.stringify({
-              /*  chatId: chatId, */
-              message: message,
-              /* output_type: "chat",
+      // 开始思考动画
+      const thinkingController = new AbortController();
+      const thinkingPromise = this.simulateThinking(
+        botMessage,
+        thinkingController.signal
+      );
+      // 通过 HTTP 发送消息
+      try {
+        ///send-message
+        const response = await fetch(`${wsUrl}`, {
+          method: "POST",
+          headers: {
+            "Content-Type": "application/json",
+          },
+          body: JSON.stringify({
+            /*  chatId: chatId, */
+            message: message,
+            /* output_type: "chat",
               input_type: "chat", */
-              chat_config_id:'3',//this.currentChat_id,
-              user_id: this.phone,//this.tweaks.Memory-KtRT7.session_id,
-              session_id: this.session_id || ""/* {
+            chat_config_id: "3", //this.currentChat_id,
+            user_id: this.phone, //this.tweaks.Memory-KtRT7.session_id,
+            session_id: this.session_id || "" /* {
                 "ChatInput-U82Vu": {},
                 "Prompt-b8Z1E": {},
                 "OllamaModel-z9SVx": {},
@@ -337,47 +341,49 @@ export default {
                 "ParseData-fH1vY": {},
                 "ChatOutput-ybzb9": {}
               } */,
-            }),
-          });
-
-          const result = await response.json();
-          this.session_id = result.data.session_id;
-          console.log(result);
-          if (result.code !== 200) {
-            const errorText = await response.text(); // 获取错误文本
-            throw new Error(
-              `HTTP error! status: ${response.status}, message: ${errorText}`
-            );
-          }
-          // 等待思考动画完成
-          await thinkingPromise;
-          if (this.$route.name !== "ai") {
-            // 提取 additional_input 数据
-            const additionalInput = result.data.milvus_ids;
-
-            // 处理字符串,提取 ID 值
-            this.idArray = additionalInput
-             /*  .split("\n") // 按换行符分割
+          }),
+        });
+        // 停止思考动画
+        thinkingController.abort();
+        await thinkingPromise;
+        const result = await response.json();
+        this.session_id = result.data.session_id;
+        console.log(result);
+        if (result.code !== 200) {
+          const errorText = await response.text(); // 获取错误文本
+          throw new Error(
+            `HTTP error! status: ${response.status}, message: ${errorText}`
+          );
+        }
+        // 等待思考动画完成
+        await thinkingPromise;
+        if (this.$route.name !== "ai") {
+          // 提取 additional_input 数据
+          const additionalInput = result.data.milvus_ids;
+
+          // 处理字符串,提取 ID 值
+          this.idArray = additionalInput;
+          /*  .split("\n") // 按换行符分割
               .map((line) => line.trim()) // 去除每行首尾空白
               .filter((line) => line.startsWith("ID:")) // 只保留以 'ID:' 开头的行
               .map((line) => line.substring(3).trim()); // 提取 'ID:' 后面的内容并去除空白 */
 
-            // 创建符合要求格式的对象
-            const idObject = { ids: this.idArray };
+          // 创建符合要求格式的对象
+          const idObject = { ids: this.idArray };
 
-            console.log("ID Object:", idObject);
+          console.log("ID Object:", idObject);
 
-            // 调用方法来获取 Minio URL,传递新的 idObject
-            await this.getMinioUrls(idObject);
-          }
-
-          this.handleResponse(result, botMessage);
-        } catch (error) {
-          console.error("Error sending message:", error);
-          // 如果发生错误,停止思考动画
-          botMessage.done = true;
-          botMessage.message = "抱歉,发生了错误,请稍后再试。";
+          // 调用方法来获取 Minio URL,传递新的 idObject
+          await this.getMinioUrls(idObject);
         }
+
+        this.handleResponse(result, botMessage);
+      } catch (error) {
+        console.error("Error sending message:", error);
+        thinkingController.abort();
+        await thinkingPromise;
+        botMessage.done = true;
+        botMessage.message = "抱歉,发生了错误,请稍后再试。";
       }
     },
     async getMinioUrls(idObject) {
@@ -415,36 +421,46 @@ export default {
         }
       }
     },
-    async simulateThinking(message) {
+    async simulateThinking(message, signal) {
       this.isThinking = true;
-      const thinkingTime = Math.random() * 1000 + 500; // 思考时间为 0.5-1.5 秒
       const dotInterval = 200; // 每 200ms 更新一次点
 
-      const updateDots = () => {
-        this.thinkingDots += ".";
-        if (this.thinkingDots.length > 3) {
-          this.thinkingDots = "";
-        }
-        message.message = this.thinkingDots;
-      };
-
-      const intervalId = setInterval(updateDots, dotInterval);
+      return new Promise((resolve) => {
+        const updateDots = () => {
+          if (signal.aborted) {
+            clearInterval(intervalId);
+            this.isThinking = false;
+            this.thinkingDots = "";
+            message.message = "";
+            resolve();
+            return;
+          }
 
-      await new Promise((resolve) => setTimeout(resolve, thinkingTime));
+          this.thinkingDots += ".";
+          if (this.thinkingDots.length > 3) {
+            this.thinkingDots = "";
+          }
+          message.message = "思考中" + this.thinkingDots;
+        };
 
-      clearInterval(intervalId);
-      this.isThinking = false;
-      this.thinkingDots = "";
-      message.message = "";
+        const intervalId = setInterval(updateDots, dotInterval);
+        signal.addEventListener("abort", () => {
+          clearInterval(intervalId);
+          this.isThinking = false;
+          this.thinkingDots = "";
+          message.message = "";
+          resolve();
+        });
+      });
     },
 
     async handleResponse(value, existingMessage) {
-      const data = value.data.answer
+      const data = value.data.answer;
 
       existingMessage.messageType = data;
       /* existingMessage.time = data.timestamp; */
-      existingMessage.message = '';
-      
+      existingMessage.message = "";
+
       let mainText = data;
       let sourceText = "";
 
@@ -737,7 +753,7 @@ export default {
   overflow-y: auto; /* 如果消息太多,允许滚动 */
   height: calc(100vh - 130px); /* 高度需要根据输入框和其他元素的高度调整 */
   padding: 10px; /* 或你希望的内边距大小 */
- /*  margin-bottom: 120px; */
+  /*  margin-bottom: 120px; */
 }
 /* 针对手机端的媒体查询 */
 @media screen and (max-width: 768px) {

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio