|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div class="search">
|
|
|
<div class="s_top" ref="chatRef">
|
|
|
+
|
|
|
<!-- <div class="s_t_chat">
|
|
|
<div class="s_t_c_ai">
|
|
|
<div class="s_t_c_a_left">
|
|
@@ -55,7 +56,7 @@
|
|
|
<div class="s_t_c_a_right">
|
|
|
<div
|
|
|
class="s_t_c_a_r_content"
|
|
|
- v-if="item.content.includes('图片')"
|
|
|
+ v-if="pan(item.aiContent).length"
|
|
|
style="display: flex;justify-content: space-between;flex-wrap: wrap;"
|
|
|
>
|
|
|
<div
|
|
@@ -70,12 +71,16 @@
|
|
|
:key="index"
|
|
|
>
|
|
|
<img
|
|
|
- style="width: 130px;height: 130px;"
|
|
|
+ style="width: 130px;height: 130px;object-fit: cover;"
|
|
|
:src="i.image"
|
|
|
alt=""
|
|
|
@click="previewImg(i.image)"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <!-- {{ item }} -->
|
|
|
+ <div style="margin-top: 10px;width: 100%;display: flex;justify-content: end;" v-if="item.aiContent.length > 0 && chatList.length-2 == index" >
|
|
|
+ <img style="cursor: pointer;" @click="resetImg(item.content)" src="../../../assets/icon/course/resImg.png" alt="">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<div
|
|
|
v-else
|
|
@@ -83,11 +88,13 @@
|
|
|
v-loading="item.loading"
|
|
|
v-html="htmlContent(item.aiContent)"
|
|
|
></div>
|
|
|
- <div v-if="!item.content.includes('图片')" class="aiCopy">
|
|
|
+ <!-- {{ Array.isArray(JSON.parse(item.aiContent)) }} -->
|
|
|
+ <!-- {{ JSON.parse(item) }} -->
|
|
|
+ <div v-if="!pan(item.aiContent).length" 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"
|
|
|
+ src="../../../assets/icon/course/copyTxt.png"
|
|
|
alt=""
|
|
|
/>
|
|
|
</div>
|
|
@@ -149,6 +156,30 @@
|
|
|
<!-- <div class="s_b_ba-item" @click.stop="choiceRole()">选择角色</div> -->
|
|
|
|
|
|
<div class="s_b_btnArea">
|
|
|
+ <!-- <div class="s_b_ba-item">
|
|
|
+ <el-checkbox
|
|
|
+ :disabled="loading"
|
|
|
+ style="display: flex;"
|
|
|
+ v-model="imageCheck"
|
|
|
+ >图片</el-checkbox
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div class="s_b_ba-item">
|
|
|
+ <el-checkbox
|
|
|
+ :disabled="loading"
|
|
|
+ style="display: flex;"
|
|
|
+ v-model="videoCheck"
|
|
|
+ >视频</el-checkbox
|
|
|
+ >
|
|
|
+ </div> -->
|
|
|
+
|
|
|
+ <div class="s_b_ba-item" @click="send(text, 1)">
|
|
|
+ <img src="../../../assets/icon/course/sImg.png" style="margin-right: 5px;" alt="">图片
|
|
|
+ </div>
|
|
|
+ <div class="s_b_ba-item" @click="send(text, 2)">
|
|
|
+ <img src="../../../assets/icon/course/sRio.png" style="margin-right: 5px;" alt="">视频
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="s_b_ba-item" @click="clear()" v-if="!openAtBox">
|
|
|
清空聊天记录
|
|
|
</div>
|
|
@@ -453,6 +484,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
text: "",
|
|
|
+ ppage: 1,
|
|
|
+ CheckConNnm: 0,
|
|
|
loading: false,
|
|
|
chatLoading: false,
|
|
|
imageCheck: false,
|
|
@@ -616,6 +649,58 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ resetImg(_text){
|
|
|
+ this.ppage++
|
|
|
+
|
|
|
+ let _uuid = uuidv4();
|
|
|
+ this.chatList.push({
|
|
|
+ role: "user",
|
|
|
+ content: `${_text}`,
|
|
|
+ uid: _uuid,
|
|
|
+ AI: "AI",
|
|
|
+ aiContent: "",
|
|
|
+ oldContent: "",
|
|
|
+ isShowSynchronization: false,
|
|
|
+ filename: "",
|
|
|
+ index: this.chatList.length,
|
|
|
+ is_mind_map: false,
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ this.text = "";
|
|
|
+ let params = {
|
|
|
+ page: this.ppage,
|
|
|
+ pagesize: 6,
|
|
|
+ query: _text
|
|
|
+ };
|
|
|
+ // this.$message.info(_text);
|
|
|
+ this.chatList.push({
|
|
|
+ role: "user",
|
|
|
+ content: `getImage`,
|
|
|
+ uid: _uuid,
|
|
|
+ AI: "AI",
|
|
|
+ aiContent: "",
|
|
|
+ oldContent: "",
|
|
|
+ isShowSynchronization: false,
|
|
|
+ filename: "",
|
|
|
+ index: this.chatList.length,
|
|
|
+ is_mind_map: false,
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ this.scrollBottom();
|
|
|
+
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt.cocorobo.cn/search_image", params)
|
|
|
+ .then(res => {
|
|
|
+ let data = res.data.FunctionResponse.result;
|
|
|
+ // console.log('res',res.data.FunctionResponse.result);
|
|
|
+ this.chatList.find(i => i.uid == _uuid).aiContent = JSON.stringify(
|
|
|
+ data
|
|
|
+ );
|
|
|
+ this.chatList.find(i => i.uid == _uuid).loading = false;
|
|
|
+ this.chatLoading = false;
|
|
|
+ this.insertChat(_uuid);
|
|
|
+ });
|
|
|
+ },
|
|
|
stopSend() {
|
|
|
if (this.source) {
|
|
|
this.source.close();
|
|
@@ -677,7 +762,9 @@ export default {
|
|
|
// if (this.loading) return this.$message.info("请稍等");
|
|
|
// this.$message.info(`点击了语音`);
|
|
|
// },
|
|
|
- send(_text = this.text) {
|
|
|
+ send(_text = this.text,val = 0) {
|
|
|
+ this.ppage = 1
|
|
|
+ this.CheckConNnm = val
|
|
|
if (this.loading || this.chatLoading) return this.$message.info("请稍等");
|
|
|
if (_text.trim().length == 0) return this.$message.info("请输入内容");
|
|
|
let _atRoleList = [];
|
|
@@ -714,7 +801,7 @@ export default {
|
|
|
loading: true
|
|
|
});
|
|
|
this.scrollBottom();
|
|
|
- if (_text.indexOf("视频") != -1) {
|
|
|
+ if (_text.indexOf("视频") != -1 || this.CheckConNnm == 2) {
|
|
|
_msg = `
|
|
|
NOTICE
|
|
|
Language: Please use the same language as the user requirement, if the user speaks Chinese, the specific text of your answer should also be in Chinese.
|
|
@@ -742,12 +829,12 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
视频内容:介绍了一款AI教育软件
|
|
|
视频链接https://www.ted.com/talks/sal_khan_how_ai_could_save_not_destroy_education
|
|
|
`;
|
|
|
- } else if (_text.indexOf("图片") != -1) {
|
|
|
+ } else if (_text.indexOf("图片") != -1 || this.CheckConNnm == 1) {
|
|
|
// console.log("图片");
|
|
|
this.text = "";
|
|
|
let params = {
|
|
|
- page: 1,
|
|
|
- pagesize: 4,
|
|
|
+ page: this.ppage,
|
|
|
+ pagesize: 6,
|
|
|
query: _text
|
|
|
};
|
|
|
// this.$message.info(_text);
|
|
@@ -840,8 +927,9 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
// history.pop();
|
|
|
if (_msg) {
|
|
|
history.push({ role: "user", content: _msg });
|
|
|
+ }else{
|
|
|
+ history.push({ role: "user", content: _text });
|
|
|
}
|
|
|
- history.push({ role: "user", content: _text });
|
|
|
// let params = {
|
|
|
// model: "gpt-3.5-turbo",
|
|
|
// temperature: 0,
|
|
@@ -865,6 +953,7 @@ Instruction: Based on the context, follow "Format example", write content.
|
|
|
model: "Claude 3 Sonnet" // Claude 3 Sonnet或者Claude 3 Haiku
|
|
|
};
|
|
|
this.text = "";
|
|
|
+ // console.log('56465166541561616',params);
|
|
|
|
|
|
this.ajax
|
|
|
.post("https://claude3.cocorobo.cn/chat", params)
|
|
@@ -1780,6 +1869,10 @@ ${_wordData}
|
|
|
height: 100%;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
+.checkboxCss{
|
|
|
+ color: #fff;
|
|
|
+ background-color: #76a7f5 !important;
|
|
|
+}
|
|
|
.imgNumberBlock {
|
|
|
width: 100%;
|
|
|
height: 30px;
|