remove: 去掉今日定调摘要(prompt不再生成、前端移除高亮框、空标题卡不渲染)

This commit is contained in:
Sakurasan
2026-09-02 13:49:52 +08:00
parent d8d36f32cf
commit 854427092d
2 changed files with 8 additions and 26 deletions
+3 -12
View File
@@ -9,7 +9,6 @@
import asyncio
import json
import re
import traceback
import httpx
@@ -80,8 +79,7 @@ DAILY_ANALYSIS_PROMPT = """请对 {trade_date} 的A股市场进行收盘分析
REPORT_PARTS = [
"""现在写报告的【第1部分】,只输出这一部分,直接输出 Markdown,不要任何开场白或说明:
1. 以 `# {title} A股收盘分析报告` 一级标题开头
2. 标题后第一行输出定调引用块,格式严格为:`> 今日定调:<80字内核心结论,含1-2个关键数字>`
3. 写 `## 一、市场总览`(指数表格、涨跌统计须环比、市场温度)与 `## 二、题材热点分析`(涨幅前5、持续活跃、新兴热点、退潮警示、板块主力资金流TOP3)
2. 写 `## 一、市场总览`(指数表格、涨跌统计须环比、市场温度)与 `## 二、题材热点分析`(涨幅前5、持续活跃、新兴热点、退潮警示、板块主力资金流TOP3)
全文控制在1600字以内。""",
"""现在写报告的【第2部分】,只输出这一部分,直接输出 Markdown,不要重复之前内容:
- `## 三、核心股追踪`(连板梯队完整表格:层级/股票/涨停原因/封单,首板挑3-5只人气股点评;核心股表现;龙头辨识)
@@ -95,8 +93,6 @@ REPORT_PARTS = [
全文控制在1900字以内。""",
]
# 报告头部的"今日定调"引用行,保存时提取为 summary
_TONE_LINE_RE = re.compile(r"^>\s*今日定调[::]\s*(.+)$", re.MULTILINE)
async def _consume_sse(resp: httpx.Response) -> dict:
@@ -302,13 +298,8 @@ async def collect_ai_analysis(trade_date: str) -> dict:
def _extract_summary(content: str) -> str:
"""提取报告头部的"今日定调"引用行作为摘要;缺失时退回正文截断"""
match = _TONE_LINE_RE.search(content or "")
if match:
text = match.group(1).strip()
if text:
return text[:200]
return (content or "")[:200].replace("\n", " ")
"""摘要:正文截断前200字(供管理列表展示)"""
return (content or "")[:200].replace("\n", " ").strip()
def _num(v) -> str:
+5 -14
View File
@@ -46,7 +46,7 @@ function colorizeChildren(children: React.ReactNode): React.ReactNode {
});
}
/** 按 "## " 二级标题拆分报告为多张卡片;首段(# 标题 + 定调引用块)单独一张 */
/** 按 "## " 二级标题拆分报告为多张卡片;首段(# 标题等)若无正文则不单独成卡 */
function splitReport(content: string): { intro: string; sections: { title: string; body: string }[] } {
const parts = content.split(/\n(?=## )/);
const sections = parts.slice(1).map((p) => {
@@ -55,7 +55,10 @@ function splitReport(content: string): { intro: string; sections: { title: strin
const body = nl === -1 ? "" : p.slice(nl + 1).trim();
return { title, body };
});
return { intro: parts[0].trim(), sections };
const intro = parts[0].trim();
// intro 只剩标题(无其他内容)时置空,避免渲染一张只有大标题的空卡片
const introBody = intro.replace(/^#[^\n]*$/m, "").trim();
return { intro: introBody ? intro : "", sections };
}
function AiAnalysisPage() {
@@ -142,18 +145,6 @@ function AiAnalysisPage() {
</CardContent>
</Card>
{/* 今日定调摘要 */}
{report.summary && (
<div className="mb-3 sm:mb-4 rounded-lg border border-primary/30 bg-primary/5 px-3 sm:px-4 py-3">
<div className="flex items-start gap-2.5">
<span className="shrink-0 mt-0.5 rounded bg-primary/10 px-1.5 py-0.5 text-[11px] font-semibold text-primary">
今日定调
</span>
<p className="text-sm leading-relaxed">{report.summary}</p>
</div>
</div>
)}
{/* 报告正文:按 ## 章节分卡片渲染 */}
{(() => {
const { intro, sections } = splitReport(report.content);