fix: crash 'list' object has no attribute 'keys' on image upload, output disappearing on error

Root cause: layout_schema.regions is a list of region dicts, not a dict.
_log_ocr_layers() was calling .keys() on it, causing agent_error.

Also fixed: ProcessSection now stays visible after streaming ends (error or
completion), so generated content is not lost. Header shows ✓/✕/pulse indicators.
Error handler now refreshes session state for partial JRXML download.
This commit is contained in:
2026-05-22 00:01:54 +08:00
parent d600cbf285
commit 339d415322
3 changed files with 29 additions and 5 deletions
+3 -2
View File
@@ -565,8 +565,9 @@ def _log_ocr_layers(state: AgentState) -> None:
# ── 位置层:布局 schema(行/列/区域)──
layout = state.get("layout_schema")
if isinstance(layout, dict) and layout.get("total_rows", 0) > 0:
regions = layout.get("regions", {})
region_names = list(regions.keys()) if regions else []
region_list = layout.get("regions", [])
_rn = {"title": "标题", "header": "表头", "data": "数据", "footer": "表尾"}
region_names = [_rn.get(r["type"], r["type"]) for r in region_list] if isinstance(region_list, list) else []
cols = layout.get("total_columns", 0)
rows = layout.get("total_rows", 0)
regions_label = ", ".join(region_names) if region_names else "标题/表头/数据/表尾"