feat(tui): 改进输入历史和可恢复会话列表#358
Open
valkryhx wants to merge 11 commits into
Open
Conversation
- 新增 deep 命令生成脱敏 packet 和 LLM 审阅说明,避免规则 seed 直接成为正式经验 - 扩展 packet 内容,包含 timeline、验证命令、失败恢复和 seed observations - 调整候选晋升逻辑,按独立 source_hash 统计证据,并支持隔离 state_dir/output - 更新工具 schema、蒸馏 SOP 和测试,明确 LLM 是蒸馏核心
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
TUI v2 在 Textual 7.5.0 环境中会因为导入私有模块
textual._auto_scroll失败而启动崩溃。同时,TUI 输入框缺少历史输入回放,用户重复提交相近指令时需要手动重输;重启 TUI 后左侧SESSIONS只显示当前进程内会话,无法直接选择已有历史会话。本 PR 也补充了侧栏可用性改进:会话面板和主对话区之间可以拖动调整宽度,
RECENT中的历史会话预览会随侧栏宽度自适应显示。另一个兼容性问题是:当用户在 TUI 中以文本形式传入本地图片路径时,Native OpenAI 后端原本只收到纯文本路径,模型会倾向于调用外部 OCR/视觉工具,而不是直接使用支持视觉的模型原生图片输入。
另外,若
mixin_config引用的 session 名称不存在,初始化失败后旧逻辑会把未解析的 mixin 占位 dict 留在 LLM 列表中,导致默认会话不可用;这会表现为 TUI 发送普通文本后没有正常回复。改动
frontends/tui_input_history.py,封装 TextArea 输入历史导航逻辑。frontends/tuiapp.py和frontends/tuiapp_v2.py中支持:↑回看上一条输入;↓向后浏览并最终恢复当前草稿;tuiapp_v2的命令面板打开时,↑/↓仍优先用于命令选择。textual._auto_scroll做兼容降级:模块存在时保留增强滚动;模块不存在时跳过非关键 patch,避免启动失败。tuiapp_v2左侧栏新增RECENT区块,展示最近可恢复历史会话,并支持点击恢复到当前 session。tui_recent_sessions_limit = 10,写入mykey_template.py和mykey_template_en.py,用于控制RECENT显示数量。SESSIONS/RECENT面板和主对话区之间的竖向分割线,动态调整侧栏宽度。RECENT历史会话预览宽度会根据侧栏实际宽度自适应,不再固定截断长度。NativeOAISession新增可选配置native_image_input,仅显式开启且实际发现本地图片路径时,把首轮用户输入转为原生图片块。image_url或 Responses API 的input_image。native_image_input、非 Native OAI 后端、无图片的普通文本、或后续工具轮中的路径仍保持原有文本行为,避免影响不支持视觉输入的模型。GenericAgent.load_llm_sessions()会跳过初始化失败的 mixin 配置,不再把无效 dict 留作默认 LLM;若没有任何可用 session,则显式报错。tests/test_tui_input_history.pytests/test_tui_recent_sessions.pytests/test_native_image_input.pytests/test_agentmain_llm_sessions.py验证
python -m py_compile frontends/tuiapp.py frontends/tuiapp_v2.py frontends/tui_input_history.pypython -m py_compile agentmain.py llmcore.py agent_loop.py frontends\\tuiapp_v2.pypython -m unittest discover -s testspython -m unittest tests.test_native_image_inputpython -m unittest tests.test_agentmain_llm_sessions tests.test_native_image_inputtuiapp_v2,确认on_mount成功、输入框获得焦点、分割线命中区存在,并初始化最近历史列表状态。text + image多模态 content,图片 MIME 为image/png。GenericAgent.put_task("你好")真实后端验证:输出队列能收到模型回复。兼容性说明
textual._auto_scroll是 Textual 私有 API,不同版本可能不存在。本 PR 仅在该模块可用时启用拖选自动滚动增强;不可用时不影响 TUI 主流程启动。RECENT区块复用现有/continue的日志扫描和恢复逻辑,不引入新的持久化格式。侧栏拖拽宽度仅在当前 TUI 进程内生效,重启后仍使用响应式默认宽度。native_image_input默认为关闭,只建议在确认当前 OpenAI-compatible 后端和模型支持原生视觉输入时开启。不支持视觉输入的模型不会被默认传入图片块。