diff --git a/ui/src/components/markdown/EchartsRander.vue b/ui/src/components/markdown/EchartsRander.vue
new file mode 100644
index 000000000..dffcc6de0
--- /dev/null
+++ b/ui/src/components/markdown/EchartsRander.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
diff --git a/ui/src/components/markdown/MdRenderer.vue b/ui/src/components/markdown/MdRenderer.vue
index 3323d8730..76ab43fa4 100644
--- a/ui/src/components/markdown/MdRenderer.vue
+++ b/ui/src/components/markdown/MdRenderer.vue
@@ -10,7 +10,10 @@
{{ item.content }}
-
+
{
@@ -64,8 +68,9 @@ const md_view_list = computed(() => {
return md_img_list[Math.floor(index / 2)]
}
})
- return split_html_rander(split_quick_question(result))
+ return split_echarts_rander(split_html_rander(split_quick_question(result)))
})
+
const split_quick_question = (result: Array) => {
return result
.map((item) => split_quick_question_(item))
@@ -133,6 +138,41 @@ const split_html_rander_ = (source: string, type: string) => {
})
return result
}
+
+const split_echarts_rander = (result: Array) => {
+ return result
+ .map((item) => split_echarts_rander_(item.content, item.type))
+ .reduce((x: any, y: any) => {
+ return [...x, ...y]
+ }, [])
+}
+
+const split_echarts_rander_ = (source: string, type: string) => {
+ const temp_md_quick_question_list = source.match(/[\d\D]*?<\/echarts_rander>/g)
+ const md_quick_question_list = temp_md_quick_question_list
+ ? temp_md_quick_question_list.filter((i) => i)
+ : []
+ const split_quick_question_value = source
+ .split(/[\d\D]*?<\/echarts_rander>/g)
+ .filter((item) => item !== undefined)
+ .filter((item) => !md_quick_question_list?.includes(item))
+ const result = Array.from(
+ { length: md_quick_question_list.length + split_quick_question_value.length },
+ (v, i) => i
+ ).map((index) => {
+ if (index % 2 == 0) {
+ return { type: type, content: split_quick_question_value[Math.floor(index / 2)] }
+ } else {
+ return {
+ type: 'echarts_rander',
+ content: md_quick_question_list[Math.floor(index / 2)]
+ .replace('', '')
+ .replace('', '')
+ }
+ }
+ })
+ return result
+}