SanHQin vor 3 Monaten
Ursprung
Commit
18bbfcd2a8

+ 1 - 1
dist/index.html

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

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.a38d5e21f0aaef344cdfc1e7485b92eb.css


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/css/app.a38d5e21f0aaef344cdfc1e7485b92eb.css.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/app.5c432484391fee1e5137.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/app.5c432484391fee1e5137.js.map


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
dist/static/js/manifest.161e82026ac2ae03ab6f.js.map


+ 1 - 0
src/assets/icon/test/down_icon.svg

@@ -0,0 +1 @@
+<svg t="1738910534279" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4220" width="200" height="200"><path d="M774.5 896h-525c-67 0-121.5-52.2-121.5-116.3V704c0-26.5 21.5-48 48-48s48 21.5 48 48v75.7c0 11 11.7 20.3 25.5 20.3h525c13.8 0 25.5-9.3 25.5-20.3V704c0-26.5 21.5-48 48-48s48 21.5 48 48v75.7c0 64.1-54.5 116.3-121.5 116.3zM512 128c-26.5 0-48 21.5-48 48v432c0 26.5 21.5 48 48 48s48-21.5 48-48V176c0-26.5-21.5-48-48-48z" fill="#231815" p-id="4221"></path><path d="M628.3 473.9c-12.3 0-24.6 4.7-33.9 14.1L512 570.3 429.7 488c-18.8-18.8-49.1-18.8-67.9 0s-18.8 49.1 0 67.9l116.3 116.3c18.8 18.8 49.1 18.8 67.9 0l116.3-116.3c18.8-18.8 18.8-49.1 0-67.9-9.5-9.4-21.8-14.1-34-14.1z" fill="#231815" p-id="4222"></path></svg>

+ 1 - 0
src/assets/icon/test/test_fold.svg

@@ -0,0 +1 @@
+<svg t="1738899361855" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4183" fill="#8A8A8A" width="200" height="200"><path d="M890.2 115H133.8c-20.9 0-37.8 16.9-37.8 37.8v37.8c0 20.9 16.9 37.8 37.8 37.8h756.4c20.9 0 37.8-16.9 37.8-37.8v-37.8c0-20.9-16.9-37.8-37.8-37.8zM890.2 455.3H398.5c-20.9 0-37.8 16.9-37.8 37.8v37.8c0 20.9 16.9 37.8 37.8 37.8h491.6c20.9 0 37.8-16.9 37.8-37.8v-37.8c0.1-20.9-16.8-37.8-37.7-37.8zM890.2 795.6H133.8c-20.9 0-37.8 16.9-37.8 37.8v37.8c0 20.9 16.9 37.8 37.8 37.8h756.4c20.9 0 37.8-16.9 37.8-37.8v-37.8c0-20.9-16.9-37.8-37.8-37.8zM266.2 600.7V423.3c0-22-29.2-33.1-46.2-17.5l-97.1 88.7c-10.6 9.7-10.6 25.3 0 35l97.1 88.7c17 15.5 46.2 4.5 46.2-17.5z" p-id="4184"></path></svg>

+ 120 - 42
src/components/pages/classroomObservation/components/chatArea.vue

@@ -556,7 +556,7 @@ import Papa from "papaparse";
 import addNewTeacherVoiceprintDialog from "./addNewTeacherVoiceprintDialog.vue";
 import * as Sy from "@/lib/shengyang";
 import Recorder from "recorder-core/recorder.mp3.min";
-
+import { fetchEventSource } from "@microsoft/fetch-event-source";
 // import { saveAs } from "file-saver";
 
 // import Recorder from 'recorder-core/recorder.wav.min'
@@ -766,7 +766,8 @@ export default {
         recorder: null,
         ws: null
       },
-      userName: ""
+      userName: "",
+      curRequestController:null,
     };
   },
   computed: {
@@ -983,26 +984,64 @@ export default {
             file_ids: this.fileId ? [this.fileId] : [],
             model: "gpt-4o-2024-11-20"
           };
-          this.ajax
-            .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
-            .then(res => {
-              if (
-                converter(res.data.FunctionResponse.result) ==
-                converter("发送成功")
-              ) {
-              } else {
-                this.$message.warning(res.data.FunctionResponse.result);
-              }
-            })
-            .catch(err => {
-              console.log(err);
-            });
-          this.getAtAuContent(
-            _uid,
-            _htmlText,
-            _item.headUrl,
-            _item.assistantName
-          );
+
+          let _addText = "";
+        const md = new MarkdownIt();
+        let _this = this;
+        // const curRequestController = new AbortController();
+         this.curRequestController = new AbortController();
+
+          fetchEventSource("https://gpt4.cocorobo.cn/ai_agent_park_chat_new_post_stream",{
+          method: "POST",
+          headers: {
+            "Content-Type": "application/json"
+          },
+          body: JSON.stringify(params),
+          signal: _this.curRequestController.signal,
+          onmessage(ev){
+            let _data = JSON.parse(ev.data);
+            if(_data.content=='[DONE]')return;
+            _addText+=_data.content;
+            _this.chatList.find(i => i.uid == _uid).aiContent =  md.render(_addText);
+            _this.chatList.find(i => i.uid == _uid).loading = false;
+            _this.scrollBottom();
+            console.log(_data)
+          },
+          onclose(){
+            _this.$forceUpdate();
+            // _this.stopTalkToken = null;
+            // _this.faloading = false;
+            _this.curRequestController = null;
+            _this.chatList.find(i => i.uid == _uid).isalltext = true;
+            _this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
+            _this.insertChat(_uid);
+            console.log("连接关闭")
+          },
+          onerror(err){
+
+            console.log("连接错误",err)
+          }
+      })
+          // this.ajax
+          //   .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
+          //   .then(res => {
+          //     if (
+          //       converter(res.data.FunctionResponse.result) ==
+          //       converter("发送成功")
+          //     ) {
+          //     } else {
+          //       this.$message.warning(res.data.FunctionResponse.result);
+          //     }
+          //   })
+          //   .catch(err => {
+          //     console.log(err);
+          //   });
+          // this.getAtAuContent(
+          //   _uid,
+          //   _htmlText,
+          //   _item.headUrl,
+          //   _item.assistantName
+          // );
         });
       } else {
         //未@角色
@@ -1029,7 +1068,7 @@ export default {
 
         // })
         _historyMessage.push({ role: "user", content: _text });
-        let params = JSON.stringify({
+        let params = {
           model: "gpt-4o-2024-11-20",
           temperature: 0,
           max_tokens: 4096,
@@ -1038,8 +1077,9 @@ export default {
           presence_penalty: 0,
           messages: _historyMessage,
           uid: _uuid,
-          mind_map_question: ""
-        });
+          mind_map_question: "",
+          stream:true
+        };
         // let params = JSON.stringify({
         // 	message: {
         // 		anthropic_version: "bedrock-2023-05-31",
@@ -1052,22 +1092,60 @@ export default {
         // 	model: "Claude 3 Sonnet", // Claude 3 Sonnet或者Claude 3 Haiku
         // });
 
-        this.ajax
-          .post("https://gpt4.cocorobo.cn/chat", params)
-          // .post("https://claude3.cocorobo.cn/chat", params)
-          .then(res => {
-            if (
-              converter(res.data.FunctionResponse.result) ==
-              converter("发送成功")
-            ) {
-            } else {
-              this.$message.warning(res.data.FunctionResponse.result);
-            }
-          })
-          .catch(e => {
-            console.log(e);
-          });
-        this.getAiContent(_uuid);
+
+        let _addText = "";
+        const md = new MarkdownIt();
+        let _this = this;
+         this.curRequestController = new AbortController();
+
+          fetchEventSource("https://gpt4.cocorobo.cn/chat_post_stream",{
+          method: "POST",
+          headers: {
+            "Content-Type": "application/json"
+          },
+          body: JSON.stringify(params),
+          signal: _this.curRequestController.signal,
+          onmessage(ev){
+            let _data = JSON.parse(ev.data);
+            if(_data.content=='[DONE]')return;
+            _addText+=_data.content;
+            _this.chatList.find(i => i.uid == _uid).aiContent =  md.render(_addText);
+            _this.chatList.find(i => i.uid == _uid).loading = false;
+            _this.scrollBottom();
+            console.log(_data)
+          },
+          onclose(){
+            _this.$forceUpdate();
+            // _this.stopTalkToken = null;
+            // _this.faloading = false;
+            _this.curRequestController = null;
+            _this.chatList.find(i => i.uid == _uid).isalltext = true;
+            _this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
+            _this.insertChat(_uid);
+            console.log("连接关闭")
+          },
+          onerror(err){
+
+            console.log("连接错误",err)
+          }
+      })
+
+        // this.ajax
+        //   .post("https://gpt4.cocorobo.cn/chat", params)
+        //   // .post("https://claude3.cocorobo.cn/chat", params)
+        //   .then(res => {
+        //     if (
+        //       converter(res.data.FunctionResponse.result) ==
+        //       converter("发送成功")
+        //     ) {
+        //     } else {
+        //       this.$message.warning(res.data.FunctionResponse.result);
+        //     }
+        //   })
+        //   .catch(e => {
+        //     console.log(e);
+        //   });
+        // this.getAiContent(_uuid);
       }
     },
     getAiContent(_uid) {
@@ -1489,7 +1567,7 @@ ${JSON.stringify(_list)}
       } else {
         _file = audioFile;
       }
-     
+
       // this.uploadFile(_file,{changeText:false,flag:true})
       // return console.log(_file);
 

+ 1 - 0
src/components/pages/test/add/components/choice/choice.vue

@@ -198,6 +198,7 @@ export default {
     },
     updateTitle() {
       this.updateList.title = true;
+       if(this.cJson.title=="标题")this.checkJson.title = ""
       this.$nextTick(() => {
         this.$refs["titleRef"].focus();
       });

+ 20 - 20
src/components/pages/test/add/edit/edit/index.vue

@@ -418,7 +418,7 @@ export default {
         };
         if (topicType == 1) {
           json.json = {
-            title: "标题",
+            title: "",
             type: 1,
             array: [
               { option: "选项1", img: "" },
@@ -428,37 +428,37 @@ export default {
           };
         } else if (topicType == 3) {
           json.json = {
-            title: "标题",
+            title: "",
             type: 1,
             answer: ""
           };
         } else if (topicType == 5) {
           json.json = {
-            title: "标题",
+            title: "",
             type: 1,
             detail: ""
           };
         } else if (topicType == 6) {
           json.json = {
-            title: "标题",
+            title: "",
             detail: "",
             courses: []
           };
         } else if (topicType == 7) {
           json.json = {
-            title: "标题",
+            title: "",
             detail: "",
             small: 0,
             big: 10
           };
         } else if (topicType == 8) {
           json.json = {
-            title: "标题",
+            title: "",
             detail: ""
           };
         } else if (topicType == 9) {
           json.json = {
-            title: "标题",
+            title: "",
             type: 1,
             array: [
               { option: "选项1", img: "" },
@@ -468,7 +468,7 @@ export default {
           };
         } else if (topicType == 10) {
           json.json = {
-            title: "标题",
+            title: "",
             type: 2,
             array: [
               { option: "选项1", img: "" },
@@ -478,12 +478,12 @@ export default {
           };
         } else if (topicType == 11) {
           json.json = {
-            title: "标题",
+            title: "",
             detail: ""
           };
         } else if (topicType == 12) {
           json.json = {
-            title: "标题",
+            title: "",
             detail: ""
           };
         }
@@ -541,7 +541,7 @@ export default {
 
           if (topicType == 1) {
             json1.json = {
-              title: "标题",
+              title: "",
               type: 1,
               array: [
                 { option: "选项1", img: "" },
@@ -551,37 +551,37 @@ export default {
             };
           } else if (topicType == 3) {
             json1.json = {
-              title: "标题",
+              title: "",
               type: 1,
               answer: ""
             };
           } else if (topicType == 5) {
             json1.json = {
-              title: "标题",
+              title: "",
               type: 1,
               detail: ""
             };
           } else if (topicType == 6) {
             json1.json = {
-              title: "标题",
+              title: "",
               detail: "",
               courses: []
             };
           } else if (topicType == 7) {
             json1.json = {
-              title: "标题",
+              title: "",
               detail: "",
               small: 0,
               big: 10
             };
           } else if (topicType == 8) {
             json1.json = {
-              title: "标题",
+              title: "",
               detail: ""
             };
           } else if (topicType == 9) {
             json1.json = {
-              title: "标题",
+              title: "",
               type: 1,
               array: [
                 { option: "选项1", img: "" },
@@ -591,7 +591,7 @@ export default {
             };
           } else if (topicType == 10) {
             json1.json = {
-              title: "标题",
+              title: "",
               type: 2,
               array: [
                 { option: "选项1", img: "" },
@@ -601,12 +601,12 @@ export default {
             };
           } else if (topicType == 11) {
             json1.json = {
-              title: "标题",
+              title: "",
               detail: ""
             };
           } else if (topicType == 12) {
             json1.json = {
-              title: "标题",
+              title: "",
               detail: ""
             };
           }

+ 1 - 1
src/components/pages/test/checkAi/aiLeader.vue

@@ -2420,7 +2420,7 @@ Instruction: Based on the context, follow "Format example", write content
 1、读取对话数据或者数据信息,了解文档中的数据内容。
 2、根据用户的需求,选择合适的可视化图表的类型(图表类型的选择可以从 图表列表 中进行筛选)根据分析的内容筛选出可以生成的图表并输出。
 3、根据图表类型确定源数据格式,确定每行每列的字段,并在对话数据中,检索相关字段的信息,进行统计。源数据表的格式可以参考知识库中“可视化图表的源数据格式”进行统计。
-4、输出结果需要与Format example格式一致,不需要输出多余的内容
+4、输出结果需要与Format example格式一致,只输出json格式的内容并且可以使用JSON.parse()转换成对象,不需要输出多余的内容
 5、如果没有合适的图表则返回空数组:'[]'
 
 ##对话数据

+ 190 - 8
src/components/pages/test/smarter.vue

@@ -84,7 +84,7 @@
                   <span @click="activeMenu = 2"  :class="{active: activeMenu === 2}"><span :class="['history_icon',{active: activeMenu === 2}]"></span></span>
                 </div>
                 <div class="fold_btn">
-                    <span class="more_icon" @click="openLeft=!openLeft"></span>
+                    <span class="more_icon" :style="`transform: rotate(${openLeft?0:180}deg);`" @click="openLeft=!openLeft"></span>
                 </div>
             </div>
             <div v-show="activeMenu == 1" style="width:100%;display: flex;">
@@ -119,7 +119,10 @@
                         </div>
                         <div v-show="fileMenu == 2" style="width: 100%;height: calc(100% - 40px)">
                             <div class="bianji_area">
-                              <Editor style="width: 100%;height: 100%;" :value="userAsk"/>
+                              <span>
+                                <img @click="downUserAsk" src="../../../assets/icon/test/down_icon.svg">
+                              </span>
+                              <Editor @change="(value)=>userAsk = value" style="width: 100%;height: 100%;" :value="userAsk"/>
                                 <!-- <span contenteditable="true" class="userAsk">{{ userAsk }}</span> -->
                                 <!-- <span class="aiText" contenteditable="true" v-html="bianjiText"></span>
                                 <span v-if="!userAsk" style="display: flex;justify-content: center;">暂无数据</span> -->
@@ -231,7 +234,8 @@ import Cascader from "./dataCom/cascader.vue";
 // import smartMenu from "./smartBox/smartMenu.vue";
 import csvTableView from "./choseCheck/csvTableView.vue";
 import Editor  from './checkAi/wangEnduit.vue';
-
+import htmlDocx from "html-docx-js/dist/html-docx";
+import { saveAs } from "file-saver";
 export default {
     name: 'smarter',
     components: {
@@ -549,7 +553,167 @@ export default {
                     });
             })
         },
-
+        async downUserAsk(){
+          // console.log(this.userAsk)
+          // console.log(this.userAsk)
+          await this.generateDocx("文案编辑",this.userAsk);
+          this.$message.success("下载成功")
+        },
+            // 导出docx
+    async generateDocx(name, html) {
+      // 将html文件中需要用到的数据挂载到store上
+      const content = `<!DOCTYPE html>
+      <html xmlns:v='urn:schemas-microsoft-com
+      :vml'xmlns:o='urn:schemas-microsoft-com:office
+      :office'xmlns:w='urn:schemas-microsoft-com:office
+      :word'xmlns:m='http://schemas.microsoft.com/office/2004/12/omml'
+      xmlns='http://www.w3.org/TR/REC-html40'
+      xmlns='http://www.w3.org/1999/xhtml'>
+      <head>
+          <meta charset="UTF-8">
+          <meta http-equiv="X-UA-Compatible" content="IE=edge">
+          <meta name="viewport" content="width=device-width, initial-scale=1.0">
+          <title>${name}</title>
+          <style>
+						*{
+							font-family: '宋体';
+							margin:0;
+							padding:0;
+							line-height:1;
+						}
+            table {
+              border-collapse: collapse; /* 折叠边框 */
+              width: 100%;
+							font-size:10.5pt;
+            }
+            th, td {
+              border: 1px solid black; /* 线条样式 */
+              padding: 8px;
+              text-align: left;
+							font-size:10.5pt;
+            }
+						ol,ul{
+							margin:0;
+							padding:0;
+							margin-right:-1in;
+						}
+						li{
+							margin-bottom:0.1in
+							margin-right:-1in;
+						}
+						p{
+							line-height:1;
+							margin:0;
+							padding:0
+						}
+						.vue-office-docx{height:100%;overflow-y:auto}
+						.vue-office-docx .docx-wrapper>section.docx{margin-bottom:5px}
+						@media screen and (max-width: 800px){
+							.vue-office-docx .docx-wrapper{padding:10px}
+							.vue-office-docx .docx-wrapper>section.docx{padding:10px!important;width:100%!important}
+						}
+
+.docx-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; }
+.docx-wrapper>section.docx { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }
+.docx { color: black; hyphens: auto; text-underline-position: from-font; }
+section.docx { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }
+section.docx>article { margin-bottom: auto; z-index: 1; }
+section.docx>footer { z-index: 1; }
+.docx table { border-collapse: collapse; }
+.docx table td, .docx table th { vertical-align: top; }
+.docx p { margin: 0pt; min-height: 1em; }
+.docx span { white-space: pre-wrap; overflow-wrap: break-word; }
+.docx a { color: inherit; text-decoration: inherit; }
+.docx svg { fill: transparent; }
+.docx {
+  --docx-majorHAnsi-font: Calibri Light;
+  --docx-minorHAnsi-font: Calibri;
+  --docx-dk1-color: #000000;
+  --docx-lt1-color: #FFFFFF;
+  --docx-dk2-color: #44546A;
+  --docx-lt2-color: #E7E6E6;
+  --docx-accent1-color: #5B9BD5;
+  --docx-accent2-color: #ED7D31;
+  --docx-accent3-color: #A5A5A5;
+  --docx-accent4-color: #FFC000;
+  --docx-accent5-color: #4472C4;
+  --docx-accent6-color: #70AD47;
+  --docx-hlink-color: #0563C1;
+  --docx-folHlink-color: #954F72;
+}
+.docx span {
+  font-family: Times New Roman;
+}
+.docx p, p.docx_1 {
+  text-align: justify;
+}
+.docx p, p.docx_1 span {
+  font-family: var(--docx-minorHAnsi-font);
+  min-height: 10.50pt;
+  font-size: 10.50pt;
+}
+.docx table, table.docx_2 td {
+  padding-top: 0.00pt;
+  padding-left: 5.40pt;
+  padding-bottom: 0.00pt;
+  padding-right: 5.40pt;
+}
+table.docx_3 p {
+  text-align: justify;
+}
+table.docx_3 td {
+  border-top: 0.50pt solid black;
+  border-left: 0.50pt solid black;
+  border-bottom: 0.50pt solid black;
+  border-right: 0.50pt solid black;
+  padding-top: 0.00pt;
+  padding-left: 5.40pt;
+  padding-bottom: 0.00pt;
+  padding-right: 5.40pt;
+}
+	p.docx-num-2-0:before {
+  content: ""counter(docx-num-2-0, decimal)"、";
+  counter-increment: docx-num-2-0;
+}
+p.docx-num-2-0 {
+  display: list-item;
+  list-style-position: inside;
+  list-style-type: none;
+}
+p.docx-num-1-0:before {
+  content: ""counter(docx-num-1-0, decimal)"、";
+  counter-increment: docx-num-1-0;
+}
+p.docx-num-1-0 {
+  display: list-item;
+  list-style-position: inside;
+  list-style-type: none;
+}
+.docx-wrapper {
+  counter-reset: docx-num-2-0 4 docx-num-1-0 0;
+}
+
+
+
+          </style>
+      </head>
+      <body>
+      ${html}
+      </body>
+      </html>`;
+      // console.log(content)
+      // return console.log(content)
+      // debugger
+      let blob = htmlDocx.asBlob(content);
+
+      // const uploadFile = new File([blob], `${name}.docx`, {
+      //   type:
+      //     "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+      // });
+      saveAs(blob, `${name}.docx`);
+      return true;
+      // this.beforeUploadHtml(uploadFile);
+    },
     },
     computed: {
         showFileUrl() {
@@ -978,13 +1142,14 @@ export default {
 }
 
 .more_icon {
-    background: url('../../../assets/icon/test/test_more.png') no-repeat;
-    background-size: 60%;
-    width: 16px;
-    height: 16px;
+    background: url('../../../assets/icon/test/test_fold.svg') no-repeat;
+    background-size: 100%;
+    width: 18px;
+    height: 18px;
     display: inline-block;
     background-size: contain;
     cursor: pointer;
+
 }
 
 .cc_b_right {
@@ -1017,6 +1182,23 @@ export default {
     margin: 0;
    width: 100%;
    height: 100%;
+   position: relative;
+}
+
+.bianji_area>span{
+  width: 25px;
+  height: 25px;
+  position: absolute;
+  right: 15px;
+  top: 8px;
+  z-index: 999;
+  /* background-color: red; */
+}
+
+.bianji_area>span>img{
+  width: 100%;
+  height: 100%;
+  cursor: pointer;
 }
 .aiText{
     margin-top:10px;

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.