Browse Source

Merge branch 'beta'

lsc 1 year ago
parent
commit
5957b57a15

+ 1 - 1
dist/index.html

@@ -32,7 +32,7 @@
       width: 100%;
       width: 100%;
       background: #e6eaf0;
       background: #e6eaf0;
       font-family: '黑体';
       font-family: '黑体';
-    }</style><link href=./static/css/app.d849c0e2bbc086d57a12c8b7570f8b7c.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.2485ee65a402fb60e5a9.js></script><script type=text/javascript src=./static/js/app.d8efae4ad550e17e5c04.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.854f119a5bb58743bf6d1fc4108802ca.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.2485ee65a402fb60e5a9.js></script><script type=text/javascript src=./static/js/app.f0593d34540bacec8d2a.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {
     document.documentElement.addEventListener("touchstart", function (event) {

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


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


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


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


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


File diff suppressed because it is too large
+ 784 - 228
src/components/pages/aiAddCourse/addCourse.vue


+ 13 - 3
src/components/pages/aiAddCourse/aiDialog.vue

@@ -6,10 +6,15 @@
                 <span :class="{active: type == 1}">基础创建</span>
                 <span :class="{active: type == 1}">基础创建</span>
             </div>
             </div>
             <div class="ai_detail" v-if="type == 1">
             <div class="ai_detail" v-if="type == 1">
-                <span class="title">默认的提示词</span>
+                <span class="title">{{text2 ? '生成任务提示词' : '默认的提示词'}}</span>
                 <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text"
                 <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text"
                       placeholder="请输入...."></textarea>
                       placeholder="请输入...."></textarea>
             </div>
             </div>
+            <div class="ai_detail" v-if="text2 && type == 1" style="margin-top: 10px;">
+                <span class="title">生成大纲描述提示词</span>
+                <textarea rows="10" class="binfo_input binfo_textarea" cols v-model="text2"
+                      placeholder="请输入...."></textarea>
+            </div>
         </div>
         </div>
         <span slot="footer" class="dialog-footer">
         <span slot="footer" class="dialog-footer">
             <el-button @click="confirm" type="primary">确 定</el-button>
             <el-button @click="confirm" type="primary">确 定</el-button>
@@ -29,6 +34,9 @@ export default {
         aiText: {
         aiText: {
             type: String,
             type: String,
         },
         },
+        aiText2: {
+            type: String,
+        },
         clickType: {
         clickType: {
             type: Number
             type: Number
         }
         }
@@ -36,13 +44,15 @@ export default {
     data() {
     data() {
         return {
         return {
             type: 1,
             type: 1,
-            text: ""
+            text: "",
+            text2: "",
         }
         }
     },
     },
     watch:{
     watch:{
         dialogVisibleAiD(newValue, oldValue) {
         dialogVisibleAiD(newValue, oldValue) {
             if(newValue){
             if(newValue){
                 this.text = JSON.parse(JSON.stringify(this.aiText))
                 this.text = JSON.parse(JSON.stringify(this.aiText))
+                this.text2 = this.aiText2 ? JSON.parse(JSON.stringify(this.aiText2)) : ''
                 if(this.clickType == 2){
                 if(this.clickType == 2){
                     this.confirm();
                     this.confirm();
                 }
                 }
@@ -58,7 +68,7 @@ export default {
             this.$emit('update:dialogVisibleAiD', false)
             this.$emit('update:dialogVisibleAiD', false)
         },
         },
         confirm(){
         confirm(){
-            this.$emit("aiConfirm",this.text);
+            this.$emit("aiConfirm",this.text,this.text2);
             this.$emit('update:dialogVisibleAiD', false)
             this.$emit('update:dialogVisibleAiD', false)
         }
         }
     },
     },

+ 139 - 44
src/components/pages/classroomObservation/components/chatArea.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-  <div class="chatArea" v-loading="loading" :element-loading-text="loadingText">
+  <div class="chatArea" v-loading="loading">
     <div class="m-operation">
     <div class="m-operation">
       <div>实时转录</div>
       <div>实时转录</div>
       <div>{{ createTime }}</div>
       <div>{{ createTime }}</div>
@@ -60,7 +60,7 @@
         @change="changeEditor"
         @change="changeEditor"
       >
       >
         <el-button
         <el-button
-          style="position: absolute; bottom: 70px; right: 20px; z-index: 10002"
+          style="position: absolute; bottom: 20px; right: 100px; z-index: 10002"
           type="primary"
           type="primary"
           @click.stop="generateActionTypesMap"
           @click.stop="generateActionTypesMap"
           >自动编码</el-button
           >自动编码</el-button
@@ -378,6 +378,42 @@
       </div>
       </div>
       <!-- <el-progress style="width:80%" :text-inside="true" :stroke-width="24" :percentage="progressData.value"></el-progress> -->
       <!-- <el-progress style="width:80%" :text-inside="true" :stroke-width="24" :percentage="progressData.value"></el-progress> -->
     </div>
     </div>
+    <div class="chatAreaLoading" v-else-if="jobContext">
+      <div class="cal_box" :style="{ height: 'fit-content' }">
+        <el-progress
+          type="circle"
+          :percentage="jobContext.progress.percentage"
+          :color="jobContext.status === 'paused' ? '#ff4949' : '#20a0ff'"
+          :format="() => `${jobContext.progress.current}/${jobContext.progress.total}`"
+        ></el-progress>
+        <span v-if="jobContext.status === 'paused' && jobContext.error">{{
+          jobContext.error
+        }}</span>
+        <div :style="{ display: 'flex' }">
+          <el-button
+            v-if="jobContext.status === 'paused'"
+            @click="() => jobContext.restart()"
+            icon="el-icon-video-play"
+            type="primary"
+          >
+            继续
+          </el-button>
+          <!-- <el-button
+            v-if="jobContext.status === 'running'"
+            icon="el-icon-video-pause"
+            @click="() => jobContext.pause()"
+            >暂停</el-button
+          > -->
+          <el-button
+            type="danger"
+            icon="el-icon-switch-button"
+            @click="() => jobContext.stop()"
+            >终止</el-button
+          >
+        </div>
+      </div>
+      <!-- <el-progress style="width:80%" :text-inside="true" :stroke-width="24" :percentage="progressData.value"></el-progress> -->
+    </div>
   </div>
   </div>
 </template>
 </template>
 
 
@@ -408,6 +444,23 @@ import _ from "lodash";
 // 	console.log('当前录音的总数据([DataView, DataView...])', params.data);
 // 	console.log('当前录音的总数据([DataView, DataView...])', params.data);
 // 	console.log('--------------END---------------')
 // 	console.log('--------------END---------------')
 // };
 // };
+const OPTIONS_GROUP = {
+  default: [
+    "老师讲课",
+    "老师提问或点名",
+    "老师板书或操作",
+    "老师评价或反馈",
+    "老师其他",
+    "学生发言",
+    "学生小组活动",
+    "学生自主学习",
+    "学生汇报分享",
+    "学生其他",
+  ],
+};
+const ATTENTION_GROUP = {
+  default: "先根据说话人角色判断,再在对应角色的选项中选择选项",
+};
 
 
 // 自定义指令,用于处理点击外部区域的事件
 // 自定义指令,用于处理点击外部区域的事件
 const clickOutside = {
 const clickOutside = {
@@ -503,7 +556,6 @@ export default {
       languageRadio: 2, //设置选择语言
       languageRadio: 2, //设置选择语言
       languageShow: false, //控制显示
       languageShow: false, //控制显示
       loading: false,
       loading: false,
-      loadingText: undefined,
       chatLoading: false,
       chatLoading: false,
       transcriptionLoading: false,
       transcriptionLoading: false,
       uploadFileLoading: false,
       uploadFileLoading: false,
@@ -576,6 +628,7 @@ export default {
       },
       },
       chatList: [],
       chatList: [],
       actionTypesMap: {},
       actionTypesMap: {},
+      jobContext: null,
     };
     };
   },
   },
   computed: {
   computed: {
@@ -598,16 +651,14 @@ export default {
     },
     },
     tid: {
     tid: {
       async handler(tid) {
       async handler(tid) {
-        console.log("tid handle: ", tid);
         if (!tid) {
         if (!tid) {
           this.actionTypesMap = undefined;
           this.actionTypesMap = undefined;
           return;
           return;
         }
         }
         this.actionTypesMap = await this.loadActionTypesMap();
         this.actionTypesMap = await this.loadActionTypesMap();
-        console.log("result: ", this.actionTypesMap);
         if (!this.actionTypesMap) {
         if (!this.actionTypesMap) {
           const res = await this.insertActionTypes();
           const res = await this.insertActionTypes();
-          console.log("res: ", res);
+          this.actionTypesMap = await this.loadActionTypesMap();
         }
         }
       },
       },
       immediate: true,
       immediate: true,
@@ -2136,7 +2187,7 @@ ${JSON.stringify(_list)}
 				</table>
 				</table>
 				`;
 				`;
       }
       }
-      console.log(_content);
+      // console.log(_content);
       this.editorBarData = { ..._editorBarData, content: _content };
       this.editorBarData = { ..._editorBarData, content: _content };
     },
     },
     // 获取对话记录
     // 获取对话记录
@@ -2271,18 +2322,8 @@ ${JSON.stringify(_list)}
       const key = "default";
       const key = "default";
       const appToken = "app-zOMxBqyEKoJSvW10e5SS0kgj";
       const appToken = "app-zOMxBqyEKoJSvW10e5SS0kgj";
       // the default options
       // the default options
-      const options = [
-        "老师讲课",
-        "老师提问或点名",
-        "老师板书或操作",
-        "老师评价或反馈",
-        "老师其他",
-        "学生发言",
-        "学生小组活动",
-        "学生自主学习",
-        "学生汇报分享",
-        "学生其他",
-      ];
+      const options = OPTIONS_GROUP[key];
+      const attention = ATTENTION_GROUP[key];
       const config = {
       const config = {
         headers: {
         headers: {
           Authorization: `Bearer ${appToken}`,
           Authorization: `Bearer ${appToken}`,
@@ -2293,31 +2334,51 @@ ${JSON.stringify(_list)}
       const div = document.createElement("div");
       const div = document.createElement("div");
       div.innerHTML = content;
       div.innerHTML = content;
       const tableRows = _.slice(div.querySelectorAll(`table tbody tr`), 1);
       const tableRows = _.slice(div.querySelectorAll(`table tbody tr`), 1);
-      if (!tableRows.length) {
+      if (!tableRows.length || tableRows[0].cells.length < 7) {
         this.$notify.info("没有可编码的内容");
         this.$notify.info("没有可编码的内容");
         return;
         return;
       }
       }
-      tableRows.forEach((i) => {
-        while (i.cells.length >= 7) {
-          i.removeChild(i.lastElementChild);
-        }
-      });
-      this.loading = true;
-      this.loadingText = `0/${tableRows.length}`;
-      try {
-        const chunkSize = 200;
-        this.actionTypesMap.jsonData[key] = Array.from({ length: tableRows.length });
-        // action type fetch by every { chunkSize } rows
-        for (const [index, rows] of _.chunk(tableRows, chunkSize).entries()) {
+      const ctrl = new AbortController();
+      this.jobContext = {
+        ctrl,
+        status: "running",
+        restart: () => {},
+        pause: () => {},
+        stop: () => {
+          const err = new Error();
+          err.name = "StopError";
+          this.jobContext.ctrl.abort(err);
+        },
+        progress: {
+          current: 0,
+          currentSize: 0,
+          total: tableRows.length,
+          percentage: 0,
+        },
+      };
+      // large chunk size will cause token limit and slower
+      const chunkSize = 30;
+      this.actionTypesMap.jsonData[key] = Array.from({ length: tableRows.length }).fill(
+        ""
+      );
+
+      const jobs = _.chunk(tableRows, chunkSize).map((rows, index) => {
+        return async (pauseSignal) => {
+          this.jobContext.progress.current = index * chunkSize;
+          this.jobContext.progress.currentSize = rows.length;
+          this.jobContext.progress.percentage =
+            ((index * chunkSize) / tableRows.length) * 100;
           const res = await fetch("https://dify.cocorobo.cn/v1/workflows/run", {
           const res = await fetch("https://dify.cocorobo.cn/v1/workflows/run", {
+            signal: AbortSignal.any([this.jobContext.ctrl.signal, pauseSignal]),
             method: "POST",
             method: "POST",
             body: JSON.stringify({
             body: JSON.stringify({
               inputs: {
               inputs: {
                 // PERF better to just include `role` and `content` to minimize token cost
                 // PERF better to just include `role` and `content` to minimize token cost
-                rows: rows
-                  .map((r) => `${r.cells[3].textContent}\t${r.cells[5].textContent}`)
-                  .join("\n"),
+                rows: JSON.stringify(
+                  rows.map((r) => [r.cells[3].textContent, r.cells[5].textContent])
+                ),
                 options: options.join(","),
                 options: options.join(","),
+                attention,
               },
               },
               response_mode: "blocking",
               response_mode: "blocking",
               user: this.userId,
               user: this.userId,
@@ -2325,9 +2386,12 @@ ${JSON.stringify(_list)}
             ...config,
             ...config,
           }).then((res) => res.json());
           }).then((res) => res.json());
           const error = _.get(res, ["data", "error"], null);
           const error = _.get(res, ["data", "error"], null);
+          // test
+          // throw new Error('mock error');
           if (error) {
           if (error) {
-            this.$notify.error(error);
-            return;
+            const err = new Error(error);
+            err.name = "DifyError";
+            throw err;
           }
           }
           const chunkResult = _.get(res, ["data", "outputs", "result"], []);
           const chunkResult = _.get(res, ["data", "outputs", "result"], []);
           this.actionTypesMap.jsonData[key].splice(
           this.actionTypesMap.jsonData[key].splice(
@@ -2339,15 +2403,46 @@ ${JSON.stringify(_list)}
             transcriptionData: this.transcriptionData.content,
             transcriptionData: this.transcriptionData.content,
             editorBarData: this.editorBarData,
             editorBarData: this.editorBarData,
           });
           });
-          this.loadingText = `${index * chunkSize + rows.length}/${tableRows.length}`;
+        };
+      });
+      while (!this.jobContext.ctrl.signal.aborted && jobs.length > 0) {
+        const job = jobs.shift();
+        while (!this.jobContext.ctrl.signal.aborted) {
+          const pauseCtrl = new AbortController();
+          this.jobContext.pause = () => {
+            const err = new Error();
+            err.name = "PauseError";
+            pauseCtrl.abort(err);
+          };
+          try {
+            await job(pauseCtrl.signal);
+            break;
+          } catch (err) {
+            // console.error(err);
+            if (err.name === "StopError") {
+              break;
+            }
+            this.jobContext.status = "paused";
+            if (err.name === "PauseError") {
+              this.jobContext.error = `用户暂停`;
+            } else {
+              this.jobContext.error = `部分生成失败。点击按钮可继续尝试生成`;
+            }
+            try {
+              const restartPromise = new Promise((resolve, reject) => {
+                this.jobContext.restart = resolve;
+                this.jobContext.ctrl.signal.addEventListener("abort", reject);
+              });
+              await restartPromise;
+              this.jobContext.status = "running";
+              this.jobContext.error = null;
+            } catch (_err) {
+              // nothing to do, just continue
+            }
+          }
         }
         }
-      } catch (err) {
-        console.error(err);
-        this.$notify.error(err);
-      } finally {
-        this.loading = false;
-        this.loadingText = undefined;
       }
       }
+      this.jobContext = null;
     },
     },
   },
   },
   mounted() {},
   mounted() {},

+ 17 - 40
src/components/pages/test/aggregate/index.vue

@@ -5,7 +5,6 @@
       border
       border
       max-height="750px"
       max-height="750px"
       v-loading="tabLoading"
       v-loading="tabLoading"
-      @header-click="handleHeaderClick"
     >
     >
       <el-table-column
       <el-table-column
         fixed
         fixed
@@ -58,7 +57,9 @@
                   :content="e.title"
                   :content="e.title"
                   placement="top"
                   placement="top"
                 >
                 >
-                  <div class="tooltipTit">{{ e.title }}</div>
+                  <div class="tooltipTit" @click="goFrom2(column)">
+                    {{ e.title }}
+                  </div>
                 </el-tooltip>
                 </el-tooltip>
               </template>
               </template>
               <template slot-scope="scope">
               <template slot-scope="scope">
@@ -232,36 +233,19 @@ export default {
     handleClose2(done) {
     handleClose2(done) {
       done();
       done();
     },
     },
-    // 点击表头跳转
-    handleHeaderClick(column, event) {
-      console.log("表头被点击", column, event);
-
-      let titData = this.titList.map(e => {
-        return e.name;
-      });
-
-      if (
-        column.label == "教研室" ||
-        column.label == "教师姓名" ||
-        column.label == "序号" ||
-        titData.includes(column.label)
-      ) {
-      } else {
-        this.$router.push(
-          "/checkToTest?cid=" +
-            column.property +
-            "&oid=" +
-            this.oid +
-            "&org=" +
-            this.org +
-            "&type=" +
-            2 +
-            "&role=" +
-            this.role
-        );
-      }
-
-      // 在这里处理点击事件
+    goFrom2(column) {
+      this.$router.push(
+        "/checkToTest?cid=" +
+          column.property +
+          "&oid=" +
+          this.oid +
+          "&org=" +
+          this.org +
+          "&type=" +
+          2 +
+          "&role=" +
+          this.role
+      );
     }
     }
   }
   }
 };
 };
@@ -334,12 +318,5 @@ export default {
   text-overflow: ellipsis;
   text-overflow: ellipsis;
   height: 50px !important;
   height: 50px !important;
 }
 }
-.aggregate >>> .el-table th > .cell {
-  /* -webkit-line-clamp: 2;
-  display: -webkit-box;
-  -webkit-box-orient: vertical;
-  overflow: hidden;
-  text-overflow: ellipsis;
-  height: 50px !important; */
-}
+
 </style>
 </style>

+ 30 - 6
src/components/pages/test/check/index.vue

@@ -1033,8 +1033,32 @@ export default {
       this.ajax
       this.ajax
           .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
           .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
           .then((res) => {
           .then((res) => {
+            console.log('this.TeachingOptions',this.TeachingOptions);
+            console.log(res.data);
+            let data = res.data[0];
+            this.TeachingOptions.forEach(e=>{
+              data.forEach(i=>{
+                if (e.id == i.id) {
+                  e.name = i.name
+                }
+              })
+            })
+          })
+          .catch((err) => {
+              this.isLoading = false;
+              console.error(err);
+          });
+    },
+    getClass3() {
+      let params = {
+          oid: this.oid,
+      };
+      this.ajax
+          .get(this.$store.state.api + "selectTeacherOfficeBySchool", params)
+          .then((res) => {
+            console.log(res.data);
               this.TeachingOptions = res.data[0];
               this.TeachingOptions = res.data[0];
-              console.log('this.TeachingOptions',this.TeachingOptions);
+              // console.log('this.TeachingOptions',this.TeachingOptions);
           })
           })
           .catch((err) => {
           .catch((err) => {
               this.isLoading = false;
               this.isLoading = false;
@@ -1161,15 +1185,15 @@ export default {
           console.log('this.testJson',JSON.parse(JSON.stringify(this.testJson)));
           console.log('this.testJson',JSON.parse(JSON.stringify(this.testJson)));
           if (this.testJson.juriP) {
           if (this.testJson.juriP) {
             let ajuri2 =  this.testJson.juri2.split (',');
             let ajuri2 =  this.testJson.juri2.split (',');
-            let ajurip =  this.testJson.juriP.split (',');
-            let JData = ajuri2.reverse()
-            this.TeachingOptions = JData.map((key, index) => ({
+            this.TeachingOptions = ajuri2.map((key, index) => ({
               id : key,
               id : key,
-              name: ajurip[index]
+              name: ''
             }));
             }));
-          }else{
             this.getClass2()
             this.getClass2()
+          }else{
+            this.getClass3()
           }
           }
+
           // console.log('dddd',this.TeachingOptions);
           // console.log('dddd',this.TeachingOptions);
 
 
           this.works = res.data[1]
           this.works = res.data[1]

+ 20 - 1
src/components/pages/testPerson/test/test.vue

@@ -46,6 +46,10 @@
                             <span>创建者:{{ item.username }}</span>
                             <span>创建者:{{ item.username }}</span>
                         </el-tooltip>
                         </el-tooltip>
                     </div>
                     </div>
+                    <div class="editBtn2" :style="`${item.open?'display:flex':''}`" v-if="!item.carray.length > 0">
+                        <span v-if="item.array.length === 0">去填写</span>
+                        <span v-else>再填一份</span>
+                    </div>
                     <div @click="doTest2(item.courseid)" class="editBtn" :style="`${item.open?'display:flex':''}`" v-if="!item.carray.length > 0">
                     <div @click="doTest2(item.courseid)" class="editBtn" :style="`${item.open?'display:flex':''}`" v-if="!item.carray.length > 0">
                         <span v-if="item.array.length === 0">去填写</span>
                         <span v-if="item.array.length === 0">去填写</span>
                         <span v-else>再填一份</span>
                         <span v-else>再填一份</span>
@@ -776,6 +780,9 @@ export default {
 .test_panel_title:hover>.editBtn{
 .test_panel_title:hover>.editBtn{
 	display: flex;
 	display: flex;
 }
 }
+.test_panel_title:hover>.editBtn2{
+	display: flex;
+}
 
 
 
 
 .test_panel+.test_panel {
 .test_panel+.test_panel {
@@ -787,6 +794,7 @@ export default {
     display: flex;
     display: flex;
     align-items: center;
     align-items: center;
     width: 100%;
     width: 100%;
+    position: relative;
     /* justify-content: space-between; */
     /* justify-content: space-between; */
     /* padding: 0 20px; */
     /* padding: 0 20px; */
     box-sizing: border-box;
     box-sizing: border-box;
@@ -876,7 +884,18 @@ export default {
     align-items: center;
     align-items: center;
     padding: 0 15px;
     padding: 0 15px;
     cursor: pointer;
     cursor: pointer;
-
+    position: absolute;
+    right: 0;
+}
+.test_panel_title>.editBtn2 {
+    font-size: 16px;
+    color: #fff;
+    background: #3681fc;
+    height: 100%;
+    display: none;
+    align-items: center;
+    padding: 0 15px;
+    cursor: pointer;
 }
 }
 
 
 .test_panel_title>.time>span+span {
 .test_panel_title>.time>span+span {

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