A Simple and Universal Swarm Intelligence Engine, Predicting Anything. 简洁通用的群体智能引擎,预测万物
Python agent-memoryfinancial-forecastingfuture-predictionknowledge-graphllmsmulti-agent-simulationpublic-opinion-analysispython3social-predictionswarm-intelligence
fix(report_agent): improve markdown rendering by cleaning up <br> tags around block-level elements and enhancing list formatting
666ghjae1f38cdcc32
diff --git a/frontend/src/components/Step4Report.vue b/frontend/src/components/Step4Report.vueindex f383344c..22f2bdcf 100644--- a/frontend/src/components/Step4Report.vue+++ b/frontend/src/components/Step4Report.vue@@ -1932,13 +1932,15 @@ const renderMarkdown = (content) => {html = html.replace(/(<\/h[2-5]>)<\/p>/g, '$1')html = html.replace(/<p class="md-p">(<ul|<ol|<blockquote|<pre|<hr)/g, '$1')html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>|<\/pre>)<\/p>/g, '$1')- // 清理列表前后的 <br> 标签- html = html.replace(/<br>\s*(<ul|<ol)/g, '$1')- html = html.replace(/(<\/ul>|<\/ol>)\s*<br>/g, '$1')+ // 清理块级元素前后的 <br> 标签+ html = html.replace(/<br>\s*(<ul|<ol|<blockquote)/g, '$1')+ html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>)\s*<br>/g, '$1')+ // 清理 <p><br> 紧跟块级元素的情况(多余空行导致)+ html = html.replace(/<p class="md-p">(<br>\s*)+(<ul|<ol|<blockquote|<pre|<hr)/g, '$2')// 清理连续的 <br> 标签html = html.replace(/(<br>\s*){2,}/g, '<br>')- // 清理列表后紧跟的段落开始标签前的 <br>- html = html.replace(/(<\/ol>|<\/ul>)<br>(<p|<div)/g, '$1$2')+ // 清理块级元素后紧跟的段落开始标签前的 <br>+ html = html.replace(/(<\/ol>|<\/ul>|<\/blockquote>)<br>(<p|<div)/g, '$1$2')// 修复非连续有序列表的编号:当单项 <ol> 被段落内容隔开时,保持编号递增const tokens = html.split(/(<ol class="md-ol">(?:<li class="md-oli"[^>]*>[\s\S]*?<\/li>)+<\/ol>)/g)diff --git a/frontend/src/components/Step5Interaction.vue b/frontend/src/components/Step5Interaction.vueindex d09de039..3d84c7ce 100644--- a/frontend/src/components/Step5Interaction.vue+++ b/frontend/src/components/Step5Interaction.vue@@ -599,13 +599,15 @@ const renderMarkdown = (content) => {html = html.replace(/(<\/h[2-5]>)<\/p>/g, '$1')html = html.replace(/<p class="md-p">(<ul|<ol|<blockquote|<pre|<hr)/g, '$1')html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>|<\/pre>)<\/p>/g, '$1')- // 清理列表前后的 <br> 标签- html = html.replace(/<br>\s*(<ul|<ol)/g, '$1')- html = html.replace(/(<\/ul>|<\/ol>)\s*<br>/g, '$1')+ // 清理块级元素前后的 <br> 标签+ html = html.replace(/<br>\s*(<ul|<ol|<blockquote)/g, '$1')+ html = html.replace(/(<\/ul>|<\/ol>|<\/blockquote>)\s*<br>/g, '$1')+ // 清理 <p><br> 紧跟块级元素的情况(多余空行导致)+ html = html.replace(/<p class="md-p">(<br>\s*)+(<ul|<ol|<blockquote|<pre|<hr)/g, '$2')// 清理连续的 <br> 标签html = html.replace(/(<br>\s*){2,}/g, '<br>')- // 清理列表后紧跟的段落开始标签前的 <br>- html = html.replace(/(<\/ol>|<\/ul>)<br>(<p|<div)/g, '$1$2')+ // 清理块级元素后紧跟的段落开始标签前的 <br>+ html = html.replace(/(<\/ol>|<\/ul>|<\/blockquote>)<br>(<p|<div)/g, '$1$2')// 修复非连续有序列表的编号:当单项 <ol> 被段落内容隔开时,保持编号递增const tokens = html.split(/(<ol class="md-ol">(?:<li class="md-oli"[^>]*>[\s\S]*?<\/li>)+<\/ol>)/g)