70614dff5e
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>
40 lines
998 B
Python
40 lines
998 B
Python
"""LangGraph JRXML 生成代理工作流的状态定义。"""
|
|
|
|
from typing import TypedDict, List
|
|
|
|
|
|
class AgentState(TypedDict, total=False):
|
|
# 核心工作流字段
|
|
conversation_history: List[dict]
|
|
current_jrxml: str
|
|
user_input: str
|
|
status: str
|
|
error_msg: str
|
|
natural_explanation: str
|
|
retry_count: int
|
|
user_modification_request: str
|
|
final_jrxml: str
|
|
stage: str
|
|
retrieved_context: str
|
|
|
|
# 需求1:智能上下文压缩
|
|
full_conversation_history: List[dict]
|
|
compressed_history: str
|
|
current_token_count: int
|
|
|
|
# 需求2:多会话持久化
|
|
session_id: str
|
|
session_name: str
|
|
created_at: str
|
|
updated_at: str
|
|
|
|
# 需求3:意图识别
|
|
intent: str
|
|
history_states: List[dict]
|
|
|
|
# 需求4:JRXML 版本历史(用于下载历史版本)
|
|
jrxml_versions: List[dict]
|
|
|
|
# 需求5:错误自增长(记录修正前的状态,供 validate 节点判断是否入知识库)
|
|
last_error_case: dict
|