|
@@ -207,7 +207,13 @@
|
|
:disabled="isVoice"
|
|
:disabled="isVoice"
|
|
ref="textareaRef"
|
|
ref="textareaRef"
|
|
v-model.trim="courseText"
|
|
v-model.trim="courseText"
|
|
- :placeholder="isVoice ? isTalk?'':'点击按钮开始录音' : '在此输入您想了解的内容'"
|
|
|
|
|
|
+ :placeholder="
|
|
|
|
+ isVoice
|
|
|
|
+ ? isTalk
|
|
|
|
+ ? ''
|
|
|
|
+ : '点击按钮开始录音'
|
|
|
|
+ : '在此输入您想了解的内容'
|
|
|
|
+ "
|
|
></textarea>
|
|
></textarea>
|
|
|
|
|
|
<span
|
|
<span
|
|
@@ -322,7 +328,7 @@
|
|
终止
|
|
终止
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <iframe
|
|
|
|
|
|
+ <iframe
|
|
allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
allow="camera *; microphone *;display-capture;midi;encrypted-media;"
|
|
src="https://beta.cloud.cocorobo.cn/browser/public/index.html"
|
|
src="https://beta.cloud.cocorobo.cn/browser/public/index.html"
|
|
ref="iiframe"
|
|
ref="iiframe"
|
|
@@ -480,10 +486,11 @@ export default {
|
|
8: "日期",
|
|
8: "日期",
|
|
9: "单选题",
|
|
9: "单选题",
|
|
10: "多选题",
|
|
10: "多选题",
|
|
- 11: "课程",
|
|
|
|
|
|
+ 11: "课程"
|
|
},
|
|
},
|
|
answerArray: [],
|
|
answerArray: [],
|
|
- fileId: []
|
|
|
|
|
|
+ fileId: [],
|
|
|
|
+ fileList: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -501,18 +508,19 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- worksArray :{
|
|
|
|
|
|
+ worksArray: {
|
|
immediate: true,
|
|
immediate: true,
|
|
deep: true,
|
|
deep: true,
|
|
handler(newValue, oldValue) {
|
|
handler(newValue, oldValue) {
|
|
if (newValue.length) {
|
|
if (newValue.length) {
|
|
- console.log('newValue',newValue);
|
|
|
|
- this.$emit("clearFileData")
|
|
|
|
- this.fileId = [];
|
|
|
|
- newValue.forEach(el=>{
|
|
|
|
- this.setJson(el)
|
|
|
|
- })
|
|
|
|
- // console.log("👈👉",newValue)
|
|
|
|
|
|
+ console.log("newValue", newValue);
|
|
|
|
+ this.$emit("clearFileData");
|
|
|
|
+ this.fileId = [];
|
|
|
|
+ this.fileList = [];
|
|
|
|
+ newValue.forEach(el => {
|
|
|
|
+ this.setJson(el);
|
|
|
|
+ });
|
|
|
|
+ // console.log("👈👉",newValue)
|
|
// this.setJson(newValue)
|
|
// this.setJson(newValue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -566,42 +574,51 @@ export default {
|
|
// // 如果仍需要上传文件,可以保留这行
|
|
// // 如果仍需要上传文件,可以保留这行
|
|
// return this.uploadFile(blob);
|
|
// return this.uploadFile(blob);
|
|
// },
|
|
// },
|
|
- setJson(obj){
|
|
|
|
- let array = obj.worksArray
|
|
|
|
- let name = obj.name
|
|
|
|
- console.log(obj)
|
|
|
|
- console.log(array)
|
|
|
|
|
|
+ setJson(obj) {
|
|
|
|
+ let array = obj.worksArray;
|
|
|
|
+ let name = obj.name;
|
|
|
|
|
|
- const getAnswer = (j) => {
|
|
|
|
|
|
+ const getAnswer = j => {
|
|
if (j.type === 1) {
|
|
if (j.type === 1) {
|
|
return j.json.array
|
|
return j.json.array
|
|
.filter((_, idx) => j.json.answer2.includes(idx))
|
|
.filter((_, idx) => j.json.answer2.includes(idx))
|
|
.map(item => `${item.img}${item.option}`)
|
|
.map(item => `${item.img}${item.option}`)
|
|
- .join(',');
|
|
|
|
- } else if (j.type === 3 || j.type === 6 || j.type === 7 || j.type === 8 || j.type === 11) {
|
|
|
|
|
|
+ .join(",");
|
|
|
|
+ } else if (
|
|
|
|
+ j.type === 3 ||
|
|
|
|
+ j.type === 6 ||
|
|
|
|
+ j.type === 7 ||
|
|
|
|
+ j.type === 8 ||
|
|
|
|
+ j.type === 11
|
|
|
|
+ ) {
|
|
console.log(j.json);
|
|
console.log(j.json);
|
|
- return typeof j.json.answer2 === 'string' ? j.json.answer2.replace(/\n/g, ' ') : j.json.answer2;
|
|
|
|
|
|
+ return typeof j.json.answer2 === "string"
|
|
|
|
+ ? j.json.answer2.replace(/\n/g, " ")
|
|
|
|
+ : j.json.answer2;
|
|
} else if (j.type === 5) {
|
|
} else if (j.type === 5) {
|
|
if (!Array.isArray(j.json.file) || j.json.file.length === 0) {
|
|
if (!Array.isArray(j.json.file) || j.json.file.length === 0) {
|
|
- return '无附件';
|
|
|
|
|
|
+ return "无附件";
|
|
}
|
|
}
|
|
- return j.json.file.map(file => `${file.name}(${file.url})`).join(',');
|
|
|
|
|
|
+ return j.json.file
|
|
|
|
+ .map(file => `${file.name}(${file.url})`)
|
|
|
|
+ .join(",");
|
|
} else {
|
|
} else {
|
|
- return '';
|
|
|
|
|
|
+ return "";
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
// 获取所有题目类型和题目
|
|
// 获取所有题目类型和题目
|
|
const questions = array[0].array.map((j, index) => ({
|
|
const questions = array[0].array.map((j, index) => ({
|
|
- "序号": index + 1,
|
|
|
|
- "题目类型": this.options2[j.type],
|
|
|
|
- "题目": j.json.title
|
|
|
|
|
|
+ 序号: index + 1,
|
|
|
|
+ 题目类型: this.options2[j.type],
|
|
|
|
+ 题目: j.json.title
|
|
}));
|
|
}));
|
|
|
|
|
|
- console.log(questions)
|
|
|
|
-
|
|
|
|
|
|
+ console.log(questions);
|
|
|
|
+ // let csvContent = "data:text/csv;charset=utf-8,"
|
|
// 构建CSV内容
|
|
// 构建CSV内容
|
|
- let csvContent = "用户名 | 提交时间 | " + questions.map(q => `${q.序号}-${q.题目类型}-${q.题目}`).join(' | ') + "\n";
|
|
|
|
|
|
+ // let csvContent = "用户名 | 提交时间 | " + questions.map(q => `${q.序号}-${q.题目类型}-${q.题目}`).join(' | ') + "\n";
|
|
|
|
+ let csvContent = "用户名,提交时间,"+ questions.map(q => `${q.序号}-${q.题目类型}-${q.题目}`).join(",") +"\n";
|
|
|
|
|
|
// 添加每个用户的答案
|
|
// 添加每个用户的答案
|
|
array.forEach(i => {
|
|
array.forEach(i => {
|
|
@@ -609,18 +626,24 @@ export default {
|
|
i.array.forEach(j => {
|
|
i.array.forEach(j => {
|
|
row.push(getAnswer(j));
|
|
row.push(getAnswer(j));
|
|
});
|
|
});
|
|
- csvContent += row.join(' | ') + "\n";
|
|
|
|
|
|
+ // csvContent += row.join(' | ') + "\n";
|
|
|
|
+ csvContent += row.join(",") + "\n";
|
|
});
|
|
});
|
|
|
|
|
|
// 创建Blob对象
|
|
// 创建Blob对象
|
|
- const blob = new Blob([csvContent], { type: "text/plain;charset=utf-8" });
|
|
|
|
|
|
+ // const blob = new Blob([csvContent], { type: "text/plain;charset=utf-8" });
|
|
|
|
+ // blob.lastModifiedDate = new Date();
|
|
|
|
+ // blob.name = `${name}_表单数据.txt`;
|
|
|
|
+
|
|
|
|
+ // 创建Blob对象
|
|
|
|
+ const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8" });
|
|
blob.lastModifiedDate = new Date();
|
|
blob.lastModifiedDate = new Date();
|
|
- blob.name = `${name}_表单数据.txt`;
|
|
|
|
|
|
+ blob.name = `${name}_表单数据.csv`;
|
|
|
|
|
|
// 如果仍需要上传文件,可以保留这行
|
|
// 如果仍需要上传文件,可以保留这行
|
|
- return this.uploadFile({file:blob,name:name});
|
|
|
|
|
|
+ return this.uploadFile({ file: blob, name: name });
|
|
},
|
|
},
|
|
- uploadFile({file,name}) {
|
|
|
|
|
|
+ uploadFile({ file, name }) {
|
|
var credentials = {
|
|
var credentials = {
|
|
accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
accessKeyId: "AKIATLPEDU37QV5CHLMH",
|
|
secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR"
|
|
secretAccessKey: "Q2SQw37HfolS7yeaR1Ndpy9Jl4E2YZKUuuy2muZR"
|
|
@@ -670,11 +693,15 @@ export default {
|
|
let _data = res.data.FunctionResponse;
|
|
let _data = res.data.FunctionResponse;
|
|
if (_data.result && _data.result.id) {
|
|
if (_data.result && _data.result.id) {
|
|
_this.fileId.push(_data.result.id);
|
|
_this.fileId.push(_data.result.id);
|
|
- _this.$emit("pushFileData",{fileId:_data.result.id,name:name,url:data.Location})
|
|
|
|
|
|
+ _this.fileList.push(data.Location);
|
|
|
|
+ _this.$emit("pushFileData", {
|
|
|
|
+ fileId: _data.result.id,
|
|
|
|
+ name: name,
|
|
|
|
+ url: data.Location
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
console.error("获取fileId失败");
|
|
console.error("获取fileId失败");
|
|
}
|
|
}
|
|
-
|
|
|
|
})
|
|
})
|
|
.catch(e => {
|
|
.catch(e => {
|
|
console.log(e);
|
|
console.log(e);
|
|
@@ -802,9 +829,33 @@ export default {
|
|
model: "qwen-plus"
|
|
model: "qwen-plus"
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // let params = {
|
|
|
|
+ // prompt: _replaceText,
|
|
|
|
+ // message: [],
|
|
|
|
+ // file: this.fileId ? this.fileId : []
|
|
|
|
+ // };
|
|
|
|
+
|
|
this.ajax
|
|
this.ajax
|
|
.post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
.post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
|
+ // .post("http://gpt4.cocorobo.cn/csvaimessage", params)
|
|
.then(res => {
|
|
.then(res => {
|
|
|
|
+ // let data = res.FunctionResponse;
|
|
|
|
+ // const md = new MarkdownIt();
|
|
|
|
+ // const text = md.render(data);
|
|
|
|
+ // this.array.find(i => i.uid == _uid).aiContent = text;
|
|
|
|
+ // 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);
|
|
|
|
+ // }
|
|
if (
|
|
if (
|
|
converter(res.data.FunctionResponse.result) ==
|
|
converter(res.data.FunctionResponse.result) ==
|
|
converter("发送成功")
|
|
converter("发送成功")
|
|
@@ -890,35 +941,58 @@ export default {
|
|
// console.log(e);
|
|
// console.log(e);
|
|
// });
|
|
// });
|
|
// this.getAiContent(_uuid);\
|
|
// this.getAiContent(_uuid);\
|
|
|
|
+ // let params = {
|
|
|
|
+ // assistant_id: "cd72354e-7be5-11ef-a263-12e77c4cb76b",
|
|
|
|
+ // userId: this.userid,
|
|
|
|
+ // message: `Role: 你是数据检索大师,可以利用file_search的方式完整的去分析文件内容 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.\n${message}`,
|
|
|
|
+ // session_name: `${this.courseId}-${this.userid}-test`,
|
|
|
|
+ // uid: _uuid,
|
|
|
|
+ // file_ids: this.fileId ? this.fileId : [],
|
|
|
|
+ // model: "gpt-4o-mini"
|
|
|
|
+ // };
|
|
|
|
+
|
|
let params = {
|
|
let params = {
|
|
- assistant_id: 'cd72354e-7be5-11ef-a263-12e77c4cb76b',
|
|
|
|
- userId: this.userid,
|
|
|
|
- message: `Role: 你是数据检索大师,可以利用file_search的方式完整的去分析文件内容 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.\n${message}`,
|
|
|
|
- session_name: `${this.courseId}-${this.userid}-test`,
|
|
|
|
- uid: _uuid,
|
|
|
|
- file_ids: this.fileId ? this.fileId : [],
|
|
|
|
- model: "gpt-4o-mini"
|
|
|
|
|
|
+ prompt: message,
|
|
|
|
+ messages: [],
|
|
|
|
+ file: this.fileList ? this.fileList : []
|
|
};
|
|
};
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
});
|
|
});
|
|
this.courseText = "";
|
|
this.courseText = "";
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
|
|
|
+ // .post("https://gpt4.cocorobo.cn/ai_agent_park_chat_new", params)
|
|
|
|
+ .post("http://gpt4.cocorobo.cn/csvaimessage", params)
|
|
.then(res => {
|
|
.then(res => {
|
|
- if (
|
|
|
|
- converter(res.data.FunctionResponse.result) ==
|
|
|
|
- converter("发送成功")
|
|
|
|
- ) {
|
|
|
|
- } else {
|
|
|
|
- this.$message.warning(res.data.FunctionResponse.result);
|
|
|
|
|
|
+ // if (
|
|
|
|
+ // converter(res.data.FunctionResponse.result) ==
|
|
|
|
+ // converter("发送成功")
|
|
|
|
+ // ) {
|
|
|
|
+ // } else {
|
|
|
|
+ // this.$message.warning(res.data.FunctionResponse.result);
|
|
|
|
+ // }
|
|
|
|
+ console.log(res);
|
|
|
|
+ let data = res.data.FunctionResponse;
|
|
|
|
+ console.log(data);
|
|
|
|
+ const md = new MarkdownIt();
|
|
|
|
+ const text = md.render(data);
|
|
|
|
+ this.array.find(i => i.uid == _uuid).aiContent = text;
|
|
|
|
+ this.array.find(i => i.uid == _uuid).isalltext = true;
|
|
|
|
+ this.array.find(i => i.uid == _uuid).isShowSynchronization = true;
|
|
|
|
+ this.array.find(i => i.uid == _uuid).loading = false;
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ this.$refs.chatDialog.scrollTop = this.$refs.chatDialog.scrollHeight;
|
|
|
|
+ });
|
|
|
|
+ if (this.courseId) {
|
|
|
|
+ this.insertChat(_uuid);
|
|
|
|
+ this.saveUid = _uuid;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch(err => {
|
|
.catch(err => {
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
- this.getAtAuContent(_uuid);
|
|
|
|
- this.saveUid = _uuid;
|
|
|
|
|
|
+ // this.getAtAuContent(_uuid);
|
|
|
|
+ // this.saveUid = _uuid;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -1026,7 +1100,10 @@ export default {
|
|
async getUserName() {
|
|
async getUserName() {
|
|
let params = { uid: this.userid };
|
|
let params = { uid: this.userid };
|
|
try {
|
|
try {
|
|
- let res = await this.ajax.get(this.$store.state.api + "getUser", params);
|
|
|
|
|
|
+ let res = await this.ajax.get(
|
|
|
|
+ this.$store.state.api + "getUser",
|
|
|
|
+ params
|
|
|
|
+ );
|
|
this.username = res.data[0][0].name;
|
|
this.username = res.data[0][0].name;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
console.error(err);
|
|
console.error(err);
|
|
@@ -1035,10 +1112,10 @@ export default {
|
|
//保存消息
|
|
//保存消息
|
|
async insertChat(_uid) {
|
|
async insertChat(_uid) {
|
|
let _data = this.array.find(i => i.uid == _uid);
|
|
let _data = this.array.find(i => i.uid == _uid);
|
|
- this.saveUid = ''
|
|
|
|
- this.faloading = false
|
|
|
|
- if(!this.username){
|
|
|
|
- await this.getUserName()
|
|
|
|
|
|
+ this.saveUid = "";
|
|
|
|
+ this.faloading = false;
|
|
|
|
+ if (!this.username) {
|
|
|
|
+ await this.getUserName();
|
|
}
|
|
}
|
|
if (!_data) return;
|
|
if (!_data) return;
|
|
let params = {
|
|
let params = {
|
|
@@ -1103,10 +1180,8 @@ export default {
|
|
content: "",
|
|
content: "",
|
|
uid: _uid,
|
|
uid: _uid,
|
|
AI: "AI",
|
|
AI: "AI",
|
|
- aiContent:
|
|
|
|
- "您好,我是您的助手小可",
|
|
|
|
- oldContent:
|
|
|
|
- "您好,我是您的助手小可",
|
|
|
|
|
|
+ aiContent: "您好,我是您的助手小可",
|
|
|
|
+ oldContent: "您好,我是您的助手小可",
|
|
isShowSynchronization: false,
|
|
isShowSynchronization: false,
|
|
filename: "",
|
|
filename: "",
|
|
index: 0,
|
|
index: 0,
|
|
@@ -1351,7 +1426,7 @@ export default {
|
|
this.isVoice = flag;
|
|
this.isVoice = flag;
|
|
},
|
|
},
|
|
startVoice() {
|
|
startVoice() {
|
|
- let iiframe = this.$refs["iiframe"];
|
|
|
|
|
|
+ let iiframe = this.$refs["iiframe"];
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
iiframe.contentWindow.window.document.getElementById(
|
|
"languageOptions"
|
|
"languageOptions"
|
|
).selectedIndex = 2; //普通话
|
|
).selectedIndex = 2; //普通话
|
|
@@ -1363,8 +1438,8 @@ export default {
|
|
if (_msg) this.courseText += _msg;
|
|
if (_msg) this.courseText += _msg;
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- stopVoice(){
|
|
|
|
- try {
|
|
|
|
|
|
+ stopVoice() {
|
|
|
|
+ try {
|
|
if (!this.isTalk) return this.$message.info("请先开始录音");
|
|
if (!this.isTalk) return this.$message.info("请先开始录音");
|
|
let iiframe = this.$refs["iiframe"];
|
|
let iiframe = this.$refs["iiframe"];
|
|
iiframe.contentWindow.window.document
|
|
iiframe.contentWindow.window.document
|
|
@@ -1383,7 +1458,7 @@ export default {
|
|
this.addContent();
|
|
this.addContent();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
pan() {
|
|
pan() {
|
|
@@ -1432,9 +1507,9 @@ export default {
|
|
// });
|
|
// });
|
|
// });
|
|
// });
|
|
// if(this.worksArray.length){
|
|
// if(this.worksArray.length){
|
|
- // this.worksArray.forEach(el=>{
|
|
|
|
- // this.setJson(el)
|
|
|
|
- // })
|
|
|
|
|
|
+ // this.worksArray.forEach(el=>{
|
|
|
|
+ // this.setJson(el)
|
|
|
|
+ // })
|
|
// }
|
|
// }
|
|
this.getRoleList();
|
|
this.getRoleList();
|
|
this.getPublicRoleList();
|
|
this.getPublicRoleList();
|
|
@@ -1446,8 +1521,8 @@ export default {
|
|
.ai_body {
|
|
.ai_body {
|
|
/* height: calc(100% - 158px - 46px);
|
|
/* height: calc(100% - 158px - 46px);
|
|
width: 500px; */
|
|
width: 500px; */
|
|
- height: 100%;
|
|
|
|
- width: 100%;
|
|
|
|
|
|
+ height: 100%;
|
|
|
|
+ width: 100%;
|
|
/* margin: 0 auto; */
|
|
/* margin: 0 auto; */
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|