fix(ppt): AI parser drops empty-body sections + cap raised 6→10
All checks were successful
CD Pipeline / deploy (push) Successful in 2m33s
All checks were successful
CD Pipeline / deploy (push) Successful in 2m33s
實戰問題:升級 monthly AI prompt 後,AI 輸出多了【行銷與銷售行動建議 — SMART 框架】這個「主段」加 3 個 ■ 子段(本週/本月/下月)。原 parser: 1. ■ 子段被當成新 section(這是正確行為) 2. 但「行銷與銷售行動建議」主段自己 body 變空殼 3. 顯示成「(本段無內容)」醜陋占位 4. 加上 sections[:6] 切斷,後面的競爭定位/風險預警被丟掉 修補(services/ppt_generator.py:_parse_ai_sections): - 過濾空 body section(len(body) < 5 視為空殼) - 上限放寬 6 → 10(容納升級 prompt 後的 9 段:整體/市場/品類/熱銷/ MCP/本週/本月/下月/風險) 驗證:模擬 9 段輸入 → 過濾後得 6 個非空段,正確包含本週/本月/下月。 bump monthly v3.1.2 → v3.1.3 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ REPORTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||
TEMPLATE_VERSIONS = {
|
||||
'daily': 'v3.0.2', # 2026-05-02 折線稀疏資料防呆:N<=2 時 inset legend、加「資料不足」提示
|
||||
'weekly': 'v3.0.2', # 2026-05-02 同上
|
||||
'monthly': 'v3.1.2', # 2026-05-02 同上(雖月報通常 30 點不會踩到,仍 bump 統一)
|
||||
'monthly': 'v3.1.3', # 2026-05-03 AI 段落 parser:丟棄空 body 段、上限 6→10 容納 SMART 框架 9 段
|
||||
'strategy': 'v3.0', # 2026-05-02 AI 頁去黑改暖紙 + 附錄頁
|
||||
'competitor': 'v3.0', # 2026-05-02 AI 頁去黑改暖紙 + 附錄頁
|
||||
'promo': 'v3.0', # 2026-05-02 AI 頁去黑改暖紙 + 附錄頁
|
||||
@@ -2173,7 +2173,13 @@ def _parse_ai_sections(ai_text: str) -> list:
|
||||
if not sections and ai_text.strip():
|
||||
sections.append(("💡", "AI 月度策略洞察", ai_text.strip()))
|
||||
|
||||
return sections[:6]
|
||||
# 過濾「空 body」段(如 SMART 框架主標題下接續是 ■ 子段,主標題自己沒內容)
|
||||
# 這些「空殼」section 占版面但無資訊,丟掉避免顯示「(本段無內容)」
|
||||
sections = [(i, t, b) for (i, t, b) in sections if b and len(b.strip()) >= 5]
|
||||
|
||||
# 上限放寬 6 → 10(升級 prompt 後最多 9 段:整體/市場/品類/熱銷/MCP/
|
||||
# 本週/本月/下月/風險),仍會自動分頁(每頁 4 卡,最多 3 頁)
|
||||
return sections[:10]
|
||||
|
||||
|
||||
def _ai_insight_slide(prs, ai_text: str, W: float = 33.87):
|
||||
|
||||
Reference in New Issue
Block a user