lsc 9 月之前
父節點
當前提交
1a75632b18

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
       width: 100%;
       background: #e6eaf0;
       font-family: '黑体';
-    }</style><link href=./static/css/app.64220cce724e8009d1e0f08b0c990718.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.571c38d63f24b1ae9e16.js></script><script type=text/javascript src=./static/js/vendor.382e92fdebaf6164bf93.js></script><script type=text/javascript src=./static/js/app.d9ad142a47ce19af6efe.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.911a4acbb7e9479d9987804197c3982c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.571c38d63f24b1ae9e16.js></script><script type=text/javascript src=./static/js/vendor.382e92fdebaf6164bf93.js></script><script type=text/javascript src=./static/js/app.db643978bf03b350845c.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.64220cce724e8009d1e0f08b0c990718.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.911a4acbb7e9479d9987804197c3982c.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.911a4acbb7e9479d9987804197c3982c.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.db643978bf03b350845c.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.db643978bf03b350845c.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.571c38d63f24b1ae9e16.js.map


+ 1 - 1
package-lock.json

@@ -21934,7 +21934,7 @@
         "jquery": "^3.6.0",
         "js-audio-recorder": "^1.0.7",
         "js-pinyin": "^0.1.9",
-        "jsmind": "0.4.11",
+        "jsmind": "^0.4.11",
         "jspdf": "^2.5.1",
         "jszip": "^3.10.1",
         "lamejs": "^1.2.1",

+ 49 - 9
src/components/pages/aiAddCourse/addCourse.vue

@@ -941,7 +941,8 @@
                     </div>
                   </div>
                 </div>
-                <div v-loading="knowInfoDataLoading" element-loading-text="小可正在努力生成中,请稍等...">
+                <div v-loading="knowInfoDataLoading" element-loading-text="小可正在努力生成中,请稍等..." :style="{ minHeight: knowInfoDataLoading ? '200px' : 'auto'}">
+                  <div class="c_pub_button_confirm stopBtn" v-if="knowInfoDataLoading && isfindMatchingContents" @click="cancelAjax('findMatchingContents')">停止</div>
                   <div class="add_chapters_box add_c_none" v-if="
                     knowInfoData2 &&
                     knowInfoData2.length == 0
@@ -962,7 +963,7 @@
                                     display: flex;
                                     align-items: center;
                                   ">
-                        <div class="chapter_upload_check" :class="{ checked: knowFileids2.indexOf(item1.fileid) != -1 }" @click="checkKnowInfoData2(item1.fileid)"></div>
+                        <div class="chapter_upload_check file-loading-class" :class="{ checked: knowFileids2.indexOf(item1.fileid) != -1 }" @click="checkKnowInfoData2(item1.fileid)" v-loading="!item1.fileid"></div>
                         <div class="chapter_upload_l" style="padding: 1px 0 0 10px">
                           <div v-if="item1.type == 2" class="chapter_upload_l_i2"></div>
                           <div v-if="item1.type == 3" class="chapter_upload_l_i3" style="margin-left: 1px">
@@ -11647,6 +11648,9 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
       }
     },
     checkKnowInfoData2(fileid){
+      if(!fileid){
+        return
+      }
       if(this.knowFileids2.indexOf(fileid) == -1){
         this.knowFileids2.push(fileid)
       }else {
@@ -11728,7 +11732,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           if(_this.knowFileids2.indexOf(_this.knowInfoData[ic].fileid) != -1){
             _this.knowFileids2.splice(_this.knowFileids2.indexOf(_this.knowInfoData[ic].fileid), 1)
           }
-          _this.knowInfoData.splice(
+          _this.knowInfoData2.splice(
             ic,
             1
           );
@@ -18954,6 +18958,18 @@ ${this.courseText && this.aiCallBack[0] == 2 ? '注意,优化原有的<参考
         }
         this.$forceUpdate()
       }
+
+      if(type == 'findMatchingContents'){
+        this.$message.success("已经成功停止检索资料")
+        if(this.isfindMatchingContents){
+          this.isfindMatchingContents.cancel('Request canceled by the user.');
+          this.isfindMatchingContents = null;
+        }
+        if(this.knowInfoDataLoading){
+          this.knowInfoDataLoading = false
+        }
+        this.$forceUpdate()
+      }
     },
     async aiGetTask2(messages, callback) {
       let _this = this
@@ -24350,8 +24366,11 @@ ${msg}
         string: this.searchFileName,
       };
       let md = new MarkdownIt();
-      this.ajax.get(this.$store.state.api + 'findMatchingContents', params).then(async res => {
+      this.isfindMatchingContents = this.ajax.setCancelSource()
+      this.ajax.get(this.$store.state.api + 'findMatchingContents', params, this.isfindMatchingContents).then(async res => {
         console.log(res)
+        this.isfindMatchingContents = null
+        this.knowInfoDataLoading = false
         if(res.data.length){
           let files = []
           // let knowFile = JSON.parse(JSON.stringify(this.knowFileids2))
@@ -24379,15 +24398,26 @@ ${msg}
             }
             let isExist = this.knowInfoData2.some(item => item.name === el.title);
             if (!isExist) {
-              let fileid = await this.createFileid(url)
+              // let fileid = await this.createFileid(url)
               this.knowInfoData2.push({
                 name: el.title,
                 url: url,
                 uid: '',
                 type: _type,
-                fileid: fileid == 1 ? '' : fileid,
+                fileid: '',
+                // fileid == 1 ? '' : fileid
               });
-              if(fileid != 1){
+              // if(fileid != 1){
+              //   this.knowFileids2.push(fileid)
+              // }
+            }
+          }
+          for (let i = 0; i < this.knowInfoData2.length; i++) {
+            if (!this.knowInfoData2[i].fileid) {
+              let fileid = await this.createFileid(this.knowInfoData2[i].url)
+              this.knowInfoData2[i].fileid = (fileid == 1 ? '' : fileid)
+              console.log(`文件 ${this.knowInfoData2[i].name} 的fileid为空`);
+              if(fileid != 1 && this.knowFileids2.indexOf(fileid) == -1){
                 this.knowFileids2.push(fileid)
               }
             }
@@ -24397,14 +24427,14 @@ ${msg}
           //     files: files
           //   }
           // }
-          console.log(data)
+          // console.log(data)
           // this.beforeUploadInfo2(data, 20)
         }else{
           this.$message.error('未检索出内容')
         }
-        this.knowInfoDataLoading = false
       }).catch(e => {
         console.log('查询失败');
+        this.isfindMatchingContents = null
         this.knowInfoDataLoading = false
         console.log(e);
       });
@@ -29114,4 +29144,14 @@ ol {
   box-shadow: 0 0 6px 3px #00000030;
   overflow: hidden;
 }
+
+
+.file-loading-class >>> .el-loading-spinner{
+  margin-top: -10px;
+}
+
+.file-loading-class >>> .el-loading-spinner .circular{
+  height: 20px;
+  width: 20px;
+}
 </style>

+ 58 - 5
src/components/pages/aiAddCourse/aiBoxRight.vue

@@ -54,7 +54,7 @@
           </div>
           <div class="ai_tips_btn_box" v-if="item.promptArray && item.promptArray.length">
             <span v-for="(pr, pindex) in item.promptArray" :key="pindex" @click="quickAdd(item.addedData, pr)">{{ pr.name }}</span>
-            <span @click="morePrompt(item.uid, item.addedData)" v-loading="item.moreloading">更多</span>
+            <span @click="moreClick(item.uid, item.addedData)" v-loading="item.moreloading && !item.moreDisplay2" v-if="item.moreDisplay">更多</span>
           </div>
         </div>
       </div>
@@ -706,7 +706,7 @@ export default {
             const md = new MarkdownIt();
             let content = `根据您引用的内容, 猜您想让小可... 
   \`\`\`
-  ${addedData[0].area + ':' + (addedData[0].value.length > 200 ? addedData[0].value.slice(0, 200) + '...' : addedData[0].value)}
+  ${addedData[0].area + ':' + (this.removeMarkdownSymbols(addedData[0].value).slice(0, 50) + (this.removeMarkdownSymbols(addedData[0].value).length > 50 ? '...' : ''))}
   \`\`\`
               `
             this.array.push({
@@ -724,6 +724,10 @@ export default {
               fileid: "",
               createtime: new Date().toLocaleString().replaceAll("/", "-"),
               addedData: addedData[0],
+              moreDisplay: true,
+              moreDisplay2: true,
+              moreArray: [],
+              moreloading: false,
               promptArray: promptJson[Object.keys(promptJson).find(item => addedData[0].string.includes(item))] || []
             });
             console.log('新增数据:', addedData);
@@ -734,6 +738,7 @@ export default {
             if (this.courseId) {
               this.insertChat(_uid);
             }
+            this.morePrompt(_uid, addedData[0])
           }
 
         } else {
@@ -743,6 +748,19 @@ export default {
     }
   },
   methods: {
+    removeMarkdownSymbols(text) {
+      return text
+        .replace(/(?:\*\*|__)(.*?)\1/g, '$1') // 加粗
+        .replace(/(?:\*|_)(.*?)\1/g, '$1') // 斜体
+        .replace(/`(.*?)`/g, '$1') // 代码
+        .replace(/^(#{1,6})\s*(.*)$/gm, '$2') // 标题
+        .replace(/^\s*[-*+]\s+/gm, '') // 无序列表
+        .replace(/^\s*\d+\.\s+/gm, '') // 有序列表
+        .replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1') // 链接
+        .replace(/>\s+/g, '') // 引用
+        .replace(/\n/g, '')
+        .replaceAll(' ', '');
+    },
     getLang() {
       let lang = "";
       if (this.languageSetting == 0) {
@@ -754,6 +772,17 @@ export default {
       }
       return lang;
     },
+    getLang2() {
+      let lang = "";
+      if (this.languageSetting == 0) {
+        lang = "中文。";
+      } else if (this.languageSetting == 1) {
+        lang = "繁体中文。";
+      } else if (this.languageSetting == 2) {
+        lang = "英文。";
+      }
+      return lang;
+    },
     cancelJ(string) {
       this.$emit("setIsQuote", string);
     },
@@ -907,8 +936,17 @@ Instruction: Based on the context, follow "Format example", write content.`
                 console.log("error_________________" + error);
               }
             }
-            _this.array.find(i => i.uid == uid).promptArray = [..._this.array.find(i => i.uid == uid).promptArray, ...dArray]
-            _this.array.find(i => i.uid == uid).moreloading = false;
+
+            if(_this.array.find(i => i.uid == uid).moreDisplay2){
+              _this.array.find(i => i.uid == uid).moreArray = [...dArray]
+              _this.array.find(i => i.uid == uid).moreloading = false;
+            }else{
+              _this.array.find(i => i.uid == uid).promptArray = [..._this.array.find(i => i.uid == uid).promptArray, ...dArray]
+              _this.array.find(i => i.uid == uid).moreloading = false;
+              _this.array.find(i => i.uid == uid).moreDisplay = false
+              _this.array.find(i => i.uid == uid).moreDisplay = false
+            }
+
             _this.$forceUpdate();
           }
 
@@ -920,6 +958,17 @@ Instruction: Based on the context, follow "Format example", write content.`
         });
 
     },
+    moreClick(uid, data){
+      if(this.array.find(i => i.uid == uid).moreArray.length){
+        this.array.find(i => i.uid == uid).promptArray = [...this.array.find(i => i.uid == uid).promptArray, ...this.array.find(i => i.uid == uid).promptArray]
+        this.array.find(i => i.uid == uid).moreDisplay = false
+      }else{
+        this.array.find(i => i.uid == uid).moreDisplay2 = false
+        if(!this.array.find(i => i.uid == uid).moreloading){
+          this.morePrompt(uid, data)
+        }
+      }
+    },
     quickAdd(data, pr){
       if(this.faloading){
         this.$message.error('请等待回答完毕在发送')
@@ -948,10 +997,10 @@ ${data.area + ':' + data.value}
         createtime: new Date().toLocaleString().replaceAll("/", "-"),
         loading: true
       });
+      // 注意:输出语言为${this.getLang2()}
 
       let _replaceText = `NOTICE
       Language: ${this.getLang()}
-
       ${string}`;
       this.$nextTick(() => {
         this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
@@ -962,6 +1011,8 @@ ${data.area + ':' + data.value}
         message: _replaceText,
         session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
         uid: _uuid,
+        model: "qwen-plus",
+        sound_url: "",
         file_ids: [...this.fileids],
         // model: "gpt-4o-mini"
         // model: "qwen-plus"
@@ -1202,6 +1253,8 @@ ${message}`;
             userId: this.userid,
             message: _replaceText,
             session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
+            model: "qwen-plus",
+            sound_url: "",
             uid: _uuid,
             file_ids: [...this.fileids],
             // model: "gpt-4o-mini"

Some files were not shown because too many files changed in this diff