Skip to content

Commit

Permalink
fix: Opening remarks with built-in quick Q&A and tag conflicts result…
Browse files Browse the repository at this point in the history
… in HTML rendering failure (#2183)
  • Loading branch information
shaohuzhang1 authored Feb 9, 2025
1 parent de95b6c commit 883a3b6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion ui/src/components/ai-chat/component/prologue-content/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,26 @@ const toQuickQuestion = (match: string, offset: number, input: string) => {
}
const prologue = computed(() => {
const temp = props.available ? props.application?.prologue : t('chat.tip.prologueMessage')
return temp?.replace(/-\s.+/g, toQuickQuestion)
if (temp) {
const tag_list = [
/<html_rander>[\d\D]*?<\/html_rander>/g,
/<echarts_rander>[\d\D]*?<\/echarts_rander>/g,
/<quick_question>[\d\D]*?<\/quick_question>/g,
/<form_rander>[\d\D]*?<\/form_rander>/g
]
let _temp = temp
for (const index in tag_list) {
_temp = _temp.replaceAll(tag_list[index], '')
}
const quick_question_list = _temp.match(/-\s.+/g)
let result = temp
for (const index in quick_question_list) {
const quick_question = quick_question_list[index]
result = temp.replace(quick_question, toQuickQuestion)
}
return result
}
return ''
})
</script>
<style lang="scss" scoped></style>

0 comments on commit 883a3b6

Please sign in to comment.