Skip to content

fix(python tui): 订阅 llm.* 通配符并渲染模型思考过程 - #172

Merged
rojim666 merged 1 commit into
rojim666:mainfrom
xngyan:xngyan/issue-170-v2
Oct 4, 2026
Merged

rojim666 merged 1 commit into
rojim666:mainfrom
xngyan:xngyan/issue-170-v2

Conversation

@xngyan

@xngyan xngyan commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

TUI 的 event.subscribe 逐个枚举 llm.model_selected/llm.token/llm.usage, 独缺 llm.thinking,导致模型思考过程在 TUI 完全不可见:daemon 侧
(core/llm/provider.py 已在 thinking_delta 分支)正常发布 llm.thinking, 客户端从未订阅,也没有对应渲染代码。桌面端已用 "llm.*" 通配符覆盖。

  • 订阅 topic 改为 "llm.*" 通配符,与桌面端对齐,避免将来再逐个枚举时遗漏
  • 新增 ThinkingBlock 累积思考内容,标签随完成状态在「当前判断」/「过程说明」间切换; 节流刷新间隔与 LLMStreamBlock 对齐,避免高频思考分片触发整块重渲染
  • _handle_event_inner 增加 llm.thinking 分支,thinking 为空时直接忽略
  • _break_llm 同步定稿思考块,_trim_log 将其纳入保护集合,避免长会话裁剪掉内容

Summary

Behavior

Validation

npm run typecheck
npm test
npm run build
npm run docs:protocol
npm run docs:links

如只修改 Skill 的 Python artifact helper,再补充该 Skill 文档要求的专项检查。

Risk

UI evidence

Checklist

  • 变更范围与关联 Issue 一致,没有混入无关重构。
  • 没有提交凭据、日志、缓存、私有源码或本地评测产物。
  • 已添加或更新与风险匹配的测试。
  • 协议变化已重新生成 docs/reference/wire-protocol.md。
  • 用户文档、配置示例和迁移说明已同步。
  • 提交包含 Signed-off-by(DCO)。

TUI 的 event.subscribe 逐个枚举 llm.model_selected/llm.token/llm.usage,
独缺 llm.thinking,导致模型思考过程在 TUI 完全不可见:daemon 侧
(core/llm/provider.py 已在 thinking_delta 分支)正常发布 llm.thinking,
客户端从未订阅,也没有对应渲染代码。桌面端已用 "llm.*" 通配符覆盖。

- 订阅 topic 改为 "llm.*" 通配符,与桌面端对齐,避免将来再逐个枚举时遗漏
- 新增 ThinkingBlock 累积思考内容,标签随完成状态在「当前判断」/「过程说明」间切换;
  节流刷新间隔与 LLMStreamBlock 对齐,避免高频思考分片触发整块重渲染
- _handle_event_inner 增加 llm.thinking 分支,thinking 为空时直接忽略
- _break_llm 同步定稿思考块,_trim_log 将其纳入保护集合,避免长会话裁剪掉内容
@xngyan
xngyan requested a review from rojim666 as a code owner October 4, 2026 12:53
Copilot AI balanced review requested due to automatic review settings October 4, 2026 12:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rojim666
rojim666 merged commit e4707b2 into rojim666:main Oct 4, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants