11wqe1 пре 11 месеци
родитељ
комит
7caf578c9c

+ 43 - 8
src/components/classRoomHelper/component/dialogArea.vue

@@ -46,6 +46,14 @@
                 v-loading="item.loading"
                 v-html="htmlContent(item.aiContent)"
               ></div>
+              <div v-if="!item.content.includes('图片')" class="aiCopy">
+                <img
+                  @click="onCopy(item.aiContent)"
+                  style="width: 30px;"
+                  src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E5%A4%8D%E5%88%B6%E5%9B%BE%E6%A0%871715569581741.png"
+                  alt=""
+                />
+              </div>
               <div class="d_t_c_a_r_time">{{ item.createtime }}</div>
             </div>
           </div>
@@ -255,7 +263,7 @@ export default {
       chatLoading: false,
       roleList2: [],
       chatList: [],
-			nowChatList:[],
+      nowChatList: []
     };
   },
   computed: {
@@ -276,6 +284,26 @@ export default {
     }
   },
   methods: {
+    onCopy(content) {
+      // 创建临时textarea元素
+      const tempInput = document.createElement("textarea");
+      tempInput.value = content; // 设置要复制的内容
+      // 隐藏元素
+      tempInput.style.position = "absolute";
+      tempInput.style.left = "-9999px";
+      // 将元素添加到DOM中
+      document.body.appendChild(tempInput);
+      // 选中元素内容
+      tempInput.select();
+      // 执行复制操作
+      document.execCommand("copy");
+      // 移除临时元素
+      document.body.removeChild(tempInput);
+      this.$message({
+        message: "复制成功",
+        type: "success"
+      });
+    },
     previewImg(url) {
       this.$hevueImgPreview(url);
     },
@@ -388,7 +416,7 @@ export default {
             });
           }
         });
-				history.push({ role: "user", content: _text });
+        history.push({ role: "user", content: _text });
         // history.pop();
         let params = {
           model: "gpt-3.5-turbo",
@@ -437,7 +465,7 @@ export default {
           this.chatList.find(i => i.uid == _uid).isalltext = true;
           this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
           this.chatList.find(i => i.uid == _uid).loading = false;
-					this.nowChatList.push(this.chatList.find(i=>i.uid==_uid));
+          this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
           // 这里保存对话
           this.insertChat(_uid);
           return;
@@ -486,7 +514,7 @@ export default {
           this.chatList.find(i => i.uid == _uid).isalltext = true;
           this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
           this.chatList.find(i => i.uid == _uid).loading = false;
-					this.nowChatList.push(this.chatList.find(i=>i.uid==_uid));
+          this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
           this.insertChat(_uid);
         } else {
           let _text = _eData.content.replace("'", "").replace("'", "");
@@ -634,7 +662,7 @@ export default {
       // this.rightRole = this.roleType;
       if (this.choseRoleItem.assistant_id) {
         this.chatList = [];
-				this.nowChatList = [];
+        this.nowChatList = [];
         let _uuid = uuidv4();
         this.chatList.push({
           role: "user",
@@ -651,7 +679,7 @@ export default {
           is_mind_map: false,
           loading: false
         });
-				
+
         this.scrollBottom();
       }
 
@@ -818,7 +846,7 @@ export default {
     this.getChatList().then(_ => {
       this.scrollBottom();
     });
-		this.nowChatList = [];
+    this.nowChatList = [];
   }
 };
 </script>
@@ -834,7 +862,13 @@ export default {
   width: 100%;
   height: 100%;
 }
-
+.aiCopy {
+  position: absolute;
+  right: 5px;
+  bottom: 0%;
+  /* transform: translate(0, -30%); */
+  cursor: pointer;
+}
 .characterBlock {
   display: flex;
   background: rgba(54, 169, 252, 1);
@@ -961,6 +995,7 @@ export default {
   box-sizing: border-box;
   padding-right: 35px;
   margin-top: 10px;
+  position: relative;
 }
 
 .d_t_c_a_right {

+ 31 - 10
src/components/classRoomHelper/component/searchArea.vue

@@ -49,18 +49,12 @@
           class="s_t_c_ai"
           v-if="item.content != 'wanSearch' && item.content != 'getImage'"
         >
-          <div class="aiCopy">
-            <img
-              style="width: 30px;"
-              src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E5%A4%8D%E5%88%B6%E5%9B%BE%E6%A0%871715569581741.png"
-              alt=""
-            />
-          </div>
+          
           <div class="s_t_c_a_left">
             <span>Ai</span>
           </div>
           <div class="s_t_c_a_right">
-            <div class="s_t_c_a_r_content" style="display: flex;justify-content: space-between;flex-wrap: wrap;" v-if="item.content.includes('图片')">
+            <div class="s_t_c_a_r_content" v-if="item.content.includes('图片')" style="display: flex;justify-content: space-between;flex-wrap: wrap;" >
               <div
                   v-if="!pan(item.aiContent).length"
                   class="d_t_c_a_r_content"
@@ -77,7 +71,14 @@
               v-loading="item.loading"
               v-html="htmlContent(item.aiContent)"
             ></div>
-
+            <div v-if="!item.content.includes('图片')" class="aiCopy">
+            <img
+                @click="onCopy(item.aiContent)"
+                style="width: 30px;"
+                src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E5%A4%8D%E5%88%B6%E5%9B%BE%E6%A0%871715569581741.png"
+                alt=""
+              />
+            </div>
             <!-- <div
               class="s_t_c_a_r_contentImage"
               v-loading="item.loading"
@@ -204,6 +205,26 @@ export default {
 		},
   },
   methods: {
+    onCopy(content){
+      // 创建临时textarea元素
+      const tempInput = document.createElement('textarea');
+      tempInput.value = content; // 设置要复制的内容
+      // 隐藏元素
+      tempInput.style.position = 'absolute';
+      tempInput.style.left = '-9999px';
+      // 将元素添加到DOM中
+      document.body.appendChild(tempInput);
+      // 选中元素内容
+      tempInput.select();
+      // 执行复制操作
+      document.execCommand('copy');
+      // 移除临时元素
+      document.body.removeChild(tempInput);
+      this.$message({
+          message: '复制成功',
+          type: 'success'
+        });
+    },
     previewImg(url) {
       this.$hevueImgPreview(url);
     },
@@ -803,7 +824,7 @@ Instruction: Based on the context, follow "Format example", write content.
   position: absolute;
   right: 5px;
   bottom: 0%;
-  transform: translate(0, -30%);
+  /* transform: translate(0, -30%); */
   cursor: pointer;
 }
 

+ 45 - 11
src/components/classRoomHelper/component/taskArea.vue

@@ -93,6 +93,14 @@
               v-loading="item.loading"
               v-html="htmlContent(item.aiContent)"
             ></div>
+            <div v-if="!item.content.includes('图片')" class="aiCopy">
+              <img
+                @click="onCopy(item.aiContent)"
+                style="width: 30px;"
+                src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/%E5%A4%8D%E5%88%B6%E5%9B%BE%E6%A0%871715569581741.png"
+                alt=""
+              />
+            </div>
             <div class="t_t_c_a_r_time">{{ item.createtime }}</div>
           </div>
         </div>
@@ -149,7 +157,7 @@ export default {
       loading: false,
       chatLoading: false,
       chatList: [],
-			nowChatList:[],
+      nowChatList: []
     };
   },
   computed: {
@@ -170,6 +178,26 @@ export default {
     }
   },
   methods: {
+    onCopy(content) {
+      // 创建临时textarea元素
+      const tempInput = document.createElement("textarea");
+      tempInput.value = content; // 设置要复制的内容
+      // 隐藏元素
+      tempInput.style.position = "absolute";
+      tempInput.style.left = "-9999px";
+      // 将元素添加到DOM中
+      document.body.appendChild(tempInput);
+      // 选中元素内容
+      tempInput.select();
+      // 执行复制操作
+      document.execCommand("copy");
+      // 移除临时元素
+      document.body.removeChild(tempInput);
+      this.$message({
+        message: "复制成功",
+        type: "success"
+      });
+    },
     exportCourse() {
       let _user = `<div style="font-size:30px;margin-top:10px;"><span style="color: rgb(113, 124, 141); font-weight: 400;">创建者:</span><span>${this.courseDetail.username}</span></div>`;
       const _chapInfo = JSON.parse(this.courseDetail.chapters);
@@ -229,7 +257,7 @@ export default {
           this.chatList.find(i => i.uid == _uid).isalltext = true;
           this.chatList.find(i => i.uid == _uid).isShowSynchronization = true;
           this.chatList.find(i => i.uid == _uid).loading = false;
-					this.nowChatList.push(this.chatList.find(i=>i.uid==_uid));
+          this.nowChatList.push(this.chatList.find(i => i.uid == _uid));
           // 这里保存对话
           this.insertChat(_uid);
           return;
@@ -363,11 +391,11 @@ export default {
       let history = [];
       this.nowChatList.forEach(i => {
         if (i.content == "wanSearch") {
-					// history.push({
+          // history.push({
           //   role: "assistant",
           //   content: i.aiContent
           // });
-          return 
+          return;
         } else if (i.content == "getImage") {
           return history.push({
             role: "assistant",
@@ -387,7 +415,7 @@ export default {
           });
         }
       });
-			history.push({ role: "user", content: _text });
+      history.push({ role: "user", content: _text });
       // history.pop();
       let params = {
         model: "gpt-3.5-turbo",
@@ -550,12 +578,11 @@ Instruction: Based on the context, follow "Format example", write content.
       let history = [];
       this.nowChatList.forEach(i => {
         if (i.content == "wanSearch") {
-					// history.push({
+          // history.push({
           //   role: "assistant",
           //   content: JSON.stringify(i.aiContent)
           // });
-          return 
-					
+          return;
         } else if (i.content == "getImage") {
           return history.push({
             role: "assistant",
@@ -579,7 +606,7 @@ Instruction: Based on the context, follow "Format example", write content.
       if (_msg) {
         history.push({ role: "user", content: _msg });
       }
-			// history.push({ role: "user", content: _text });
+      // history.push({ role: "user", content: _text });
       this.scrollBottom();
 
       let params = {
@@ -627,7 +654,7 @@ Instruction: Based on the context, follow "Format example", write content.
     this.getChatList().then(_ => {
       this.scrollBottom();
     });
-		this.nowChatList = [];
+    this.nowChatList = [];
   }
 };
 </script>
@@ -638,7 +665,13 @@ Instruction: Based on the context, follow "Format example", write content.
   height: 100%;
   box-sizing: border-box;
 }
-
+.aiCopy {
+  position: absolute;
+  right: 5px;
+  bottom: 0%;
+  /* transform: translate(0, -30%); */
+  cursor: pointer;
+}
 .taskTop {
   width: 100%;
   height: 280px;
@@ -817,6 +850,7 @@ Instruction: Based on the context, follow "Format example", write content.
   margin-top: 10px;
   box-sizing: border-box;
   padding-right: 35px;
+  position: relative;
 }
 
 .t_t_c_a_right {