feat: 对话区域文件上传(粘贴/拖拽) + XLSX支持 + 会话切换无限循环修复

- 对话区域: st.file_uploader + 全局 paste/drop 事件监听 + sessionStorage 桥接
- 文件预览芯片: 上传后显示在对话区域,可逐文件移除
- OCR 双层解析全面接入: file_parser(文字) + ocr_extractor(字段提取)
- XLSX 解析: openpyxl 逐工作表/逐行读取
- 修复: create_session 强制写入 agent_state.session_id
- 修复: load_session_node 不再从磁盘覆盖 session_id
- 修复: 切换会话 _last_switched_to 哨兵防止无限 rerun

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 12:04:02 +08:00
parent da79640259
commit 87ead4fa6a
6 changed files with 268 additions and 29 deletions
+3 -3
View File
@@ -376,11 +376,11 @@ def load_session_node(state: AgentState) -> Dict:
data = load_session(session_id)
if data and data.get("agent_state"):
saved = data["agent_state"]
# 恢复核心字段(不覆盖当前请求的 user_input / stage
for key in ("session_id", "conversation_history", "full_conversation_history",
# 恢复核心字段(不覆盖当前请求的 user_input / stage / session_id
for key in ("conversation_history", "full_conversation_history",
"current_jrxml", "final_jrxml", "compressed_history",
"session_name", "created_at", "history_states"):
if key in saved and key not in ("user_input", "stage"):
if key in saved and key not in ("user_input", "stage", "session_id"):
state[key] = saved[key]
state["session_name"] = data.get("session_name", "")
state["created_at"] = data.get("created_at", "")