From 16140cafccd3cbace5e809ff4290cb24b73768c9 Mon Sep 17 00:00:00 2001 From: iomgaa Date: Thu, 9 Jul 2026 12:04:36 -0400 Subject: [PATCH] =?UTF-8?q?fix(tree):=20from=5Fdict=20L2=20subtitle=20?= =?UTF-8?q?=E6=97=A7=E6=A0=BC=E5=BC=8F=E5=85=BC=E5=AE=B9=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 旧格式 tree.json 无 card-level L2 subtitle 时,从已构造的 L3 children 聚合 subtitle,避免运行时加载静默丢失 L2 字幕。 Co-Authored-By: Claude Opus 4.6 (1M context) --- app/tree/index.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/tree/index.py b/app/tree/index.py index ece2c8d..a4bade8 100644 --- a/app/tree/index.py +++ b/app/tree/index.py @@ -20,6 +20,7 @@ from __future__ import annotations import base64 +import dataclasses import json from dataclasses import dataclass, field from datetime import datetime @@ -367,6 +368,11 @@ class L1Node: state_changes=l2d["card"]["state_changes"], subtitle=l2d["card"].get("subtitle", ""), ) + # 旧格式兼容:L2 无 card subtitle 时从 L3 children 聚合 + if not l2_card.subtitle: + l3_subs = [n.card.subtitle for n in l3_nodes if n.card.subtitle] + if l3_subs: + l2_card = dataclasses.replace(l2_card, subtitle="\n".join(l3_subs)) tr2 = l2d.get("time_range") l2_nodes.append( L2Node(