feat: comprehensive v2 upgrade — streaming, error KB, file upload, layout analysis

Major changes:
- Streaming: LLM统一 _BaseLLM 接口 (invoke + stream), generate/modify/correct
  节点使用 get_stream_writer() 实现逐字输出, UI 节点平铺展开自动折叠
- Prompt外部化: 7个prompt拆分到 prompts/*.md, loader.py 支持热重载
- 错误自增长: backend/error_kb.py — 指纹去重 + ChromaDB持久化,
  correct_jrxml→validate 通过时自动入库, retrieve同时搜索错误KB
- 文件上传: backend/file_parser.py — PDF/DOCX/图片/文本解析,
  侧边栏多文件上传, 文本自动注入下一条消息
- A4模板识别: backend/layout_analyzer.py — 三种模式(完整A4/行片段修改/行片段新建),
  PaddleOCR元素提取 + 行分组 + JRXML section匹配
- 会话历史下载: jrxml_versions版本追踪 + 侧边栏历史版本下载按钮
- 预览修复: route_after_save跳过预览/导出意图的验证循环
- Ctrl+C修复: JS注入拦截Streamlit裸c键清缓存

Docs: CLAUDE.md (完整项目文档), ROADMAP.md (改进路线图)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 15:02:53 +08:00
parent b280c2b453
commit 70614dff5e
19 changed files with 1770 additions and 231 deletions
+7 -1
View File
@@ -71,7 +71,11 @@ def route_after_undo(state: AgentState) -> Literal["save_session"]:
return "save_session"
def route_after_save(state: AgentState) -> Literal["validate"]:
def route_after_save(state: AgentState) -> Literal["validate", "finalize"]:
# 预览/导出意图跳过验证,直接完成
intent = state.get("intent", "")
if intent in ("preview_report", "export_pdf", "export_jrxml"):
return "finalize"
return "validate"
@@ -222,4 +226,6 @@ def create_initial_state() -> AgentState:
updated_at="",
intent="",
history_states=[],
jrxml_versions=[],
last_error_case={},
)