ソースを参照

Merge branch 'beta' of https://git.cocorobo.cn/CocoRoboLabs/pbl-teacher-table into beta

SanHQin 10 ヶ月 前
コミット
d59261b032

+ 1 - 1
dist/index.html

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

ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.0a67150b9ca0a9c93ad6f180f979d561.css.map


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.7e365798787e2ed41229edd7c082dd1c.css


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/css/app.7e365798787e2ed41229edd7c082dd1c.css.map


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.63c436f02f1a49d07572.js


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/app.63c436f02f1a49d07572.js.map


ファイルの差分が大きいため隠しています
+ 0 - 0
dist/static/js/manifest.571c38d63f24b1ae9e16.js.map


+ 97 - 17
src/components/pages/aiAddCourse/addCourse.vue

@@ -1471,6 +1471,9 @@
                         <button class="c_pub_button_add pub_btn_add_img" @click="openSource(0)">
                           资源
                         </button>
+                        <!-- <button class="c_pub_button_add pub_btn_add_img" @click="openAiCreate(0)">
+                          AI生成
+                        </button> -->
                       </div>
                       <div v-if="
                         unitJson[unitIndex].chapterInfo[0].taskJson[
@@ -5188,6 +5191,7 @@
     </aiDialog>
     <tipsDialog :dialogVisibleTips.sync="dialogVisibleTips" :tipsJson.sync="tipsJson" :aiJson="aiJson" :userid="userid"
       @retrunCourse="retrunCourse" :templateid="templateid"></tipsDialog>
+    <aiCreateDialog :dialogVisibleAiCreate.sync="dialogVisibleAiCreate"></aiCreateDialog>
   </div>
 </template>
 
@@ -5214,6 +5218,7 @@ import aiTips from './aiTips.vue'
 import tipsDialog from './tipsDialog.vue'
 import { v4 as uuidv4 } from "uuid";
 import MarkdownIt from "markdown-it";
+import aiCreateDialog from './aiCreateDialog.vue'
 
 export default {
   components: {
@@ -5231,7 +5236,8 @@ export default {
     aiBox,
     aiDialog,
     aiTips,
-    tipsDialog
+    tipsDialog,
+    aiCreateDialog
   },
   data() {
     return {
@@ -5583,6 +5589,7 @@ export default {
         cpote4: false,
       },
       cpoteType: 0,
+      dialogVisibleAiCreate: false,
     };
   },
   directives: {
@@ -6810,6 +6817,9 @@ export default {
       this.dialogVisibleSource = true;
       this.updateSourcePan = false;
     },
+    openAiCreate(){
+      this.dialogVisibleAiCreate = true;
+    },
     addSource() {
       if (!Object.keys(this.sourceData).length) {
         this.$message.error("请选择要上传的资源");
@@ -7509,21 +7519,26 @@ export default {
             _this.infoisFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
             _this.$forceUpdate();
           })
-          .send(function (err, data) {
+          .send(async function (err, data) {
             // loading.close();
             _this.infoprogress = 100;
             _this.infoisFinishSize = _this.infoisAllSize;
             _this.$forceUpdate();
-            setTimeout(() => {
-              _this.infoproVisible = false;
-              _this.$forceUpdate();
-            }, 1000);
             _this.inputShow = true;
             if (err) {
+              setTimeout(() => {
+                _this.infoproVisible = false;
+                _this.$forceUpdate();
+              }, 1000);
               // var a = _this.$refs.upload1.uploadFiles;
               // a.splice(a.length - 1, a.length);
               _this.$message.error("上传失败");
             } else {
+              let fileid = await _this.createFileid(data.Location)
+              if(fileid){
+                _this.infoproVisible = false;
+                _this.$forceUpdate();
+              }
               if (type == 13) {
                 let _type = 2;
                 var imgA = [
@@ -7620,12 +7635,14 @@ export default {
                   url: data.Location,
                   uid: file.uid,
                   type: _type,
+                  fileid: fileid,
                 });
                 _this.unitJson[0].chapterInfo[0].taskJson[0].chapterData.push({
                   name: file.name,
                   url: data.Location,
                   uid: file.uid,
                   type: _type,
+                  fileid: fileid,
                 })
               } else if (type == 2 || type == 3 || type == 12) {
                 _this.infoData.push({
@@ -7633,15 +7650,18 @@ export default {
                   url: data.Location,
                   uid: file.uid,
                   type: type,
+                  fileid: fileid,
                 });
                 _this.unitJson[0].chapterInfo[0].taskJson[0].chapterData.push({
                   name: file.name,
                   url: data.Location,
                   uid: file.uid,
                   type: type,
+                  fileid: fileid,
                 })
               }
               console.log(data.Location);
+              console.log(fileid);
             }
           });
       }
@@ -12760,6 +12780,17 @@ export default {
           }
         }
       }
+      let mclass = []
+      if (this.courseTypeId.length) {
+        for (var i = 0; i < this.courseTypeId.length; i++) {
+          let _sid = this.courseTypeId[i]
+          for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+            if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+              mclass.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+            }
+          }
+        }
+      }
       if (type == "aiDetail") {
         if (this.ttextLoading) {
           this.$message({
@@ -12913,6 +12944,17 @@ export default {
           }
         }
       }
+      let mclass = []
+      if (this.courseTypeId.length) {
+        for (var i = 0; i < this.courseTypeId.length; i++) {
+          let _sid = this.courseTypeId[i]
+          for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+            if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+              mclass.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+            }
+          }
+        }
+      }
       let url = []
       if (this.infoData.length) {
         for (var i = 0; i < this.infoData.length; i++) {
@@ -12923,6 +12965,7 @@ export default {
         this.detailYou(msg)
       } else if (this.aitype == "aiOutline") {
         this.loading = true
+// ${this.getListClassC(this.checkboxList2) ?  '班级:' + this.getListClassC(this.checkboxList2) : "无"}
         let message = `NOTICE
 Role: 作为学生的学习指导Agent,你熟悉熟悉PBL(基于问题的学习)和5EX教学模型,能够根据学生的学情数据(当前的学习任务设计、学习表现数据、作业数据等)生成自适应的学习任务和对应的5道考核题目。
 ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
@@ -12930,15 +12973,14 @@ Instruction: Based on the context, follow "Format example", write content.
 
 # Context
 ## 要求 
-${msg} **你需要使用C-POTE教学活动设计框架,其定义参考#补充参考资料 中的C-POTE**。以及##补充参考资料和##参考资料,
+${msg} 以及##补充参考资料和##参考资料,
 然后根据Format example的要求返回要以数组的格式
 
 ## 参考资料
 课程名字:${this.courseName}
-课程简要描述:${this.courseText ? this.courseText : '暂无'}
-学科:${sub.length ? sub.join(",") : "无"}
-班级:${this.getListClassC(this.checkboxList2)}
-
+${this.courseText ? '课程简要描述:' + this.courseText : ''}
+${sub.length ? '学科:' + sub.join(",") : ''}
+${mclass.length ? '面向年级:' + mclass.join(",") : ''}
 
 ## 补充参考资料
 补充资料:${url.join(",")}
@@ -13128,21 +13170,32 @@ ${_text}
           }
         }
       }
+      let mclass = []
+      if (this.courseTypeId.length) {
+        for (var i = 0; i < this.courseTypeId.length; i++) {
+          let _sid = this.courseTypeId[i]
+          for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+            if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+              mclass.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+            }
+          }
+        }
+      }
       let url = []
       if (this.infoData.length) {
         for (var i = 0; i < this.infoData.length; i++) {
           url.push(this.infoData[i].url)
         }
       }
+// ${this.getListClassC(this.checkboxList2) ?  '班级:' + this.getListClassC(this.checkboxList2) : "无"}
       let msg = `
 ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
 
 --------
 ## 参考资料
 课程名字:${this.courseName}
-课程简要描述:${this.courseText ? this.courseText : '暂无'}
-学科:${sub.length ? sub.join(",") : "无"}
-班级:${this.getListClassC(this.checkboxList2)}
+${sub.length ? '学科:' + sub.join(",") : ''}
+${mclass.length ? '面向年级:' + mclass.join(",") : ''}
 
 --------
 ## 补充参考资料
@@ -14108,6 +14161,18 @@ ${_this.aiCallBack}
           }
         }
       }
+      let mclass = []
+      if (this.courseTypeId.length) {
+        for (var i = 0; i < this.courseTypeId.length; i++) {
+          let _sid = this.courseTypeId[i]
+          for (var j = 0; j < this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'].length; j++) {
+            if (_sid == this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].id) {
+              mclass.push(this.CourseTypeJson['34628934-d02f-11ec-8c78-005056b86db5'][j].name)
+            }
+          }
+        }
+      }
+// ${this.getListClassC(this.checkboxList2) ?  '班级:' + this.getListClassC(this.checkboxList2) : "无"}
       let messages = `
 ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
 
@@ -14117,9 +14182,9 @@ ${this.cpote[_index] ? '## 优化内容\n'+this.cpote[_index] : ''}
 
 ## 参考资料
 课程名字:${this.courseName}
-课程简要描述:${this.courseText ? this.courseText : '暂无'}
-学科:${sub.length ? sub.join(",") : "无"}
-班级:${this.getListClassC(this.checkboxList2)}`
+${this.courseText ? '课程简要描述:' + this.courseText : ''}
+${sub.length ? '学科:' + sub.join(",") : ''}
+${mclass.length ? '面向年级:' + mclass.join(",") : ''}`
       _this.cpoteLoading[_index] = true
       _this.cpotetLoading[_index] = true
       let _uuid = uuidv4();
@@ -14209,6 +14274,21 @@ ${this.cpote[_index] ? '## 优化内容\n'+this.cpote[_index] : ''}
         }
       };
     },
+    createFileid(url) {
+      let _this = this
+      return new Promise((resolve, reject) => {
+        _this.ajax
+          .put("https://gpt4.cocorobo.cn/upload_file_knowledge", {
+            url: url,
+          })
+          .then((res) => {
+            let _data = res.data.FunctionResponse;
+            if (_data.result && _data.result.id) {
+              resolve(_data.result.id)
+            }
+          })
+      });
+    }
   },
   beforeDestroy() {
     clearTimeout(this.timer);

+ 151 - 0
src/components/pages/aiAddCourse/aiCreateDialog.vue

@@ -0,0 +1,151 @@
+<template>
+    <el-dialog title="AI生成" :visible.sync="dialogVisibleAiCreate" :append-to-body="true" width="650px" :before-close="handleClose"
+        class="dialog_diy">
+        <div style="height: 100%;padding:15px">
+            <div class="t_box">
+                <span>选择:</span>
+                <el-radio-group v-model="radio">
+                    <el-radio :label="0">PPT</el-radio>
+                    <el-radio :label="1">教案</el-radio>
+                    <el-radio :label="2">视频</el-radio>
+                </el-radio-group>
+            </div>
+            <div class="t_box">
+                <span>提示词:</span>
+                <textarea rows="10" class="binfo_input binfo_textarea" cols placeholder="请输入提示词"
+                    v-model="detail"></textarea>
+            </div>
+            
+        </div>
+        <span slot="footer" class="dialog-footer">
+            <el-button @click="confirm" type="primary">确 定</el-button>
+            <el-button @click="close">关 闭</el-button>
+        </span>
+    </el-dialog>
+</template>
+  
+<script>
+
+export default {
+    props: {
+        dialogVisibleAiCreate: {
+            type: Boolean,
+            default: false
+        },
+    },
+    data() {
+        return {
+            radio: 0,
+            detail: ""
+        }
+    },
+    watch:{
+        dialogVisibleAiCreate(newValue, oldValue) {
+            if(newValue){
+                this.text = JSON.parse(JSON.stringify(this.aiText))
+                if(this.clickType == 2){
+                    this.confirm();
+                }
+            }
+        },
+    },
+    methods: {
+        handleClose(done) {
+            this.close()
+            done();
+        },
+        close() {
+            this.$emit('update:dialogVisibleAiCreate', false)
+        },
+        confirm(){
+            this.$emit("aiConfirm",this.text);
+            this.$emit('update:dialogVisibleAiCreate', false)
+        }
+    },
+}
+</script>
+  
+<style scoped>
+.dialog_diy>>>.el-dialog {
+    height: auto;
+    margin: 15vh auto 0 !important;
+}
+
+.dialog_diy>>>.el-dialog__header {
+    background: #454545 !important;
+    padding: 15px 20px;
+}
+
+.dialog_diy>>>.el-dialog__body {
+    height: calc(100% - 124px);
+    box-sizing: border-box;
+    padding: 0px;
+}
+
+
+.dialog_diy>>>.el-dialog__title {
+    color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn {
+    top: 19px;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
+    color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
+    color: #fff;
+}
+
+
+.dialog_diy>>>.el-dialog__body,
+.dialog_diy>>>.el-dialog__footer {
+    background: #fafafa;
+}
+
+.binfo_input {
+    width: 100%;
+    margin: 0;
+    padding: 5px 7px;
+    display: block;
+    min-width: 0;
+    outline: none;
+    box-sizing: border-box;
+    background: none;
+    border: none;
+    border-radius: 4px;
+    background: #fff;
+    font-size: 15px;
+    resize: none;
+    font-family: "Microsoft YaHei";
+    min-height: 48px;
+    /* border: 1px solid #3682fc00; */
+    border: 1.5px solid #cad1dc;
+}
+
+.binfo_textarea {
+    border: 1.5px solid #cad1dc;
+    font-size: 15px;
+    resize: none;
+    /* background: #f6f6f6; */
+    font-family: "Microsoft YaHei";
+}
+
+.binfo_input:focus-visible {
+    border: 1.5px solid #3681fc !important;
+}
+
+
+.t_box {
+    display: flex;
+    margin-bottom: 15px;
+}
+
+.t_box>span:nth-child(1) {
+    min-width: 80px;
+    font-size: 16px;
+    color: #000;
+}
+</style>

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません