| 
														
															@@ -4,7 +4,9 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       :before-close="handleClose" class="pub_dialog_diy" v-loading="loading"> 
														 | 
														
														 | 
														
															       :before-close="handleClose" class="pub_dialog_diy" v-loading="loading"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       <div> 
														 | 
														
														 | 
														
															       <div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         <div class="ex_box"> 
														 | 
														
														 | 
														
															         <div class="ex_box"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          例子:请你以富文本的形式给我出三个关于小学数学单位换算的选择题,每个选择题选项不少于4个,需要答案,但不需要解释,符号请使用中文的 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          <span>例子:</span> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          <el-button type="primary" size="mini" @click="checkExample('1')">选择题</el-button> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          <el-button type="primary" size="mini" @click="checkExample('2')">问答题</el-button> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         </div> 
														 | 
														
														 | 
														
															         </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         <div class="ac_box"> 
														 | 
														
														 | 
														
															         <div class="ac_box"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           <el-input v-model="text" placeholder="请在这里输入要发送的消息" size="normal" type="textarea" resize="none" 
														 | 
														
														 | 
														
															           <el-input v-model="text" placeholder="请在这里输入要发送的消息" size="normal" type="textarea" resize="none" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -13,7 +15,7 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         </div> 
														 | 
														
														 | 
														
															         </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         <div class="ac_content" v-if="aiCreate.length"> 
														 | 
														
														 | 
														
															         <div class="ac_content" v-if="aiCreate.length"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           <div class="title">生成内容:</div> 
														 | 
														
														 | 
														
															           <div class="title">生成内容:</div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          <div class="box"> 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          <div class="box" v-if="aiType == 1"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             <div v-for="(item, index) in aiCreate" :key="index" class="choice"> 
														 | 
														
														 | 
														
															             <div v-for="(item, index) in aiCreate" :key="index" class="choice"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               <div class="title">{{ `${index + 1}:${item.title}` }}</div> 
														 | 
														
														 | 
														
															               <div class="title">{{ `${index + 1}:${item.title}` }}</div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               <div class="options"> 
														 | 
														
														 | 
														
															               <div class="options"> 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -22,6 +24,12 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															               <div class="answer">{{ `答案:${item.answer}` }}</div> 
														 | 
														
														 | 
														
															               <div class="answer">{{ `答案:${item.answer}` }}</div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             </div> 
														 | 
														
														 | 
														
															             </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           </div> 
														 | 
														
														 | 
														
															           </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          <div class="box" v-if="aiType == 3"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            <div v-for="(item, index) in aiCreate" :key="index" class="choice"> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              <div class="title">{{ `${index + 1}:${item.title}` }}</div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              <div class="answer">{{ `答案:${item.answer}` }}</div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         </div> 
														 | 
														
														 | 
														
															         </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       </div> 
														 | 
														
														 | 
														
															       </div> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       <div slot="footer"> 
														 | 
														
														 | 
														
															       <div slot="footer"> 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -46,6 +54,14 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   }, 
														 | 
														
														 | 
														
															   }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   data() { 
														 | 
														
														 | 
														
															   data() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     return { 
														 | 
														
														 | 
														
															     return { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      example: { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        '1':{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          'title':'请你以富文本的形式给我出三个关于小学数学单位换算的选择题,每个选择题选项不少于4个,需要答案,但不需要解释,符号请使用中文的' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        '2':{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          'title':'请你以富文本的形式给我出三个关于三年级语文知识问答的问答题,需要答案,但不需要解释' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       text: "", 
														 | 
														
														 | 
														
															       text: "", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       aiCreate: [], 
														 | 
														
														 | 
														
															       aiCreate: [], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       aiType: "", 
														 | 
														
														 | 
														
															       aiType: "", 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -60,6 +76,9 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     close() { 
														 | 
														
														 | 
														
															     close() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.$emit('update:aiDialogVisible', false) 
														 | 
														
														 | 
														
															       this.$emit('update:aiDialogVisible', false) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, 
														 | 
														
														 | 
														
															     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    checkExample(type){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      this.text = this.example[type].title 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     guid() { 
														 | 
														
														 | 
														
															     guid() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       var _num, 
														 | 
														
														 | 
														
															       var _num, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         i, 
														 | 
														
														 | 
														
															         i, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -79,15 +98,16 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.$message.error("请输入要发送的消息") 
														 | 
														
														 | 
														
															         this.$message.error("请输入要发送的消息") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return 
														 | 
														
														 | 
														
															         return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // else if (this.text.indexOf("添加文档") !== -1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      //   this.aiType = 4 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      // } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       if (this.text.indexOf("选择题") !== -1) { 
														 | 
														
														 | 
														
															       if (this.text.indexOf("选择题") !== -1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.aiType = 1 
														 | 
														
														 | 
														
															         this.aiType = 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } else if (this.text.indexOf("问答题") !== -1) { 
														 | 
														
														 | 
														
															       } else if (this.text.indexOf("问答题") !== -1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.aiType = 2 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      } else if (this.text.indexOf("填空题") !== -1) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.aiType = 3 
														 | 
														
														 | 
														
															         this.aiType = 3 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      } else if (this.text.indexOf("添加文档") !== -1) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.aiType = 4 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.$message.error("生成的文字中要包含选择题或者问答题才能生成题目哦,请重新编辑下吧") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.loading = true 
														 | 
														
														 | 
														
															       this.loading = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       let param = { 
														 | 
														
														 | 
														
															       let param = { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -131,6 +151,12 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, 
														 | 
														
														 | 
														
															     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     generate2(aiReturn) { 
														 | 
														
														 | 
														
															     generate2(aiReturn) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       this.loading = true 
														 | 
														
														 | 
														
															       this.loading = true 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      let content = '' 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if(this.aiType == 1){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        content = `${JSON.stringify(aiReturn)},要求返回格式是Array [{"title":"",options:[],answer:[]}]` 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }else if(this.aiType == 3) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        content = `${JSON.stringify(aiReturn)},要求返回格式是Array [{title: "",answer: ""}]` 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       let param = { 
														 | 
														
														 | 
														
															       let param = { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         model: "gpt-3.5-turbo", 
														 | 
														
														 | 
														
															         model: "gpt-3.5-turbo", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         temperature: 0, 
														 | 
														
														 | 
														
															         temperature: 0, 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -141,7 +167,7 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         messages: [ 
														 | 
														
														 | 
														
															         messages: [ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           { 
														 | 
														
														 | 
														
															           { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             role: "user", 
														 | 
														
														 | 
														
															             role: "user", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-            content: `${JSON.stringify(aiReturn)},要求返回格式是Array [{"title":"",options:[],answer:[]}]` 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            content: content 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           }, 
														 | 
														
														 | 
														
															           }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         ], 
														 | 
														
														 | 
														
															         ], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         uid: this.guid(), 
														 | 
														
														 | 
														
															         uid: this.guid(), 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -159,7 +185,11 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return; 
														 | 
														
														 | 
														
															             return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           } 
														 | 
														
														 | 
														
															           } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           let aiCreate = res.data.FunctionResponse.choices[0].message.content; 
														 | 
														
														 | 
														
															           let aiCreate = res.data.FunctionResponse.choices[0].message.content; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-          aiCreate = JSON.parse(aiCreate) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            aiCreate = JSON.parse(aiCreate) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          } catch (error) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            this.generate2(aiReturn)  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           console.log(aiCreate) 
														 | 
														
														 | 
														
															           console.log(aiCreate) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           this.aiCreate = aiCreate; 
														 | 
														
														 | 
														
															           this.aiCreate = aiCreate; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           this.loading = false 
														 | 
														
														 | 
														
															           this.loading = false 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -175,8 +205,8 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.$message.error("请先创建Ai内容!"); 
														 | 
														
														 | 
														
															         this.$message.error("请先创建Ai内容!"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return; 
														 | 
														
														 | 
														
															         return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-      if(this.aiType !== 1){ 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-        this.$message.error("目前只支持选择题的创建!输入内容必须包含选择题三个字!"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      if(this.aiType !== 1 && this.aiType !== 3){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.$message.error("目前只支持选择题/问答题的创建!输入内容必须包含选择题/问答题!"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         return; 
														 | 
														
														 | 
														
															         return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       var json = JSON.parse(JSON.stringify(this.aiJson)) 
														 | 
														
														 | 
														
															       var json = JSON.parse(JSON.stringify(this.aiJson)) 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -217,6 +247,20 @@ export default { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             } 
														 | 
														
														 | 
														
															             } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           ) 
														 | 
														
														 | 
														
															           ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      }else if(this.aiType === 3){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        for (var i = 0; i < this.aiCreate.length; i++) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          array.push( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              json: { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                answer: this.aiCreate[i].answer, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                title: this.aiCreate[i].title, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                type: 1 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              ttype: 1, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+              type: 3 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       if (!json.length || json[0].ttype == 1) { 
														 | 
														
														 | 
														
															       if (!json.length || json[0].ttype == 1) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         json = [...json, ...array] 
														 | 
														
														 | 
														
															         json = [...json, ...array] 
														 |