Jelajahi Sumber

获取聊天记录后触底

lzw 9 bulan lalu
induk
melakukan
34e9e7cfd0
1 mengubah file dengan 20 tambahan dan 17 penghapusan
  1. 20 17
      src/components/pages/test/checkAi/aiLeader.vue

+ 20 - 17
src/components/pages/test/checkAi/aiLeader.vue

@@ -9,7 +9,7 @@
           </div>
         </div>
         <div style="margin-top:20px;margin-bottom:20px ; margin-right: auto;"
-          v-if="(item.aiContent || item.loading || fileList.length == 0) && item.content!==0">
+          v-if="(item.aiContent || item.loading || fileList.length == 0) && item.content !== 0">
           <div class="role">
             <img :src="item.fileid
               ? item.fileid
@@ -574,6 +574,9 @@ export default {
       console.log("cid", this.cid);
       this.getData(this.cid)
       await this.getChatList()
+      this.$nextTick(() => {
+        this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
+      });
       await this.guessAskJson()
       this.addChat(names)
       this.dialogTableVisible = false;
@@ -599,22 +602,22 @@ export default {
       }
     },
     addChat(names) {
-        let params = [{
-          uid: this.userid,
-          name: names,
-          courseId: this.formId
-        }];
-        this.ajax
-          .post(this.$store.state.api + "addChat", params)
-          .then(res => {
-            console.log("res", res);
+      let params = [{
+        uid: this.userid,
+        name: names,
+        courseId: this.formId
+      }];
+      this.ajax
+        .post(this.$store.state.api + "addChat", params)
+        .then(res => {
+          console.log("res", res);
 
 
-          })
-          .catch((err) => {
-            resolve();
-            console.error(err);
-          })
+        })
+        .catch((err) => {
+          resolve();
+          console.error(err);
+        })
     },
     async guessAskJson() {
       const names = this.worksArray.map(item => item.name).join(', ');
@@ -650,7 +653,7 @@ export default {
         createtime: new Date().toLocaleString().replaceAll("/", "-")
       });
       this.text = "";
-      
+
       this.ajax
         // .post("https://gpt4.cocorobo.cn/chat", params)
         // .post("https://claude3.cocorobo.cn/chat", params)
@@ -677,7 +680,7 @@ export default {
         });
       // this.getWAntSearchContent(_uuid);
     },
-    
+
     beforeUploadInfo2(event, type, tindex) {
       // const loading = this.openLoading();
       let file = "";