feat: L4 AI 诊断报告优化 + Prompt/摘要卡/迁移/文档完善

- 修正 DeepSeek 模型名 deepseek-chat → deepseek-v4-pro
- 摘要块:修复 **粗体** markdown 渲染、左右块可滚动、左块固定粉红色系
- 新增 prompt4(内容摘要卡)+ prompt5(诊断报告)+ 三处 prompt5 优化
- 新增 004 迁移(episodes +content_digest JSONB)、导入脚本、摘要卡生成脚本
- 更新 CLAUDE.md 状态栏/进度/交接备注/关键决策

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
simonkoson
2026-07-03 21:25:38 +08:00
parent 3dd718f53d
commit 9df4868191
15 changed files with 1993 additions and 42 deletions
@@ -27,32 +27,49 @@ function extractSection(markdown, startMarker, endMarkers) {
return markdown.substring(afterStart, endIdx).trim()
}
/** 清理 markdown 为纯文本(去掉标题标记、多余符号等) */
function cleanMarkdown(text) {
/** markdown 文本按行拆分,保留 **bold** 为 <strong> */
function parseMarkdownLines(text) {
if (!text) return []
return text
.split('\n')
.map((line) => line.replace(/^#+\s*/, '').replace(/^\*\*(.+?)\*\*/, '$1').trim())
.map((line) => line.replace(/^#+\s*/, '').trim())
.filter((line) => line.length > 0)
}
/** 将行内 **text** 转为 React 元素 */
function renderInlineMarkdown(text) {
const parts = text.split(/(\*\*[^*]+\*\*)/)
return parts.map((part, i) => {
const boldMatch = part.match(/^\*\*(.+)\*\*$/)
if (boldMatch) {
return <strong key={i}>{boldMatch[1]}</strong>
}
return part
})
}
const LEFT_STYLE = {
color: '#c0584f',
bg: 'rgba(192,88,79,0.06)',
}
const TIER_CONFIG = {
danger: {
leftTitle: '问题聚焦',
rightTitle: '病因与预警',
color: '#7aa874',
rightColor: '#7aa874',
rightBg: 'rgba(122,168,116,0.06)',
},
on_target: {
leftTitle: '核心发现',
rightTitle: '病因与提振建议',
color: '#5b8db8',
rightColor: '#5b8db8',
rightBg: 'rgba(91,141,184,0.06)',
},
excellent: {
leftTitle: '高光复盘',
rightTitle: '经验总结',
color: '#c0584f',
rightColor: '#c0584f',
rightBg: 'rgba(192,88,79,0.06)',
},
}
@@ -144,8 +161,8 @@ function DiagnosisSummary({ episodes, yearlyTarget, selectedYear }) {
// 行动建议:从 "#### 四、行动建议" 到末尾
let actions = extractSection(markdown, '#### 四、行动建议', [])
const coreLines = cleanMarkdown(coreFindings)
const actionLines = cleanMarkdown(actions)
const coreLines = parseMarkdownLines(coreFindings)
const actionLines = parseMarkdownLines(actions)
return (
<div className="analytics-chart-card">
@@ -176,30 +193,30 @@ function DiagnosisSummary({ episodes, yearlyTarget, selectedYear }) {
</div>
) : report ? (
<div className="diagnosis-summary-content">
{/* 左块 */}
{/* 左块(固定粉红色系) */}
<div
className="diagnosis-summary-left"
style={{ borderColor: config.color }}
style={{ borderColor: LEFT_STYLE.color, background: LEFT_STYLE.bg }}
>
<div className="diagnosis-block-title">{config.leftTitle}</div>
<div className="diagnosis-block-title" style={{ color: LEFT_STYLE.color }}>{config.leftTitle}</div>
{coreLines.length > 0 ? (
coreLines.map((line, i) => (
<p key={i} style={{ margin: '0 0 8px 0' }}>{line}</p>
<p key={i} style={{ margin: '0 0 8px 0' }}>{renderInlineMarkdown(line)}</p>
))
) : (
<p>报告已生成请查看完整报告</p>
)}
</div>
{/* 右块 */}
{/* 右块(跟随 tier 变色) */}
<div
className="diagnosis-summary-right"
style={{ background: config.rightBg }}
style={{ borderColor: config.rightColor, background: config.rightBg }}
>
<div className="diagnosis-block-title">{config.rightTitle}</div>
<div className="diagnosis-block-title" style={{ color: config.rightColor }}>{config.rightTitle}</div>
{actionLines.length > 0 ? (
actionLines.map((line, i) => (
<p key={i} style={{ margin: '0 0 8px 0' }}>{line}</p>
<p key={i} style={{ margin: '0 0 8px 0' }}>{renderInlineMarkdown(line)}</p>
))
) : (
<p>报告已生成请查看完整报告</p>