mirror of
http://112.124.100.131/ebiz-ai/ebiz-base-ai.git
synced 2025-12-15 13:56:51 +08:00
fix: 修复中文开头吐字异常的问题
This commit is contained in:
@@ -82,16 +82,17 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
render(message) {
|
render(message) {
|
||||||
const text = this.filterVisible(message)
|
const text = this.filterVisible(message)
|
||||||
|
// console.log(`text`, text);
|
||||||
|
|
||||||
return md.render(text)
|
return md.render(text)
|
||||||
},
|
},
|
||||||
setProductName(e) {
|
setProductName(e) {
|
||||||
this.$emit('setProductName', e)
|
this.$emit('setProductName', e)
|
||||||
},
|
},
|
||||||
filterVisible(message) {
|
filterVisible(message) {
|
||||||
// if (!message.text.startsWith('<')) {
|
|
||||||
let text = message.text.trim()
|
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, '').trim()
|
text = text.replace(/<information>([^<]*)(?:<\/information>)?/g, '').trim()
|
||||||
text = text.replace(/<is_complete>([^<]*)(?:<\/is_complete>)?/g, '').trim()
|
text = text.replace(/<is_complete>([^<]*)(?:<\/is_complete>)?/g, '').trim()
|
||||||
@@ -99,11 +100,10 @@ export default {
|
|||||||
// 捕获 不包含 < 的后置标签 span> /span> a</span>
|
// 捕获 不包含 < 的后置标签 span> /span> a</span>
|
||||||
text = text.replace(/^[/]?[a-zA-z0-9]+[</\w>]+/g, '').trim()
|
text = text.replace(/^[/]?[a-zA-z0-9]+[</\w>]+/g, '').trim()
|
||||||
// // 尝试匹配 </abc> 标签
|
// // 尝试匹配 </abc> 标签
|
||||||
text = text.replace(/^<\w+>/g, '').trim()
|
// text = text.replace(/^<\w+>/g, '').trim()
|
||||||
text = text.replace(/^\w+/, "").trim()
|
// text = text.replace(/^\w+/, "").trim()
|
||||||
text = text.replace(/<\/?([\w\s='"]+)?(?!>)$/gi, '').trim()
|
text = text.replace(/<\/?([\w\s='"]+)?(?!>)$/gi, '').trim()
|
||||||
// console.log(`text`, text[text.length - 1]);
|
// console.log(`text`, text[text.length - 1]);
|
||||||
console.log(`kjlasf dsadfjkls`, text[text.length - 1]);
|
|
||||||
|
|
||||||
return text
|
return text
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user