Agent replies that produced HTML could only be read as source, so users had to copy the markup into an external file to see the result. Completed Agent and Subagent output now renders complete HTML documents, single-root HTML replies, and `html` / `htm` code blocks as an isolated static preview in place. Each preview keeps a persistent notice that scripts and network are disabled and offers the same icon actions as Mermaid diagrams: a source toggle and a full-screen preview. The new "render HTML in conversations" switch under Platform Features / General is on by default, applies to the open conversation immediately, and falls back to HTML source when disabled. Previews cannot run scripts, reach the network, submit forms, open windows, or load remote media; author stylesheets and inline styles are preserved so the intended layout survives, and remote resource loading is refused by the preview CSP instead. Direct-model replies no longer fail once they grow large. The byte caps on streaming responses, single stream blocks, non-streaming replies, model tool arguments, tool request context, aggregate tool results, and accumulated answer text are removed, so users stop seeing "模型接口流式响应超过安全限制" on long answers. Response length is now governed by the request timeout, cancellation, and context compression. Image generation responses keep their decodable-image validation. A message sent after a failed or interrupted run stayed in the pending queue instead of running. The conversation is now released whenever a run reaches any terminal state, not only when the renderer reports readiness again, and a dispatched queue item whose run never starts releases its reservation and returns to pending. Later messages dispatch without extra user action. Release note: Agent 回复中的 HTML 现在可直接在会话内预览,支持查看源码和全屏预览,默认开启并可在“平台功能 / 通用设置”关闭;直连模型的长回复不再因大小限制中断;上一次运行失败或被中断后,新发送的消息会立即执行而不再排队等待。
2.0 KiB
2.0 KiB
会话 HTML 渲染实现进度
已实现
- 应用级持久开关,默认开启,并提供旧设置迁移。
- 平台功能通用设置中的共享 Switch。
- 已完成 Agent 回复和子 Agent 输出中的完整 HTML 与 fenced HTML 识别。
- 隔离静态预览、持续安全说明和源码切换。
- 预览保留作者
<style>与style属性,样式不再被整块丢弃。 - 与 Mermaid 一致的图标按钮组:源码切换与全屏预览 Modal。
- 嵌入预览固定 480px 高度,源码面板同值上限。
- 用户消息、推理、流式回复和关闭状态的源码边界。
- 设置变更后当前会话立即重新渲染。
验证记录
2026-09-05:
npm run typecheck:通过。- 聚焦测试(应用设置、Markdown、会话时间线、设置中心、App 集成):306 项通过。
- 全量
npm test:3493 passed, 55 skipped。 npm run lint:通过。npm run build:Main、Preload、Renderer 与控制面安装器均成功构建。
修复样式丢失后复验:
- 原实现只要
<style>或style属性中出现@import/url()就整块删除,带渐变或 背景图的回复因此完全失去样式;现改为保留作者样式,外部资源加载仍由 iframe CSP 拒绝。 npx vitest run src/renderer/src/MarkdownRenderer.test.tsx:19 passed。- 聚焦测试(会话时间线、App 集成、设置中心):
260 passed。 npm run typecheck、npm run lint:通过。
新增全屏预览与图标化源码按钮后复验:
- 源码按钮改为代码图标并暴露
aria-expanded;新增放大图标打开全屏 Modal。 - 嵌入预览高度由
min-height: 320px改为固定height: 480px,源码面板上限同步为 480px。 - 新增回归测试覆盖全屏 Modal 的初始焦点、背景 inert、Sandbox/CSP 与 Escape 焦点恢复。
- 聚焦测试(Markdown、会话时间线、App 集成、设置中心):
280 passed。 npm run typecheck、npm run lint:通过。