Skip to content

Commit 883a3b6

Browse files
authored
fix: Opening remarks with built-in quick Q&A and tag conflicts result in HTML rendering failure (#2183)
1 parent de95b6c commit 883a3b6

File tree

1 file changed

+20
-1
lines changed
  • ui/src/components/ai-chat/component/prologue-content

1 file changed

+20
-1
lines changed

ui/src/components/ai-chat/component/prologue-content/index.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,26 @@ const toQuickQuestion = (match: string, offset: number, input: string) => {
3232
}
3333
const prologue = computed(() => {
3434
const temp = props.available ? props.application?.prologue : t('chat.tip.prologueMessage')
35-
return temp?.replace(/-\s.+/g, toQuickQuestion)
35+
if (temp) {
36+
const tag_list = [
37+
/<html_rander>[\d\D]*?<\/html_rander>/g,
38+
/<echarts_rander>[\d\D]*?<\/echarts_rander>/g,
39+
/<quick_question>[\d\D]*?<\/quick_question>/g,
40+
/<form_rander>[\d\D]*?<\/form_rander>/g
41+
]
42+
let _temp = temp
43+
for (const index in tag_list) {
44+
_temp = _temp.replaceAll(tag_list[index], '')
45+
}
46+
const quick_question_list = _temp.match(/-\s.+/g)
47+
let result = temp
48+
for (const index in quick_question_list) {
49+
const quick_question = quick_question_list[index]
50+
result = temp.replace(quick_question, toQuickQuestion)
51+
}
52+
return result
53+
}
54+
return ''
3655
})
3756
</script>
3857
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)