mirror of
http://112.124.100.131/ebiz-ai/ebiz-base-ai.git
synced 2025-12-09 02:46:50 +08:00
feat: 修复显示异常的问题
This commit is contained in:
@@ -233,7 +233,7 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.single) {
|
if (this.single) {
|
||||||
// this.$set(this.messages, this.messages.length - 1, { ...this.currentMessage })
|
// this.$set(this.messages, this.messages.length - 1, { ...this.currentMessage })
|
||||||
this.$set(this.messages, this.messages.length, this.genMessage = { ...this.currentMessage })
|
this.$set(this.messages, this.messages.length - 1, this.genMessage = { ...this.currentMessage })
|
||||||
} else {
|
} else {
|
||||||
this.messages.push(this.currentMessage)
|
this.messages.push(this.currentMessage)
|
||||||
}
|
}
|
||||||
@@ -388,12 +388,11 @@ export default {
|
|||||||
const char = chars.shift() || ''
|
const char = chars.shift() || ''
|
||||||
// this.$set(this.currentMessage, isThink ? 'think' : 'text', this.currentMessage[isThink ? 'think' : 'text'] + char)
|
// this.$set(this.currentMessage, isThink ? 'think' : 'text', this.currentMessage[isThink ? 'think' : 'text'] + char)
|
||||||
if (requestIndex === 2) {
|
if (requestIndex === 2) {
|
||||||
console.log('requestIndex === 2', char);
|
// console.log('requestIndex === 2', char);
|
||||||
|
|
||||||
this.$set(this.genMessage, 'text', this.genMessage.text + char)
|
this.$set(this.genMessage, 'text', this.genMessage.text + char)
|
||||||
// this.messages.splice(this.messages.length - 1, 1, this.genMessage)
|
// this.messages.splice(this.messages.length - 1, 1, this.genMessage)
|
||||||
} if (requestIndex === 1) {
|
} if (requestIndex === 1) {
|
||||||
console.log('requestIndex === 1', char);
|
// console.log('requestIndex === 1', char);
|
||||||
|
|
||||||
this.$set(this.currentMessage, 'text', this.currentMessage.text + char)
|
this.$set(this.currentMessage, 'text', this.currentMessage.text + char)
|
||||||
}
|
}
|
||||||
@@ -427,6 +426,8 @@ export default {
|
|||||||
sendMessage() {
|
sendMessage() {
|
||||||
this.$emit('update:messageStatus', 'send')
|
this.$emit('update:messageStatus', 'send')
|
||||||
this.$emit('update:autoScrollEnabled', true)
|
this.$emit('update:autoScrollEnabled', true)
|
||||||
|
// 重置索引
|
||||||
|
this.requestIndex = 1
|
||||||
this.axiosGetAiChat()
|
this.axiosGetAiChat()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
<p v-html="md.render(message.think)" v-if="message.think && message.showThink" class="thinkText" />
|
<p v-html="md.render(message.think)" v-if="message.think && message.showThink" class="thinkText" />
|
||||||
</span>
|
</span>
|
||||||
<div style="width: 100%">
|
<div style="width: 100%">
|
||||||
{{ (message) }}
|
<!-- {{ (message) }} -->
|
||||||
<!-- {{ filterVisible(message) }} -->
|
{{ filterVisible(message) }}
|
||||||
<!-- <hr> -->
|
<!-- <hr> -->
|
||||||
<p v-html="render(message)" class="render-container"></p>
|
<p v-html="render(message)" class="render-container"></p>
|
||||||
<span class="speakLoadingToast pv10" v-if="!filterVisible(message)">
|
<span class="speakLoadingToast pv10" v-if="!filterVisible(message)">
|
||||||
@@ -89,28 +89,20 @@ export default {
|
|||||||
},
|
},
|
||||||
filterVisible(message) {
|
filterVisible(message) {
|
||||||
// if (!message.text.startsWith('<')) {
|
// if (!message.text.startsWith('<')) {
|
||||||
let text = message.text
|
let text = message.text.trim()
|
||||||
// 如果开头是中文,直接返回
|
// 如果开头是中文,直接返回
|
||||||
if (new RegExp('^[\u4e00-\u9fa5]+', 'g').test(text)) return text
|
if (new RegExp('^[\u4e00-\u9fa5]+', 'g').test(text)) return text
|
||||||
|
|
||||||
text = text.replace(/<information>([^<]*)(?:<\/information>)?/g, '')
|
text = text.replace(/<information>([^<]*)(?:<\/information>)?/g, '').trim()
|
||||||
text = text.replace(/<is_complete>([^<]*)(?:<\/is_complete>)?/g, '')
|
text = text.replace(/<is_complete>([^<]*)(?:<\/is_complete>)?/g, '').trim()
|
||||||
|
|
||||||
// 捕获 不包含 < 的后置标签 span> /span> a</span>
|
// 捕获 不包含 < 的后置标签 span> /span> a</span>
|
||||||
text = text.replace(/^[/]?[a-zA-z0-9]+[</\w>]+/g, '')
|
text = text.replace(/^[/]?[a-zA-z0-9]+[</\w>]+/g, '').trim()
|
||||||
// 尝试匹配 </abc> 标签
|
// // 尝试匹配 </abc> 标签
|
||||||
text = text.replace(/^<\w+>/g, '')
|
text = text.replace(/^<\w+>/g, '').trim()
|
||||||
// <\/?([\w\s]+)?(?!>)$
|
text = text.replace(/^\w+/, "").trim()
|
||||||
text = text.replace(/<\/?([\w\s='"]+)?(?!>)$/g, '')
|
text = text.replace(/<\/?([\w\s='"]+)?(?!>)$/gi, '').trim()
|
||||||
|
|
||||||
text = text.replace(/^\w+/, "")
|
|
||||||
return text
|
return text
|
||||||
// }
|
|
||||||
// 只把 text 标签内容渲染
|
|
||||||
// let match = /<text>([^<]*)(?:<\/text>)?/.exec(message.text)
|
|
||||||
// let text = match ? match[1] : ''
|
|
||||||
// text = text.replace(/<\/?([\w\s='"]+)?(?!>)$/g, '')
|
|
||||||
// return text
|
|
||||||
},
|
},
|
||||||
showThink(message) {
|
showThink(message) {
|
||||||
this.$set(message, 'showThink', !message.showThink)
|
this.$set(message, 'showThink', !message.showThink)
|
||||||
|
|||||||
Reference in New Issue
Block a user