|
@@ -52,9 +52,9 @@
|
|
|
@click="onCopy(item.aiContent)"
|
|
|
/>
|
|
|
</div>
|
|
|
- <div class="ai_tips_btn_box" v-if="item.promptArray && item.promptArray.length">
|
|
|
- <span v-for="(pr, pindex) in item.promptArray" :key="pindex" @click="quickAdd(item.addedData, pr)">{{ pr.name }}</span>
|
|
|
- <span @click="moreClick(item.uid, item.addedData)" v-loading="item.moreloading && !item.moreDisplay2" v-if="item.moreDisplay">更多</span>
|
|
|
+ <div class="ai_tips_btn_box" v-if="chatTypeArray.includes(item.chatType)">
|
|
|
+ <!-- @click="quickAdd(item.addedData, pr)" -->
|
|
|
+ <span v-if="item.chatType == 'start'" @click="quickAdd('start')">追加议题</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -160,6 +160,12 @@
|
|
|
</svg>
|
|
|
<span>清屏</span>
|
|
|
</span>
|
|
|
+ <span class="clear" @click.stop="quickAdd('more')">
|
|
|
+ <span>更多课程灵感</span>
|
|
|
+ </span>
|
|
|
+ <span class="clear" @click.stop="quickAdd('summary')">
|
|
|
+ <span>总结并生成课程概况</span>
|
|
|
+ </span>
|
|
|
<!-- <div style="margin-left: auto;">
|
|
|
<el-switch v-model="continuous"></el-switch>
|
|
|
<span @click.stop="continuous = !continuous">连续对话</span>
|
|
@@ -228,7 +234,6 @@
|
|
|
|
|
|
<textarea
|
|
|
class="ai_body_input_textarea"
|
|
|
- @input="inputChange"
|
|
|
@keydown="textareaKeydown"
|
|
|
:disabled="isVoice"
|
|
|
ref="textareaRef"
|
|
@@ -413,6 +418,13 @@ export default {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
},
|
|
|
+ viedoText: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ agentid: {
|
|
|
+ type: String,
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -508,6 +520,12 @@ export default {
|
|
|
isVoice: false,
|
|
|
isTalk: false,
|
|
|
username: "",
|
|
|
+ chatTypeArray: ['start'],
|
|
|
+ agentJSON:{
|
|
|
+ model: '',
|
|
|
+ url: '',
|
|
|
+ start: ''
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -525,6 +543,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ agentid: {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ handler(newValue, oldValue) {
|
|
|
+ if (newValue) {
|
|
|
+ this.getAgent()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
removeMarkdownSymbols(text) {
|
|
@@ -578,6 +605,77 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ quickAdd(type){
|
|
|
+ if(this.faloading){
|
|
|
+ this.$message.error('请等待回答完毕在发送')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-推荐按钮发送')
|
|
|
+ this.faloading = true;
|
|
|
+ let content = ''
|
|
|
+ if(type == 'start'){
|
|
|
+ content = '追加议题'
|
|
|
+ }
|
|
|
+ let string = `## 引用内容
|
|
|
+${this.viedoText}
|
|
|
+
|
|
|
+## 要求
|
|
|
+根据<引用内容>中的内容实现以下要求:${content}`
|
|
|
+
|
|
|
+ let _uuid = uuidv4();
|
|
|
+ this.array.push({
|
|
|
+ role: "user",
|
|
|
+ content: `${content}`,
|
|
|
+ uid: _uuid,
|
|
|
+ AI: "AI",
|
|
|
+ aiContent: "",
|
|
|
+ oldContent: "",
|
|
|
+ isShowSynchronization: false,
|
|
|
+ filename: "",
|
|
|
+ index: this.array.length,
|
|
|
+ is_mind_map: false,
|
|
|
+ createtime: new Date().toLocaleString().replaceAll("/", "-"),
|
|
|
+ loading: true
|
|
|
+ });
|
|
|
+ // 注意:输出语言为${this.getLang2()}
|
|
|
+
|
|
|
+ let _replaceText = `NOTICE
|
|
|
+ Language: ${this.getLang()}
|
|
|
+ ${string}`;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
+ });
|
|
|
+ let params = {
|
|
|
+ id: this.agentid,
|
|
|
+ userId: this.userid,
|
|
|
+ message: _replaceText,
|
|
|
+ session_name: this.continuous ? `${this.courseId}-courseDetail` : uuidv4(),
|
|
|
+ uid: _uuid,
|
|
|
+ model: this.agentJSON.model,
|
|
|
+ sound_url: "",
|
|
|
+ file_ids: this.agentJSON.model.includes('qwen') ? [] : [...this.fileids],//...this.fileids
|
|
|
+ // model: "gpt-4o-mini"
|
|
|
+ // model: "qwen-plus"
|
|
|
+ };
|
|
|
+
|
|
|
+ this.ajax
|
|
|
+ .post(`${this.agentJSON.url.includes("llm") ? this.agentJSON.url+'/agent' : this.agentJSON.url}/ai_agent_chat_new`, params)
|
|
|
+ .then(res => {
|
|
|
+ if (
|
|
|
+ converter(res.data.FunctionResponse.result) ==
|
|
|
+ converter("发送成功")
|
|
|
+ ) {
|
|
|
+ } else {
|
|
|
+ this.$message.warning(res.data.FunctionResponse.result);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+ this.getAtAuContent2(_uuid);
|
|
|
+ this.saveUid = _uuid;
|
|
|
+ this.courseText = "";
|
|
|
+ },
|
|
|
addContent() {
|
|
|
if (this.courseText.trim().length == 0)
|
|
|
return this.$message.error("请输入内容");
|
|
@@ -622,7 +720,19 @@ ATTENTION: Use '##' to SPLIT SECTIONS, not '#'.Output format carefully reference
|
|
|
`;
|
|
|
message = msg;
|
|
|
}
|
|
|
+ if(this.viedoText){
|
|
|
+ let msg = ``;
|
|
|
+ msg += `
|
|
|
+ ## 引用内容
|
|
|
+ ${this.viedoText}
|
|
|
+ `;
|
|
|
|
|
|
+ msg += `
|
|
|
+ ## 要求
|
|
|
+ ${this.courseText}
|
|
|
+ `;
|
|
|
+ message = msg;
|
|
|
+ }
|
|
|
// 这里处理@的角色
|
|
|
let _atRoleList = [];
|
|
|
let _roleList = [...this.roleList, ...this.publicRoleList];
|
|
@@ -755,7 +865,7 @@ ${message}`;
|
|
|
// history = history.filter(
|
|
|
// i =>
|
|
|
// i.content !=
|
|
|
-// "您好,我是您的创课助手小可,在创课中遇到什么问题,都可以与我对话~,我会尽量帮助您的"
|
|
|
+// this.agentJSON.start
|
|
|
// );
|
|
|
|
|
|
// history = history.map(i => ({
|
|
@@ -773,20 +883,19 @@ ${message}`;
|
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
});
|
|
|
let params = {
|
|
|
- id: '957e191f-92a6-11ef-a04e-12e77c4cb76b',
|
|
|
+ id: this.agentid,
|
|
|
userId: this.userid,
|
|
|
message: _replaceText,
|
|
|
session_name: this.continuous ? `${this.courseId}-courseDetail` : uuidv4(),
|
|
|
- model: "qwen-plus-own",
|
|
|
+ model: this.agentJSON.model,
|
|
|
sound_url: "",
|
|
|
uid: _uuid,
|
|
|
- file_ids: [],//...this.fileids
|
|
|
+ file_ids: this.agentJSON.model.includes('qwen') ? [] : [...this.fileids],//...this.fileids
|
|
|
// model: "gpt-4o-mini"
|
|
|
// model: "qwen-plus"
|
|
|
};
|
|
|
-
|
|
|
this.ajax
|
|
|
- .post("https://llm.cocorobo.cn/agent/ai_agent_chat_new", params)
|
|
|
+ .post(`${this.agentJSON.url.includes("llm") ? this.agentJSON.url+'/agent' : this.agentJSON.url}/ai_agent_chat_new`, params)
|
|
|
.then(res => {
|
|
|
if (
|
|
|
converter(res.data.FunctionResponse.result) ==
|
|
@@ -939,7 +1048,7 @@ ${message}`;
|
|
|
},
|
|
|
getAtAuContent2(_uid) {
|
|
|
this.fasource = new EventSource(
|
|
|
- `https://llm.cocorobo.cn/question/${_uid}`
|
|
|
+ `${this.agentJSON.url}/question/${_uid}`
|
|
|
); //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
|
|
|
let _allText = "";
|
|
|
let _mdText = "";
|
|
@@ -1026,9 +1135,36 @@ ${message}`;
|
|
|
.post("https://gpt4.cocorobo.cn/insert_chat", params)
|
|
|
.then(res => {});
|
|
|
},
|
|
|
+ getAgent(){
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let params = {
|
|
|
+ id: this.agentid
|
|
|
+ };
|
|
|
+ this.ajax
|
|
|
+ .post("https://gpt4.cocorobo.cn/get_ai_agent_assistant_id", params)
|
|
|
+ .then(res => {
|
|
|
+ let _data = JSON.parse(res.data.FunctionResponse.result);
|
|
|
+ console.log(res);
|
|
|
+
|
|
|
+ if (_data.length > 0) {
|
|
|
+ this.agentJSON = {
|
|
|
+ model: _data[0].modelType == 'GPT' ? "gpt-4o-2024-08-06" : _data[0].modelType,
|
|
|
+ url: _data[0].modelType.includes('qwen') ? 'https://llm.cocorobo.cn' : 'https://gpt4.cocorobo.cn',
|
|
|
+ start: _data[0].prologue ? _data[0].prologue : '您好,我是您的创课助手小可,在创课中遇到什么问题,都可以与我对话~,我会尽量帮助您的'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
// 获取对应的聊天记录
|
|
|
getChatList() {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ if(!this.agentJSON.model){ await this.getAgent() }
|
|
|
if (this.loading) return;
|
|
|
this.array = [];
|
|
|
this.loading = true;
|
|
@@ -1072,15 +1208,15 @@ ${message}`;
|
|
|
content: "",
|
|
|
uid: _uid,
|
|
|
AI: "AI",
|
|
|
- aiContent:
|
|
|
- "您好,我是您的创课助手小可,在创课中遇到什么问题,都可以与我对话~,我会尽量帮助您的",
|
|
|
- oldContent:
|
|
|
- "您好,我是您的创课助手小可,在创课中遇到什么问题,都可以与我对话~,我会尽量帮助您的",
|
|
|
+ aiContent: this.agentJSON.start,
|
|
|
+ oldContent: this.agentJSON.start,
|
|
|
isShowSynchronization: false,
|
|
|
filename: "",
|
|
|
index: 0,
|
|
|
is_mind_map: false,
|
|
|
- fileid: ""
|
|
|
+ fileid: "",
|
|
|
+ createtime: new Date().toLocaleString().replaceAll("/", "-"),
|
|
|
+ chatType: 'start'
|
|
|
});
|
|
|
this.array = _chatList;
|
|
|
if (this.courseId) {
|
|
@@ -1198,6 +1334,7 @@ ${message}`;
|
|
|
this.array = [];
|
|
|
this.$message.success("清除聊天记录成功");
|
|
|
this.loading = false;
|
|
|
+ this.getChatList()
|
|
|
})
|
|
|
.catch(err => {
|
|
|
this.loading = false;
|
|
@@ -1401,9 +1538,9 @@ ${message}`;
|
|
|
// this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
// });
|
|
|
// });
|
|
|
- this.getRoleList();
|
|
|
- this.getPublicRoleList();
|
|
|
- this.jArray = this.getString();
|
|
|
+ // this.getRoleList();
|
|
|
+ // this.getPublicRoleList();
|
|
|
+ // this.jArray = this.getString();
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
@@ -2101,7 +2238,7 @@ ${message}`;
|
|
|
width: 100%;
|
|
|
padding: 0 20px 0 50px;
|
|
|
display: flex;
|
|
|
- flex-direction: column;
|
|
|
+ flex-wrap: wrap;
|
|
|
margin-top: 27px;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
@@ -2114,6 +2251,7 @@ ${message}`;
|
|
|
padding: 8px;
|
|
|
border-radius: 5px;
|
|
|
transition: all .3s;
|
|
|
+ margin-right: 5px;
|
|
|
}
|
|
|
|
|
|
.ai_tips_btn_box > span + span{
|