lsc 11 月之前
父節點
當前提交
1f85ca7992

+ 1 - 1
dist/index.html

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

文件差異過大導致無法顯示
+ 0 - 0
dist/static/css/app.b15c606c2c3c75d23446067eca1a80a0.css


文件差異過大導致無法顯示
+ 0 - 0
dist/static/css/app.b15c606c2c3c75d23446067eca1a80a0.css.map


二進制
dist/static/img/aiAvatar.237f433.png


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.8824253937bc506613d1.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/app.8824253937bc506613d1.js.map


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/manifest.571c38d63f24b1ae9e16.js.map


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/vendor.2083f798ac1be94cad3d.js


文件差異過大導致無法顯示
+ 0 - 0
dist/static/js/vendor.2083f798ac1be94cad3d.js.map


+ 207 - 8
src/components/pages/aiAddCourse/addCourse.vue

@@ -645,12 +645,12 @@
                       <input type="text" placeholder="输入任务名称" class="binfo_input" style="border-radius: 4px"
                         v-model="item.task" />
                     </div>
-                    <div class="outline_detail">
+                    <div class="outline_detail" v-loading="taskDetailLoading.indexOf('task-'+index) !== -1">
                       <textarea v-autoHeight="100" rows="4" class="binfo_input binfo_textarea" cols
                         placeholder="请输入任务描述" v-model="item.taskDetail2"></textarea>
                       <div class="op_box">
                         <div class="op_remark">*可以将需要优化的建议添加在任务描述后,点击“智能优化”,自动进行修改</div>
-                        <div class="r_pub_button_op">智能优化</div>
+                        <div class="r_pub_button_op" @click="aiDetail(item.taskDetail2, index)">智能优化</div>
                       </div>
                     </div>
                   </div>
@@ -1463,7 +1463,7 @@
                             <div v-if="
                               easyArray.indexOf(unitJson[unitIndex].easy) ==
                               -1
-                            " style="margin-top: 20px" class="op_task_box">
+                            " style="margin-top: 20px" class="op_task_box" v-loading="taskDetailLoading2.indexOf('task-'+itemTaskIndex) !== -1">
                               <!-- <editor-bar class="addEditor" style="margin: 0" placeholder="请输入任务描述" v-model="unitJson[unitIndex].chapterInfo[0].taskJson[
                                   itemTaskIndex
                                 ].taskDetail
@@ -1480,7 +1480,9 @@
                                   "></textarea> -->
                               <div class="op_box">
                                 <div class="op_remark">*可以将需要优化的建议添加在任务描述后,点击“智能优化”,自动进行修改</div>
-                                <div class="r_pub_button_op">智能优化</div>
+                                <div class="r_pub_button_op" @click="aiDetail2(unitJson[unitIndex].chapterInfo[0].taskJson[
+                                  itemTaskIndex
+                                ].taskDetail, itemTaskIndex)">智能优化</div>
                               </div>
                             </div>
                           </div>
@@ -3129,7 +3131,7 @@
                                 </div>
                               </div>
                               <!-- v-show="!itemTool.isFold3" -->
-                              <div class="op_tool_box">
+                              <div class="op_tool_box" v-loading="taskDetailLoading3.indexOf('task-'+itemTaskIndex+toolIndex) !== -1">
                                 <textarea rows="2" v-autoHeight="70" type="text" placeholder="添加工具描述"
                                   class="binfo_input" style="
                                     margin: 0 0 20px 0;
@@ -3137,7 +3139,7 @@
                                   " v-model="itemTool.toolDetail"></textarea>
                                 <div class="op_box">
                                   <div class="op_remark">*可以将需要优化的建议添加在工具描述后,点击“智能优化”,自动进行修改</div>
-                                  <div class="r_pub_button_op">智能优化</div>
+                                  <div class="r_pub_button_op" @click="aiDetail3(itemTool.toolDetail, itemTaskIndex, toolIndex)">智能优化</div>
                                 </div>
                               </div>
                             </div>
@@ -3422,7 +3424,7 @@
                             </div>
                           </div>
                         </div>
-                        <div class="elist_css" v-if="!(unitJson[unitJson.length - 1].easy == 4)">
+                        <div class="elist_css" v-if="!(unitJson[unitJson.length - 1].easy == 4)" v-loading="taskDetailLoading4.indexOf('task-'+itemTaskIndex) !== -1">
                           <div class="elist_title">
                             <div style="
                                 display: flex;
@@ -3431,7 +3433,7 @@
                                 margin: 20px 0;
                               ">
                               <div class="lineTitle clineTitle">评价设置</div>
-                              <div class="r_pub_button_op" style="margin-left:auto;">智能优化</div>
+                              <div class="r_pub_button_op" style="margin-left:auto;" @click="aiDetail4(itemTask.eList, itemTaskIndex)">智能优化</div>
                               <!-- <div class="line" style="width: 90%"></div> -->
                             </div>
                           </div>
@@ -5329,6 +5331,10 @@ export default {
       infoisFinishSize: 0,
       infoisAllSize: 0,
       infoprogress: 0,
+      taskDetailLoading: [],
+      taskDetailLoading2: [],
+      taskDetailLoading3: [],
+      taskDetailLoading4: [],
     };
   },
   directives: {
@@ -12555,6 +12561,199 @@ export default {
         _this.loading = false
         console.log(error);
       });
+    },
+    aiDetail(msg, index) {
+      let _this = this
+      const _tindex = 'task-'+index
+      const _tindex2 = index
+      let messages = `
+      ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
+
+      --------
+      ## 要求
+      请帮我优化下列文字内容,更具象化更详细,输出文本格式就行不要带有其他格式
+      ${msg}
+
+      --------
+      ## Format example
+      输出优化的内容`
+      _this.taskDetailLoading.push(_tindex)
+      let params = JSON.stringify({
+        // "model": "Chat",
+        model: 'gpt-3.5-turbo',
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [{
+          content: messages,
+          role: 'user'
+        }],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: "",
+      })
+      _this.ajax.post('https://gpt4.cocorobo.cn/chat', params).then(function (response) {
+        console.log(response);
+        let data = response.data.FunctionResponse
+        if (data.choices && data.choices.length && data.choices[0].message) {
+          console.log(data.choices[0].message.content);
+          _this.unitJson[0].chapterInfo[0].taskJson[_tindex2].taskDetail2 = data.choices[0].message.content
+          _this.$forceUpdate()
+        }
+        _this.taskDetailLoading.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+      }).catch(function (error) {
+        _this.taskDetailLoading.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+        console.log(error);
+      });
+    },
+    aiDetail2(msg, index) {
+      let _this = this
+      const _tindex = 'task-'+index
+      const _tindex2 = index
+      let messages = `
+      ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
+
+      --------
+      ## 要求
+      请帮我优化下列文字内容,更具象化更详细,输出文本格式就行不要带有其他格式
+      ${msg}
+
+      --------
+      ## Format example
+      输出优化的内容`
+      _this.taskDetailLoading2.push(_tindex)
+      let params = JSON.stringify({
+        // "model": "Chat",
+        model: 'gpt-3.5-turbo',
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [{
+          content: messages,
+          role: 'user'
+        }],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: "",
+      })
+      _this.ajax.post('https://gpt4.cocorobo.cn/chat', params).then(function (response) {
+        console.log(response);
+        let data = response.data.FunctionResponse
+        if (data.choices && data.choices.length && data.choices[0].message) {
+          console.log(data.choices[0].message.content);
+          _this.unitJson[0].chapterInfo[0].taskJson[_tindex2].taskDetail = data.choices[0].message.content
+          _this.$forceUpdate()
+        }
+        _this.taskDetailLoading2.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+      }).catch(function (error) {
+        _this.taskDetailLoading2.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+        console.log(error);
+      });
+    },
+    aiDetail3(msg, index, tindex) {
+      let _this = this
+      const _tindex = 'task-'+index+tindex
+      const _tindex2 = index
+      const _tindex3 = tindex
+      let messages = `
+      ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
+
+      --------
+      ## 要求
+      请帮我优化下列文字内容,更具象化更详细,输出文本格式就行不要带有其他格式
+      ${msg}
+
+      --------
+      ## Format example
+      输出优化的内容`
+      _this.taskDetailLoading3.push(_tindex)
+      let params = JSON.stringify({
+        // "model": "Chat",
+        model: 'gpt-3.5-turbo',
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [{
+          content: messages,
+          role: 'user'
+        }],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: "",
+      })
+      _this.ajax.post('https://gpt4.cocorobo.cn/chat', params).then(function (response) {
+        console.log(response);
+        let data = response.data.FunctionResponse
+        if (data.choices && data.choices.length && data.choices[0].message) {
+          console.log(data.choices[0].message.content);
+          _this.unitJson[0].chapterInfo[0].taskJson[_tindex2].toolChoose[_tindex3].toolDetail = data.choices[0].message.content
+          _this.$forceUpdate()
+        }
+        _this.taskDetailLoading3.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+      }).catch(function (error) {
+        _this.taskDetailLoading3.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+        console.log(error);
+      });
+    },
+    aiDetail4(msg, index) {
+      if(!msg.length){
+        this.$message.error("请添加评价后才能优化")
+        return
+      }
+      let _this = this
+      const _tindex = 'task-'+index
+      const _tindex2 = index
+      let messages = `
+      ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
+
+      --------
+      ## 要求
+      请帮我优化下列json内容里的文字,value和detail都可以,更具象化更详细,输出数组格式
+      ${JSON.stringify(msg)}
+
+      --------
+      ## Format example
+      [
+        {"value":"评价名字1","detail":"评价维度1","score":5},
+        {"value":"评价名字2","detail":"评价维度2","score":5},
+        {"value":"评价名字3","detail":"评价维度3","score":5}
+      ]`
+      _this.taskDetailLoading4.push(_tindex)
+      let params = JSON.stringify({
+        // "model": "Chat",
+        model: 'gpt-3.5-turbo',
+        temperature: 0,
+        max_tokens: 4096,
+        top_p: 1,
+        frequency_penalty: 0,
+        presence_penalty: 0,
+        messages: [{
+          content: messages,
+          role: 'user'
+        }],
+        stream: false,
+        uid: this.userid,
+        mind_map_question: "",
+      })
+      _this.ajax.post('https://gpt4.cocorobo.cn/chat', params).then(function (response) {
+        console.log(response);
+        let data = response.data.FunctionResponse
+        if (data.choices && data.choices.length && data.choices[0].message) {
+          console.log(data.choices[0].message.content);
+          _this.unitJson[0].chapterInfo[0].taskJson[_tindex2].elist = JSON.parse(data.choices[0].message.content)
+          _this.$forceUpdate()
+        }
+        _this.taskDetailLoading4.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+      }).catch(function (error) {
+        _this.taskDetailLoading4.splice(_this.taskDetailLoading.indexOf(_tindex), 1)
+        console.log(error);
+      });
     }
   },
   beforeDestroy() {

部分文件因文件數量過多而無法顯示