|
@@ -835,6 +835,8 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
morePrompt(uid, data){
|
|
morePrompt(uid, data){
|
|
|
|
+ this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-推荐更多按钮')
|
|
|
|
+
|
|
if(this.array.find(i => i.uid == uid).moreloading){
|
|
if(this.array.find(i => i.uid == uid).moreloading){
|
|
this.$message.error('生成中请稍后')
|
|
this.$message.error('生成中请稍后')
|
|
return
|
|
return
|
|
@@ -919,6 +921,11 @@ Instruction: Based on the context, follow "Format example", write content.`
|
|
|
|
|
|
},
|
|
},
|
|
quickAdd(data, pr){
|
|
quickAdd(data, pr){
|
|
|
|
+ if(this.faloading){
|
|
|
|
+ this.$message.error('请等待回答完毕在发送')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-推荐按钮发送')
|
|
this.faloading = true;
|
|
this.faloading = true;
|
|
let string = `## 参考资料
|
|
let string = `## 参考资料
|
|
${data.area + ':' + data.value}
|
|
${data.area + ':' + data.value}
|
|
@@ -950,7 +957,7 @@ ${data.area + ':' + data.value}
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
});
|
|
});
|
|
let params = {
|
|
let params = {
|
|
- assistant_id: 'b19f1a1a-7586-11ef-8ce0-12e77c4cb76b',
|
|
|
|
|
|
+ id: 'adfdb66c-9108-11ef-a04e-12e77c4cb76b',
|
|
userId: this.userid,
|
|
userId: this.userid,
|
|
message: _replaceText,
|
|
message: _replaceText,
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
@@ -961,7 +968,7 @@ ${data.area + ':' + data.value}
|
|
};
|
|
};
|
|
|
|
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
|
|
|
+ .post("https://llm.cocorobo.cn/agent/ai_agent_chat_new", params)
|
|
.then(res => {
|
|
.then(res => {
|
|
if (
|
|
if (
|
|
converter(res.data.FunctionResponse.result) ==
|
|
converter(res.data.FunctionResponse.result) ==
|
|
@@ -974,13 +981,17 @@ ${data.area + ':' + data.value}
|
|
.catch(err => {
|
|
.catch(err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
- this.getAtAuContent(_uuid);
|
|
|
|
|
|
+ this.getAtAuContent2(_uuid);
|
|
this.saveUid = _uuid;
|
|
this.saveUid = _uuid;
|
|
this.courseText = "";
|
|
this.courseText = "";
|
|
},
|
|
},
|
|
addContent() {
|
|
addContent() {
|
|
if (this.courseText.trim().length == 0)
|
|
if (this.courseText.trim().length == 0)
|
|
return this.$message.error("请输入内容");
|
|
return this.$message.error("请输入内容");
|
|
|
|
+ if(this.faloading){
|
|
|
|
+ this.$message.error('请等待回答完毕在发送')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let message = this.courseText;
|
|
let message = this.courseText;
|
|
this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-发送按钮')
|
|
this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-发送按钮')
|
|
|
|
|
|
@@ -1107,7 +1118,7 @@ ${message}`;
|
|
session_name: `${this.courseId}-addCourseA`,
|
|
session_name: `${this.courseId}-addCourseA`,
|
|
uid: _uid,
|
|
uid: _uid,
|
|
file_ids: [...this.fileids],
|
|
file_ids: [...this.fileids],
|
|
- // model: "gpt-4o-mini"
|
|
|
|
|
|
+ model: "gpt-4o-mini"
|
|
// model: "qwen-plus"
|
|
// model: "qwen-plus"
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1187,7 +1198,7 @@ ${message}`;
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
});
|
|
});
|
|
let params = {
|
|
let params = {
|
|
- assistant_id: 'b19f1a1a-7586-11ef-8ce0-12e77c4cb76b',
|
|
|
|
|
|
+ id: 'adfdb66c-9108-11ef-a04e-12e77c4cb76b',
|
|
userId: this.userid,
|
|
userId: this.userid,
|
|
message: _replaceText,
|
|
message: _replaceText,
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
@@ -1198,7 +1209,7 @@ ${message}`;
|
|
};
|
|
};
|
|
|
|
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
|
|
|
+ .post("https://llm.cocorobo.cn/agent/ai_agent_chat_new", params)
|
|
.then(res => {
|
|
.then(res => {
|
|
if (
|
|
if (
|
|
converter(res.data.FunctionResponse.result) ==
|
|
converter(res.data.FunctionResponse.result) ==
|
|
@@ -1211,7 +1222,7 @@ ${message}`;
|
|
.catch(err => {
|
|
.catch(err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
- this.getAtAuContent(_uuid);
|
|
|
|
|
|
+ this.getAtAuContent2(_uuid);
|
|
this.saveUid = _uuid;
|
|
this.saveUid = _uuid;
|
|
this.courseText = "";
|
|
this.courseText = "";
|
|
// let params = JSON.stringify({
|
|
// let params = JSON.stringify({
|
|
@@ -1349,6 +1360,58 @@ ${message}`;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ getAtAuContent2(_uid) {
|
|
|
|
+ this.fasource = new EventSource(
|
|
|
|
+ `https://llm.cocorobo.cn/question/${_uid}`
|
|
|
|
+ ); //http://gpt4.cocorobo.cn:8011/question/ https://gpt4.cocorobo.cn/question/
|
|
|
|
+ let _allText = "";
|
|
|
|
+ let _mdText = "";
|
|
|
|
+ const md = new MarkdownIt();
|
|
|
|
+ this.fasource.onmessage = _e => {
|
|
|
|
+ let _eData = JSON.parse(_e.data);
|
|
|
|
+ if (_eData.content.replace("'", "").replace("'", "") == "[DONE]") {
|
|
|
|
+ let _result = [];
|
|
|
|
+ if ("result" in _eData) {
|
|
|
|
+ _result = _eData.result;
|
|
|
|
+ for (let i = 0; i < _result.length; i++) {
|
|
|
|
+ _mdText = _mdText.replace(_result[i].text, _result[i].fileName);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ _mdText = _mdText.replace("_", "");
|
|
|
|
+ this.array.find(i => i.uid == _uid).aiContent = _mdText;
|
|
|
|
+ this.array.find(i => i.uid == _uid).isalltext = true;
|
|
|
|
+ this.array.find(i => i.uid == _uid).isShowSynchronization = true;
|
|
|
|
+ this.array.find(i => i.uid == _uid).loading = false;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
|
+ });
|
|
|
|
+ this.fasource.close();
|
|
|
|
+ this.fasource = null;
|
|
|
|
+ if (this.courseId) {
|
|
|
|
+ this.insertChat(_uid);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let _text = _eData.content.replace("'", "").replace("'", "");
|
|
|
|
+ if (_allText == "") {
|
|
|
|
+ _allText = _text.replace(/^\n+/, ""); //去掉回复消息中偶尔开头就存在的连续换行符
|
|
|
|
+ } else {
|
|
|
|
+ _allText += _text;
|
|
|
|
+ }
|
|
|
|
+ _mdText = _allText + "_";
|
|
|
|
+ _mdText = _mdText.replace(/\\n/g, "\n");
|
|
|
|
+ _mdText = _mdText.replace(/\\/g, "");
|
|
|
|
+ if (_allText.split("```").length % 2 == 0) _mdText += "\n```\n";
|
|
|
|
+ //转化返回的回复流数据
|
|
|
|
+ _mdText = md.render(_mdText);
|
|
|
|
+ this.array.find(i => i.uid == _uid).aiContent = _mdText;
|
|
|
|
+ this.array.find(i => i.uid == _uid).loading = false;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
|
+ });
|
|
|
|
+ // 处理流数据
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ },
|
|
async getUserName() {
|
|
async getUserName() {
|
|
let params = { uid: this.userid };
|
|
let params = { uid: this.userid };
|
|
try {
|
|
try {
|
|
@@ -1617,6 +1680,7 @@ ${message}`;
|
|
this.showRoleList = false;
|
|
this.showRoleList = false;
|
|
},
|
|
},
|
|
onCopy(content) {
|
|
onCopy(content) {
|
|
|
|
+ this.$emit('addCourseBehavior', 'courseBehavior', '点击对话框-复制信息')
|
|
const turndownService = new TurndownService();
|
|
const turndownService = new TurndownService();
|
|
// 添加自定义规则来处理表格
|
|
// 添加自定义规则来处理表格
|
|
turndownService.addRule("table", {
|
|
turndownService.addRule("table", {
|