diff --git a/xinli-ui/src/views/psychology/report/detail.vue b/xinli-ui/src/views/psychology/report/detail.vue index 1413ca88..ea3b77b8 100644 --- a/xinli-ui/src/views/psychology/report/detail.vue +++ b/xinli-ui/src/views/psychology/report/detail.vue @@ -346,7 +346,7 @@ export default { '1. 提取报告的核心信息和关键指标;', '2. 分析测评结果的含义和可能的影响;', '3. 提供专业、客观、易懂的分析解读(500-800字);', - '4. 使用结构化的格式输出,包含:核心结论、详细分析、建议等部分;', + '4. 使用结构化的格式输出,包含:核心结论、详细分析、建议、总体结论四个部分;', '5. 仅输出分析结果,不添加额外建议、问候语或思考过程;', '6. 使用HTML格式输出,使用
标签作为段落。'
].join('\n');
@@ -380,6 +380,10 @@ export default {
.replace(/ ')) {
- return text;
- }
+ // 移除Markdown代码块标记(```html、```等)
+ let html = text
+ .replace(/```html\s*/gi, '')
+ .replace(/```\s*/g, '')
+ .replace(/```[a-z]*\s*/gi, '')
+ .trim();
- // 将文本转换为HTML格式
- let html = text;
+ // 如果已经是HTML格式,清理后返回
+ if (html.includes(' ') || html.includes('') || text.includes('
') || html.includes('
$1
');
@@ -433,6 +443,9 @@ export default {
return match;
});
+ // 最后再次清理可能残留的代码块标记
+ html = html.replace(/```html\s*/gi, '').replace(/```\s*/g, '');
+
return html;
}
}