|
@@ -30,7 +30,11 @@
|
|
|
<div class="s_t_chat" v-for="(item, index) in chatList" :key="index">
|
|
|
<div
|
|
|
class="s_t_c_user"
|
|
|
- v-if="item.content && item.content != 'wanSearch'"
|
|
|
+ v-if="
|
|
|
+ item.content &&
|
|
|
+ item.content != 'wanSearch' &&
|
|
|
+ item.content != 'getImage'
|
|
|
+ "
|
|
|
>
|
|
|
<div class="s_t_c_u_left">
|
|
|
<div class="s_t_c_u_l_content">{{ item.content }}</div>
|
|
@@ -41,7 +45,10 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="s_t_c_ai" v-if="item.content != 'wanSearch'">
|
|
|
+ <div
|
|
|
+ class="s_t_c_ai"
|
|
|
+ v-if="item.content != 'wanSearch' && item.content != 'getImage'"
|
|
|
+ >
|
|
|
<div class="aiCopy">
|
|
|
<img
|
|
|
style="width: 30px;"
|
|
@@ -53,33 +60,42 @@
|
|
|
<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 v-for="i in pan(item.aiContent)">
|
|
|
+ <img style="width: 120px;height: 120px;" :src="i.image" alt="" @click="previewImg(i.image)">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div
|
|
|
+ v-else
|
|
|
class="s_t_c_a_r_content"
|
|
|
v-loading="item.loading"
|
|
|
v-html="item.aiContent"
|
|
|
></div>
|
|
|
+
|
|
|
<!-- <div
|
|
|
class="s_t_c_a_r_contentImage"
|
|
|
- v-loading="loading && index == chatList.length - 1"
|
|
|
- v-if="item.type == 1"
|
|
|
+ v-loading="item.loading"
|
|
|
+
|
|
|
>
|
|
|
- <span style="margin-bottom: 10px;">为您找到以下图片:</span>
|
|
|
- <img
|
|
|
- v-for="(item, index) in item.content"
|
|
|
+
|
|
|
+ <span style="margin-bottom: 10px;">为您找到以下图片: {{ item.content }}</span> -->
|
|
|
+ <!-- {{ item.aiContent }} -->
|
|
|
+ <!-- <img
|
|
|
+ v-for="(i, index) in item.aiContent"
|
|
|
@click.stop="$hevueImgPreview(item)"
|
|
|
:key="index"
|
|
|
- :src="item"
|
|
|
- />
|
|
|
- <div class="imgNumberBlock">
|
|
|
+ :src="i.image"
|
|
|
+ /> -->
|
|
|
+ <!-- <div class="imgNumberBlock">
|
|
|
<div class="imgNumber" v-for="(i,index) in imgNumList" :key="index+'b'">
|
|
|
{{ i }}
|
|
|
</div>
|
|
|
<div class="imgNumber" style="background: none;">
|
|
|
<img style="width: 36px;height: 30px;" src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/Frame%20131715569413607.png" alt="">
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div> -->
|
|
|
- <div class="s_t_c_a_r_time">{{ item.createtime }}</div>
|
|
|
+ </div> -->
|
|
|
+ <!-- </div> -->
|
|
|
+ <!-- <div class="s_t_c_a_r_time">{{ item.createtime }}</div> -->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -163,10 +179,24 @@ export default {
|
|
|
chatList: []
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ pan() {
|
|
|
+ return (content) => {
|
|
|
+ try {
|
|
|
+ return JSON.parse(content)
|
|
|
+ } catch (error) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- clear(){
|
|
|
- this.chatList = [];
|
|
|
- },
|
|
|
+ previewImg(url) {
|
|
|
+ this.$hevueImgPreview(url);
|
|
|
+ },
|
|
|
+ clear() {
|
|
|
+ this.chatList = [];
|
|
|
+ },
|
|
|
choiceRole() {
|
|
|
this.cardType = 1;
|
|
|
},
|
|
@@ -181,7 +211,7 @@ export default {
|
|
|
send(_text = this.text) {
|
|
|
if (this.loading || this.chatLoading) return this.$message.info("请稍等");
|
|
|
if (_text.trim().length == 0) return this.$message.info("请输入内容");
|
|
|
- let _msg = ``;
|
|
|
+ let _msg = ``;
|
|
|
this.chatLoading = true;
|
|
|
let _uuid = uuidv4();
|
|
|
this.chatList.push({
|
|
@@ -198,64 +228,106 @@ export default {
|
|
|
loading: true
|
|
|
});
|
|
|
this.scrollBottom();
|
|
|
- if(_text.indexOf("视频")!=-1){
|
|
|
- _msg = `
|
|
|
- ATTENTION: Use '##' or '####' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
|
|
|
-
|
|
|
- ---
|
|
|
- ## 任务
|
|
|
- 你的任务是根据用户的请求,结合“课程信息”,在https://www.bilibili.com/ 等教育网站上搜索相关视频,并且按照“输出格式”将结果输出给用户。
|
|
|
- ### 课程信息(读取【课程中心】相关信息)
|
|
|
- #### 课程标题:${this.courseDetail.title}
|
|
|
- #### 分类:${this.courseDetail.name?this.courseDetail.name:"无"}
|
|
|
- #### 学生年级:${this.courseDetail.classname?this.courseDetail.classname:"无"}
|
|
|
- #### 课程其他内容(【课程中心】-【导出信息】的内容)
|
|
|
- #### 课程实时语音转录文本的结果(未来支持,目前无视)
|
|
|
- ---
|
|
|
- ## 规则
|
|
|
- - 输出结果必须真实有效,不要捏造无效的视频链接
|
|
|
- - 如果没有相关内容,请跟用户表明没有找到相关主题内容,然后推荐近似内容
|
|
|
- ---
|
|
|
- ## 输出
|
|
|
- - 在ted.com等教育网站上搜索视频,并且以有序列表的形式将结果输出给用户
|
|
|
- - 请一步步思考如何根据现有信息推送视频,但是最终输出结果不需要包含你的思考过程,只需要包含视频标题+链接。
|
|
|
- ---
|
|
|
- ## 输出格式
|
|
|
- 视频标题 + 视频链接
|
|
|
- ---
|
|
|
-
|
|
|
- `
|
|
|
- }
|
|
|
- // else if(_text.indexOf('图片')!=-1){
|
|
|
- // _msg = `
|
|
|
- // ATTENTION: Use '##' or '####' to SPLIT SECTIONS, not '#'.Output format carefully referenced "Format example".
|
|
|
-
|
|
|
- // ---
|
|
|
- // ## 任务
|
|
|
- // 你的任务是根据用户的请求,结合“课程信息”,搜索4张图片,将搜索结果以2*2的排列格式返回给用户。
|
|
|
- // ### 课程信息(读取【课程中心】相关信息)
|
|
|
- // #### 课程标题:${this.courseDetail.title}
|
|
|
- // #### 分类:${this.courseDetail.name?this.courseDetail.name:"无"}
|
|
|
- // #### 学生年级:${this.courseDetail.classname?this.courseDetail.classname:"无"}
|
|
|
- // #### 课程其他内容(【课程中心】-【导出信息】的内容)
|
|
|
- // #### 课程实时语音转录文本的结果(未来支持,目前无视)
|
|
|
- // ---
|
|
|
- // ## 规则
|
|
|
- // - 输出结果基于“课程信息”,避免提供与“课程信息”无关的图片。
|
|
|
- // - 当你判断用户的请求与“课程信息”不相关时,你需要向用户解释他的请求与“课程信息”无关。
|
|
|
- // - 如果用户坚持生成跟“课程信息”无关的图片时,你只需要按照用户的请求搜索1张图片。
|
|
|
- // ---
|
|
|
- // ## 输出
|
|
|
- // - 搜索4张图片,将搜索结果以2*2的排列格式输出给用户
|
|
|
- // - 请一步步思考如何根据现有信息推送图片,但是不需要输出图片以外的内容。
|
|
|
- // -----
|
|
|
- // `
|
|
|
- // }
|
|
|
- let history = [];
|
|
|
- if(_msg){
|
|
|
- history.push({ role: "user", content: _msg })
|
|
|
- }
|
|
|
- history.push({ role: "user", content: _text })
|
|
|
+ if (_text.indexOf("视频") != -1) {
|
|
|
+ _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.
|
|
|
+ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
|
|
|
+Instruction: Based on the context, follow "Format example", write content.
|
|
|
+
|
|
|
+# Context
|
|
|
+## 任务
|
|
|
+你的任务是根据用户的请求,结合“课程信息”,在Ted.com等教育网站上搜索相关视频,并且按照“输出格式”将结果输出给用户。
|
|
|
+课程信息
|
|
|
+课程标题:${this.courseDetail.title}
|
|
|
+分类:${this.courseDetail.name ? this.courseDetail.name : "无"}
|
|
|
+学生年级:${this.courseDetail.classname ? this.courseDetail.classname : "无"}
|
|
|
+
|
|
|
+## 规则
|
|
|
+ 1. 输出结果必须真实有效,不要捏造无效的视频链接
|
|
|
+ 2. 当课程信息中的子条目内容为“无”时,无视这些条目进行输出即可。
|
|
|
+ 3. 如果没有相关内容,请跟用户表明没有找到相关视频链接内容,然后推荐搜索建议
|
|
|
+ 4. 在ted.com等教育网站上搜索视频,并且以有序列表的形式将结果输出给用户
|
|
|
+ 5. 请一步步思考如何根据现有信息推送视频,但是最终输出结果不需要包含你的思考过程,只需要包含视频标题+链接。
|
|
|
+
|
|
|
+# Format example
|
|
|
+视频来源: Ted.com
|
|
|
+视频标题:How AI could save (not destroy) education
|
|
|
+视频内容:介绍了一款AI教育软件
|
|
|
+视频链接https://www.ted.com/talks/sal_khan_how_ai_could_save_not_destroy_education
|
|
|
+ `;
|
|
|
+ } else if (_text.indexOf("图片") != -1) {
|
|
|
+ console.log("图片");
|
|
|
+ this.text = "";
|
|
|
+ let params = {
|
|
|
+ page: 1,
|
|
|
+ pagesize: 4,
|
|
|
+ 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.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);
|
|
|
+
|
|
|
+ // console.log('resresresres',res);
|
|
|
+ // if (res.data.FunctionResponse.result == "发送成功") {
|
|
|
+
|
|
|
+ // } else {
|
|
|
+ // this.$message.warning(res.data.FunctionResponse.result);
|
|
|
+ // }
|
|
|
+ });
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(9999);
|
|
|
+ // num=0
|
|
|
+ // _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.
|
|
|
+ // ATTENTION: Use '##' to SPLIT SECTIONS, not '#'. Output format carefully referenced "Format example".
|
|
|
+ // Instruction: Based on the context, follow "Format example", write content.
|
|
|
+
|
|
|
+ // # Context
|
|
|
+ // ## 任务
|
|
|
+ // 你的任务是根据用户的请求,结合以下“课程信息”包含的子条目(“课程标题”,“主题”,“学科”以及“年级”),向用户输出相关的4张图片,将结果2*2的形式返回给用户。
|
|
|
+ // 课程信息
|
|
|
+ // 课程标题:${this.courseDetail.title}
|
|
|
+ // 分类:${this.courseDetail.name?this.courseDetail.name:"无"}
|
|
|
+ // 学生年级:${this.courseDetail.classname?this.courseDetail.classname:"无"}
|
|
|
+
|
|
|
+ // ## 规则
|
|
|
+ // 1. 输出内容应该与“课程信息”相关,避免提供无关的信息。
|
|
|
+ // 2. 当课程信息中的子条目内容为“无”时,无视这些条目进行输出即可。
|
|
|
+ // 3. 搜索建议的结果应该符合伦理规范。
|
|
|
+
|
|
|
+ // ## 输出格式
|
|
|
+ // 1. 以2*2的格式输出应包括4张相关的图片。
|
|
|
+ // `
|
|
|
+ // }
|
|
|
+ let history = [];
|
|
|
+ if (_msg) {
|
|
|
+ history.push({ role: "user", content: _msg });
|
|
|
+ }
|
|
|
+ history.push({ role: "user", content: _text });
|
|
|
let params = {
|
|
|
model: "gpt-3.5-turbo",
|
|
|
temperature: 0,
|
|
@@ -458,8 +530,10 @@ export default {
|
|
|
你的任务是根据“课程信息”,提供用户需要的搜索建议,将搜索建议的结果以有序列表的形式返回给用户。
|
|
|
## 课程信息
|
|
|
#### 课程标题:${this.courseDetail.title}
|
|
|
- #### 分类:${this.courseDetail.name?this.courseDetail.name:"无"}
|
|
|
- #### 学生年级:${this.courseDetail.classname?this.courseDetail.classname:"无"}
|
|
|
+ #### 分类:${this.courseDetail.name ? this.courseDetail.name : "无"}
|
|
|
+ #### 学生年级:${
|
|
|
+ this.courseDetail.classname ? this.courseDetail.classname : "无"
|
|
|
+ }
|
|
|
---
|
|
|
|
|
|
## 规则
|