|
@@ -54,7 +54,7 @@
|
|
|
</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="morePrompt(item.uid, item.addedData)" v-loading="item.moreloading">更多</span>
|
|
|
+ <span @click="moreClick(item.uid, item.addedData)" v-loading="item.moreloading && !item.moreDisplay2" v-if="item.moreDisplay">更多</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -706,7 +706,7 @@ export default {
|
|
|
const md = new MarkdownIt();
|
|
|
let content = `根据您引用的内容, 猜您想让小可...
|
|
|
\`\`\`
|
|
|
- ${addedData[0].area + ':' + (addedData[0].value.length > 200 ? addedData[0].value.slice(0, 200) + '...' : addedData[0].value)}
|
|
|
+ ${addedData[0].area + ':' + (this.removeMarkdownSymbols(addedData[0].value).slice(0, 50) + (this.removeMarkdownSymbols(addedData[0].value).length > 50 ? '...' : ''))}
|
|
|
\`\`\`
|
|
|
`
|
|
|
this.array.push({
|
|
@@ -724,6 +724,10 @@ export default {
|
|
|
fileid: "",
|
|
|
createtime: new Date().toLocaleString().replaceAll("/", "-"),
|
|
|
addedData: addedData[0],
|
|
|
+ moreDisplay: true,
|
|
|
+ moreDisplay2: true,
|
|
|
+ moreArray: [],
|
|
|
+ moreloading: false,
|
|
|
promptArray: promptJson[Object.keys(promptJson).find(item => addedData[0].string.includes(item))] || []
|
|
|
});
|
|
|
console.log('新增数据:', addedData);
|
|
@@ -734,6 +738,7 @@ export default {
|
|
|
if (this.courseId) {
|
|
|
this.insertChat(_uid);
|
|
|
}
|
|
|
+ this.morePrompt(_uid, addedData[0])
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -743,6 +748,19 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ removeMarkdownSymbols(text) {
|
|
|
+ return text
|
|
|
+ .replace(/(?:\*\*|__)(.*?)\1/g, '$1') // 加粗
|
|
|
+ .replace(/(?:\*|_)(.*?)\1/g, '$1') // 斜体
|
|
|
+ .replace(/`(.*?)`/g, '$1') // 代码
|
|
|
+ .replace(/^(#{1,6})\s*(.*)$/gm, '$2') // 标题
|
|
|
+ .replace(/^\s*[-*+]\s+/gm, '') // 无序列表
|
|
|
+ .replace(/^\s*\d+\.\s+/gm, '') // 有序列表
|
|
|
+ .replace(/\[([^\]]+)\]\([^\)]+\)/g, '$1') // 链接
|
|
|
+ .replace(/>\s+/g, '') // 引用
|
|
|
+ .replace(/\n/g, '')
|
|
|
+ .replaceAll(' ', '');
|
|
|
+ },
|
|
|
getLang() {
|
|
|
let lang = "";
|
|
|
if (this.languageSetting == 0) {
|
|
@@ -754,6 +772,17 @@ export default {
|
|
|
}
|
|
|
return lang;
|
|
|
},
|
|
|
+ getLang2() {
|
|
|
+ let lang = "";
|
|
|
+ if (this.languageSetting == 0) {
|
|
|
+ lang = "中文。";
|
|
|
+ } else if (this.languageSetting == 1) {
|
|
|
+ lang = "繁体中文。";
|
|
|
+ } else if (this.languageSetting == 2) {
|
|
|
+ lang = "英文。";
|
|
|
+ }
|
|
|
+ return lang;
|
|
|
+ },
|
|
|
cancelJ(string) {
|
|
|
this.$emit("setIsQuote", string);
|
|
|
},
|
|
@@ -907,8 +936,17 @@ Instruction: Based on the context, follow "Format example", write content.`
|
|
|
console.log("error_________________" + error);
|
|
|
}
|
|
|
}
|
|
|
- _this.array.find(i => i.uid == uid).promptArray = [..._this.array.find(i => i.uid == uid).promptArray, ...dArray]
|
|
|
- _this.array.find(i => i.uid == uid).moreloading = false;
|
|
|
+
|
|
|
+ if(_this.array.find(i => i.uid == uid).moreDisplay2){
|
|
|
+ _this.array.find(i => i.uid == uid).moreArray = [...dArray]
|
|
|
+ _this.array.find(i => i.uid == uid).moreloading = false;
|
|
|
+ }else{
|
|
|
+ _this.array.find(i => i.uid == uid).promptArray = [..._this.array.find(i => i.uid == uid).promptArray, ...dArray]
|
|
|
+ _this.array.find(i => i.uid == uid).moreloading = false;
|
|
|
+ _this.array.find(i => i.uid == uid).moreDisplay = false
|
|
|
+ _this.array.find(i => i.uid == uid).moreDisplay = false
|
|
|
+ }
|
|
|
+
|
|
|
_this.$forceUpdate();
|
|
|
}
|
|
|
|
|
@@ -920,6 +958,17 @@ Instruction: Based on the context, follow "Format example", write content.`
|
|
|
});
|
|
|
|
|
|
},
|
|
|
+ moreClick(uid, data){
|
|
|
+ if(this.array.find(i => i.uid == uid).moreArray.length){
|
|
|
+ this.array.find(i => i.uid == uid).promptArray = [...this.array.find(i => i.uid == uid).promptArray, ...this.array.find(i => i.uid == uid).promptArray]
|
|
|
+ this.array.find(i => i.uid == uid).moreDisplay = false
|
|
|
+ }else{
|
|
|
+ this.array.find(i => i.uid == uid).moreDisplay2 = false
|
|
|
+ if(!this.array.find(i => i.uid == uid).moreloading){
|
|
|
+ this.morePrompt(uid, data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
quickAdd(data, pr){
|
|
|
if(this.faloading){
|
|
|
this.$message.error('请等待回答完毕在发送')
|
|
@@ -948,10 +997,10 @@ ${data.area + ':' + data.value}
|
|
|
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;
|
|
@@ -962,6 +1011,8 @@ ${data.area + ':' + data.value}
|
|
|
message: _replaceText,
|
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
|
uid: _uuid,
|
|
|
+ model: "qwen-plus",
|
|
|
+ sound_url: "",
|
|
|
file_ids: [...this.fileids],
|
|
|
// model: "gpt-4o-mini"
|
|
|
// model: "qwen-plus"
|
|
@@ -1202,6 +1253,8 @@ ${message}`;
|
|
|
userId: this.userid,
|
|
|
message: _replaceText,
|
|
|
session_name: this.continuous ? `${this.courseId}-addCourseA` : uuidv4(),
|
|
|
+ model: "qwen-plus",
|
|
|
+ sound_url: "",
|
|
|
uid: _uuid,
|
|
|
file_ids: [...this.fileids],
|
|
|
// model: "gpt-4o-mini"
|