|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="search">
|
|
|
- <div class="s_top" ref="chatRef">
|
|
|
+ <div class="s_top" ref="chatRef" v-if="cardType==0">
|
|
|
<div class="s_t_chat" v-for="(item, index) in chatList" :key="index">
|
|
|
<div
|
|
|
class="s_t_c_user"
|
|
@@ -29,7 +29,8 @@
|
|
|
"
|
|
|
>
|
|
|
<div class="s_t_c_a_left">
|
|
|
- <span>Ai</span>
|
|
|
+ <img style="border-radius: 100%;" v-if="item.filename" :src="item.filename">
|
|
|
+ <span v-else>Ai</span>
|
|
|
</div>
|
|
|
<div class="s_t_c_a_right">
|
|
|
<div
|
|
@@ -189,7 +190,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="s_bottom">
|
|
|
+ <div class="s_bottom" v-if="cardType==0">
|
|
|
<div class="s_b_btnAreaTop">
|
|
|
<div class="s_b_bat_left">
|
|
|
<el-tooltip
|
|
@@ -252,6 +253,15 @@
|
|
|
<img src="../../../assets/icon/course/sRio2.png" style="margin-right: 5px;" alt="" v-else> -->
|
|
|
搜索视频
|
|
|
</div>
|
|
|
+<!--
|
|
|
+ <div class="s_b_ba-item" @click.stop="choiceRole()">
|
|
|
+ <img
|
|
|
+ style="width: 20px;"
|
|
|
+ src="../../../assets/icon/course/role.png"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ 选择智能体
|
|
|
+ </div> -->
|
|
|
<!-- <div class="s_b_ba-item" @click="clear()" v-if="!openAtBox">
|
|
|
清空聊天记录
|
|
|
</div>
|
|
@@ -581,6 +591,110 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="choiceTopArea" v-if="cardType == 1">
|
|
|
+ <div class="choiceTop">
|
|
|
+ <div class="choiceRoleHeader">
|
|
|
+ <div>切换角色:</div>
|
|
|
+ <span>您希望以下哪个角色回答您的问题,请选择:</span>
|
|
|
+ </div>
|
|
|
+ <div class="choiceSelect">
|
|
|
+ <el-button
|
|
|
+ class="option"
|
|
|
+ :style="{
|
|
|
+ background: sortOption == 0 ? '#36A9FC' : '',
|
|
|
+ color: sortOption == 0 ? '#fff' : ''
|
|
|
+ }"
|
|
|
+ @click="optBtn(0)"
|
|
|
+ plain
|
|
|
+ >我的</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="option"
|
|
|
+ :style="{
|
|
|
+ background: sortOption == 1 ? '#36A9FC' : '',
|
|
|
+ color: sortOption == 1 ? '#fff' : ''
|
|
|
+ }"
|
|
|
+ @click="optBtn(1)"
|
|
|
+ plain
|
|
|
+ >社区</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="characterBlock"
|
|
|
+ v-if="sortOption == 0"
|
|
|
+ v-for="(item, index) in roleList"
|
|
|
+ :key="item.id"
|
|
|
+ @click.stop="choseRole(item)"
|
|
|
+ >
|
|
|
+ <div class="imgLeft">
|
|
|
+ <div class="img">
|
|
|
+ <img style="width: 100%;height: 100%;" :src="item.avatar" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="txtRight">
|
|
|
+ <div class="bir">{{ item.assistantName }}</div>
|
|
|
+ <div
|
|
|
+ :style="{
|
|
|
+ color: '#fff',
|
|
|
+ display:
|
|
|
+ choseRoleItem.assistant_id == item.assistant_id
|
|
|
+ ? 'block'
|
|
|
+ : 'none'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ 已选择
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ class="characterBlock"
|
|
|
+ v-if="sortOption == 1"
|
|
|
+ v-for="(item, index) in roleList2"
|
|
|
+ :key="item.id"
|
|
|
+ @click.stop="choseRole(item)"
|
|
|
+ >
|
|
|
+ <div class="imgLeft">
|
|
|
+ <div class="img">
|
|
|
+ <img
|
|
|
+ style="width: 100%;height: 100%;"
|
|
|
+ :src="
|
|
|
+ item.headUrl
|
|
|
+ ? item.headUrl
|
|
|
+ : require('../../../assets/icon/course/ai.png')
|
|
|
+ "
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="txtRight">
|
|
|
+ <div class="bir">{{ item.assistantName }}</div>
|
|
|
+ <div
|
|
|
+ :style="{
|
|
|
+ color: '#fff',
|
|
|
+ display:
|
|
|
+ choseRoleItem.assistant_id == item.assistant_id
|
|
|
+ ? 'block'
|
|
|
+ : 'none'
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ 已选择
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="choiceBottom">
|
|
|
+ <el-button class="cb_btn" size="mini" @click="noChangeRole()"
|
|
|
+ >取消</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ class="cb_btn"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ @click="changeRole()"
|
|
|
+ >确定</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<iframe
|
|
|
allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
|
src="https://beta.cloud.cocorobo.cn/browser/public/index.html"
|
|
@@ -699,7 +813,11 @@ export default {
|
|
|
tools: JSON.parse(converter(JSON.stringify(tools))),
|
|
|
aiTalkList: [],
|
|
|
aiIsTalk: false,
|
|
|
- aiTalkUid: ""
|
|
|
+ aiTalkUid: "",
|
|
|
+ choseRoleItem: {},
|
|
|
+ cardType:0,
|
|
|
+ roleList:[],
|
|
|
+ sortOption: 0, //切换角色 0我的 1 社区
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -990,7 +1108,6 @@ export default {
|
|
|
loading: true
|
|
|
});
|
|
|
this.scrollBottom();
|
|
|
- console.log(this.sendType);
|
|
|
if (this.sendType == 2 || _text.indexOf("视频") != -1) {
|
|
|
return this.ajax
|
|
|
.post(`https://gpt4.cocorobo.cn/get_network_search`, {
|
|
@@ -1021,9 +1138,11 @@ export default {
|
|
|
} else if (this.sendType == 3) {
|
|
|
this.text = "";
|
|
|
let params = {
|
|
|
- page: this.ppage,
|
|
|
- pagesize: 1,
|
|
|
- query: _text
|
|
|
+ n:1,
|
|
|
+ prompt:_text,
|
|
|
+ quality:"standard",
|
|
|
+ size:"1024x1024",
|
|
|
+ style:"natural"
|
|
|
};
|
|
|
// this.$message.info(_text);
|
|
|
this.chatList.push({
|
|
@@ -1040,17 +1159,35 @@ export default {
|
|
|
loading: true
|
|
|
});
|
|
|
this.ajax
|
|
|
- .post("https://gpt.cocorobo.cn/search_image", params)
|
|
|
+ .post("https://gpt4.cocorobo.cn/getImage", params)
|
|
|
.then(res => {
|
|
|
- let data = res.data.FunctionResponse.result;
|
|
|
+ let data = res.data.FunctionResponse;
|
|
|
// console.log('res',res.data.FunctionResponse.result);
|
|
|
- this.chatList.find(i => i.uid == _uuid).aiContent = JSON.stringify(
|
|
|
- data
|
|
|
- );
|
|
|
+ let _result = [];
|
|
|
+ if(!data.image_url_list.length){
|
|
|
+ this.chatLoading = false;
|
|
|
+ this.chatList.pop();
|
|
|
+ this.chatList.pop();
|
|
|
+ return this.$message.error("生成图片失败")
|
|
|
+ }
|
|
|
+ data.image_url_list.forEach(i=>{
|
|
|
+ _result.push({
|
|
|
+ image:i
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ this.chatList.find(i => i.uid == _uuid).aiContent = JSON.stringify(_result);
|
|
|
this.chatList.find(i => i.uid == _uuid).loading = false;
|
|
|
+ console.log(this.chatList.find(i => i.uid == _uuid).aiContent)
|
|
|
this.chatLoading = false;
|
|
|
this.insertChat(_uuid);
|
|
|
- });
|
|
|
+ this.scrollBottom();
|
|
|
+ }).catch(e=>{
|
|
|
+ this.chatLoading = false;
|
|
|
+ this.chatList.pop();
|
|
|
+ this.chatList.pop();
|
|
|
+ this.$message.error("生成失败")
|
|
|
+ });
|
|
|
return;
|
|
|
} else if (this.sendType == 1 || _text.indexOf("图片") != -1) {
|
|
|
// console.log("图片");
|
|
@@ -1083,6 +1220,8 @@ export default {
|
|
|
this.chatList.find(i => i.uid == _uuid).aiContent = JSON.stringify(
|
|
|
data
|
|
|
);
|
|
|
+ console.log("👇")
|
|
|
+ console.log(this.chatList.find(i => i.uid == _uuid).aiContent)
|
|
|
this.chatList.find(i => i.uid == _uuid).loading = false;
|
|
|
this.chatLoading = false;
|
|
|
this.insertChat(_uuid);
|
|
@@ -2448,6 +2587,89 @@ ${_wordData}
|
|
|
this.aiTalk(0);
|
|
|
}
|
|
|
},
|
|
|
+ choseRole(item) {
|
|
|
+ this.choseRoleItem = item;
|
|
|
+ console.log("选择角色", this.choseRoleItem);
|
|
|
+ },
|
|
|
+ noChangeRole() {
|
|
|
+ this.cardType = 0;
|
|
|
+ this.choseRoleItem = {};
|
|
|
+ },
|
|
|
+ changeRole() {
|
|
|
+ this.cardType = 0;
|
|
|
+ if (this.choseRoleItem.assistant_id) {
|
|
|
+ // this.chatList = [];
|
|
|
+ this.nowChatList = [];
|
|
|
+ let _uuid = uuidv4();
|
|
|
+ this.chatList.push({
|
|
|
+ role: "user",
|
|
|
+ content: `您好,${this.choseRoleItem.assistantName}`,
|
|
|
+ uid: _uuid,
|
|
|
+ AI: "AI",
|
|
|
+ aiContent: this.choseRoleItem.prologue
|
|
|
+ ? this.choseRoleItem.prologue
|
|
|
+ : "您好,有什么需要我帮忙的吗?",
|
|
|
+ oldContent: "",
|
|
|
+ isShowSynchronization: false,
|
|
|
+ filename: this.choseRoleItem.headUrl,
|
|
|
+ index: this.chatList.length,
|
|
|
+ is_mind_map: false,
|
|
|
+ loading: false
|
|
|
+ });
|
|
|
+
|
|
|
+ this.scrollBottom();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ optBtn(val) {
|
|
|
+ this.sortOption = val;
|
|
|
+ },
|
|
|
+ getRoleList() {
|
|
|
+ this.roleList = [];
|
|
|
+ let params = {
|
|
|
+ userId: this.userid
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_list", params)
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data.FunctionResponse.result;
|
|
|
+ if (_data.length == 0) return;
|
|
|
+ if (_data) {
|
|
|
+ this.roleList = JSON.parse(_data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ console.log("获取角色列表失败");
|
|
|
+ this.roleList = [];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getPublicRoleList() {
|
|
|
+ this.roleList2 = [];
|
|
|
+ let params = {
|
|
|
+ userId: this.userid,
|
|
|
+ // organizeid: this.org,
|
|
|
+ organizeid: "45facc0a-1211-11ec-80ad-005056b86db5"
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .post(
|
|
|
+ "https://gpt4.cocorobo.cn/get_ai_agent_assistant_share_list",
|
|
|
+ params
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ let _data = res.data.FunctionResponse.result;
|
|
|
+ if (_data.length == 0) return;
|
|
|
+ if (_data) {
|
|
|
+ this.roleList2 = JSON.parse(_data);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.roleList2 = [];
|
|
|
+ console.log("获取公共角色失败", e);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ choiceRole() {
|
|
|
+ if (this.loading) return this.$message.info("请稍等");
|
|
|
+ this.cardType = 1;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.getChatList().then(_ => {
|
|
@@ -2458,6 +2680,8 @@ ${_wordData}
|
|
|
this.sendType = 0;
|
|
|
this.initTaskList();
|
|
|
this.getWorkData();
|
|
|
+ this.getPublicRoleList();
|
|
|
+ this.getRoleList();
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -3253,4 +3477,191 @@ ${_wordData}
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+
|
|
|
+.choiceTopArea{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%
|
|
|
+}
|
|
|
+
|
|
|
+.choiceTop {
|
|
|
+ width: 100%;
|
|
|
+ height: 95%;
|
|
|
+ overflow-x: hidden;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.choiceBottom {
|
|
|
+ width: 100%;
|
|
|
+ height: 5%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+}
|
|
|
+
|
|
|
+.cb_btn {
|
|
|
+ margin: 0 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.choiceRoleHeader {
|
|
|
+ width: 100%;
|
|
|
+ /* margin: 10px; */
|
|
|
+ margin-bottom: 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.choiceRoleHeader > div {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+
|
|
|
+.choiceRoleHeader > span {
|
|
|
+ font-size: 14px;
|
|
|
+}
|
|
|
+.choiceSelect {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ height: 35px;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+ margin: 15px 0;
|
|
|
+}
|
|
|
+.choiceSelect > .option {
|
|
|
+ width: 80px;
|
|
|
+ height: 100%;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin-right: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.filterSubjects {
|
|
|
+ margin: 10px;
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.fs_box {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ margin-top: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.fs_b_item {
|
|
|
+ width: auto;
|
|
|
+ height: 35px;
|
|
|
+ font-size: 14px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 9px;
|
|
|
+ background-color: #f3f7fd;
|
|
|
+ border: solid 1px #f3f7fd;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin-right: 8px;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+
|
|
|
+.fs_b_itemActive {
|
|
|
+ border: solid 1px #4d8ffc;
|
|
|
+ color: #4d8ffc;
|
|
|
+ background-color: #f3f7fd;
|
|
|
+}
|
|
|
+
|
|
|
+.roleList {
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+ margin: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.r_box {
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+}
|
|
|
+
|
|
|
+.r_b_item {
|
|
|
+ height: 40px;
|
|
|
+ font-size: 14px;
|
|
|
+ display: flex;
|
|
|
+ /* justify-content: center; */
|
|
|
+ align-items: center;
|
|
|
+ background-color: #f0f2f5;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin: 5px;
|
|
|
+ cursor: pointer;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 0 4px;
|
|
|
+ border: solid 1px #f0f2f5;
|
|
|
+}
|
|
|
+
|
|
|
+.r_b_itemActive {
|
|
|
+ box-sizing: border-box;
|
|
|
+ border: solid 1px #aeccfe;
|
|
|
+ color: #4d8ffb;
|
|
|
+}
|
|
|
+
|
|
|
+.r_b_item > img {
|
|
|
+ min-width: 24px;
|
|
|
+ min-height: 24px;
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ border-radius: 50%;
|
|
|
+ margin-right: 10px;
|
|
|
+ /* margin-left: 10px; */
|
|
|
+}
|
|
|
+
|
|
|
+.characterBlock {
|
|
|
+ display: flex;
|
|
|
+ background: rgba(54, 169, 252, 1);
|
|
|
+ width: 100%;
|
|
|
+ height: 80px;
|
|
|
+ margin: 0 auto;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ cursor: pointer;
|
|
|
+}
|
|
|
+.characterBlock > .imgLeft {
|
|
|
+ width: 100px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.characterBlock > .imgLeft > .img {
|
|
|
+ width: 60px;
|
|
|
+ height: 60px;
|
|
|
+ overflow: hidden;
|
|
|
+ border-radius: 50%;
|
|
|
+}
|
|
|
+.characterBlock > .imgLeft > .img2 {
|
|
|
+ width: 70px;
|
|
|
+ height: 70px;
|
|
|
+ overflow: hidden;
|
|
|
+ border-radius: 50%;
|
|
|
+}
|
|
|
+.characterBlock > .txtRight {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.characterBlock > .txtRight > .bir {
|
|
|
+ width: 180px;
|
|
|
+ height: 35px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 10px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 5px 10px;
|
|
|
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
|
+ margin-right: 10px;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+}
|
|
|
</style>
|