lsc 5 mēneši atpakaļ
vecāks
revīzija
860db4e10a

+ 1 - 0
src/assets/icon/course/save.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1733971271920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11411" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M349.090909 372.363636V46.545455h349.090909v325.818181H349.090909zM823.319273 46.545455A131.002182 131.002182 0 0 1 954.181818 177.408v692.456727A131.002182 131.002182 0 0 1 823.319273 1000.727273H223.953455A131.025455 131.025455 0 0 1 93.090909 869.864727V177.408A131.025455 131.025455 0 0 1 223.953455 46.545455H279.272727v360.727272a34.909091 34.909091 0 0 0 34.909091 34.909091h418.909091a34.909091 34.909091 0 0 0 34.909091-34.909091V46.545455h55.319273zM593.454545 314.181818a46.545455 46.545455 0 1 0-0.023272-93.114182A46.545455 46.545455 0 0 0 593.454545 314.181818z" fill="#8a8a8a" p-id="11412"></path></svg>

+ 32 - 12
src/components/pages/aiAddCourse/addCourse.vue

@@ -2640,6 +2640,14 @@
                         </div>
                       </div>
                     </div>
+                    <div>
+                      <div @click="goToTask(unitJson[unitIndex].chapterInfo[0].taskJson.length)"
+                        class="navTask" :class="{ isNavTask: isClickColor == unitJson[unitIndex].chapterInfo[0].taskJson.length + 1  }">
+                        <div class="nt_taskBox" style="padding: 0 0 0 45px;">
+                          <div class="nt_taskTitle">附件区</div>
+                        </div>
+                      </div>
+                    </div>
                   </div>
                   <div class="navBottom" v-if="courseState == 1">
                     <div v-for="(stage, stageIndex) in unitJson" :key="stageIndex" class="stageBox" :class="{
@@ -5686,15 +5694,15 @@
                         添加任务
                       </button>
                     </div>
-                    <div class="appendixBox whiteBg" style="background: #fff; margin: 0 0 10px;"
+                    <div class="appendixBox whiteBg taskBorder" style="background: #fff; margin: 10px 0 10px;"
                       :style="{ paddingBottom: appendixPan ? '10px' : '0px' }" v-if="(appendixTaskCheck != 'all' || appendixTypeCheck != 'all') || allFile().length" v-loading="appendixLoading" element-loading-text="小可正在努力生成中,请稍等...">
-                      <div class="whiteBg" style="border-radius: 0; margin-top: 10px">
-                        <div class="appendix_info_title" style="margin: 0 20px 0 20px;position:relative;">
+                      <div class="whiteBg" style="border-radius: 0; ">
+                        <div class="appendix_info_title" style="margin: 0 20px 0 20px;position:relative; padding: 0 0 15px;">
                           <span>附件</span>
                           <button class="c_pub_button_confirm" style="margin: 0 0 0 auto;"
                             @click="appendixPan = !appendixPan">{{ appendixPan ? '折叠' : '展开' }}</button>
                         </div>
-                        <div style="width: 100%; padding: 0px 20px; box-sizing: border-box;"
+                        <div style="width: 100%; box-sizing: border-box;"
                           v-show="appendixPan">
                           <div class="appendix_check_box">
                             <div class="appendix_check_task">
@@ -5918,7 +5926,7 @@
         <aiBoxRight :languageSetting="languageSetting" :courseId="chatid" :unitJson="unitJson" :quoteArray="isQuote"
           :teacherCourseText="teacherCourseText" :targetCourseText="targetCourseText" :courseText2="courseText"
           :targetCourseText2="targetCourseText2" :cpote="cpote" @addCourseBehavior="addCourseBehavior"
-          :fileids='[...knowFileids, ...knowFileids2]' @setIsQuote="setIsQuote"></aiBoxRight>
+          :fileids='[...knowFileids, ...knowFileids2]' @setIsQuote="setIsQuote" @addChatAppendixFile="addChatAppendixFile"></aiBoxRight>
       </div>
       <div class="close_btn" @click="closeRight" :class="!isDisplay ? 'close_btn_voice' : ''"
         v-show="istemplate != 1 && isDialog == 1 && chatid">
@@ -10140,6 +10148,9 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
 
       });
     },
+    async addChatAppendixFile(name, html){
+      await this.generate(name, html, 0,"", 3)
+    },
     beforeUploadHtml(event, index, callback, type) {
         var file = event;
         var credentials = {
@@ -10195,7 +10206,7 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                     // }else {
                       _index = index
                     // }
-                    if(type != 2){
+                    if(type != 2 && type != 3){
                       _this.unitJson[0].chapterInfo[0].taskJson[_index].chapterData.unshift({
                         name: file.name,
                         url: data.Location,
@@ -10211,12 +10222,21 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
                         fileName = `${baseName} (${count}).${extension}`; // 修改文件名
                         count++;
                       }
-                      _this.appendixFile.unshift({
-                        name: fileName,
-                        url: data.Location,
-                        type: 3,
-                      })
-                      
+                      if(type == 3){
+                        _this.$message.success('保存到附件成功')
+                        _this.appendixFile.unshift({
+                          name: fileName,
+                          url: data.Location,
+                          type: 3,
+                          task: 'dialog'
+                        })
+                      }else{
+                        _this.appendixFile.unshift({
+                          name: fileName,
+                          url: data.Location,
+                          type: 3,
+                        })
+                      }
                     }
 
                     console.log(data.Location);

+ 57 - 1
src/components/pages/aiAddCourse/aiBoxRight.vue

@@ -51,6 +51,10 @@
               src="../../../assets/icon/course/pasete.png"
               @click="onCopy(item.aiContent)"
             />
+            <img
+              src="../../../assets/icon/course/save.svg"
+              @click="onSave(item.aiContent, item)"
+            />
           </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>
@@ -1794,6 +1798,52 @@ ${message}`;
         type: "success"
       });
     },
+    onSave(content, item) {
+      this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-保存信息成附件')
+
+      var str = content
+      str = str.replace(/<xml>[\s\S]*?<\/xml>/ig, '')
+      str = str.replace(/<style>[\s\S]*?<\/style>/ig, '')
+      str = str.replace(/<\/?[^>]*>/g, '')
+      str = str.replace(/[ | ]*\n/g, '\n')
+      str = str.replace(/&nbsp;/ig, '')
+      item.loading = true
+      let params = JSON.stringify({
+        // model: "gpt-3.5-turbo",
+        model: "gpt-4o-2024-11-20",
+        // model: "qwen-plus",
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [
+          {
+            role: "user",
+            content: `帮一下内容想一个名字命名作为word文档的名字,仅输出字符串即可 内容:${str}`
+          }
+        ],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: ""
+      });
+
+      this.ajax.post("https://gpt4.cocorobo.cn/chat", params).then(response => {
+        let data = response.data.FunctionResponse
+        if (data.choices && data.choices.length && data.choices[0].message) {
+          // 处理成功的情况
+          let ss = data.choices[0].message.content.replace(/^[‘“"']|[’”"']$/g, '');
+          this.$emit("addChatAppendixFile", ss, content)
+        }else{
+          this.$message.error('保存失败')
+        }
+        item.loading = false
+      }).catch(e => {
+        item.loading = false
+        this.$message.error('保存失败')
+        console.log(e);
+      });
+    },
     stopSend() {
       if (this.fasource) {
         this.fasource.close();
@@ -2336,7 +2386,7 @@ ${message}`;
   word-break: break-word;
   box-sizing: border-box;
   /* white-space: pre-line; */
-  max-width: calc(100% - 85px);
+  max-width: calc(100% - 100px);
   background: #f6f9ff;
   /* overflow: hidden; */
   margin: 0 10px;
@@ -2577,6 +2627,8 @@ ${message}`;
 .ai_btn_box {
   min-width: fit-content;
   margin-top: auto;
+  display: flex;
+  align-items: center;
 }
 
 .ai_btn_box > img {
@@ -2584,6 +2636,10 @@ ${message}`;
   width: 15px;
 }
 
+.ai_btn_box > img + img{
+  margin-left: 5px;
+}
+
 .ai_tips_btn_box{
   width: 100%;
   padding: 0 20px 0 50px;