♻️ refactor: use @lobehub/ui built-in HtmlPreview instead of custom component#14703
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## canary #14703 +/- ##
===========================================
- Coverage 81.92% 66.13% -15.79%
===========================================
Files 672 2913 +2241
Lines 45022 255801 +210779
Branches 6707 31129 +24422
===========================================
+ Hits 36883 169184 +132301
- Misses 7986 86464 +78478
Partials 153 153
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69bd419d8d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (extension && !isReadableFileType(extension)) { | ||
| return buildErrorResult( | ||
| filePath, | ||
| `Error: Unsupported binary file type: .${extension}. Use a different tool (e.g., 'runCommand' with file/hexdump/strings) to inspect binary files.`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Allow text files outside the extension whitelist
For local readFile, this new early return rejects any file whose extension is not in isReadableFileType before the binary sniffer or loadFile can inspect it. That regresses common plaintext project files such as Cargo.lock, Gemfile.lock, .proto, or .graphql: they now return “Unsupported binary file type” even though they are safe text and previously fell through to the text loader. Consider sniffing first and only refusing files that actually look binary, or broadening the text allowlist substantially.
Useful? React with 👍 / 👎.
69bd419 to
15099bd
Compare
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
confirmDone signals the terminal transition (task marked complete),
not just dismissing the brief, so 已阅 loses the semantic distinction
from `confirm`. Use 确认完成 to match the EN intent ("Confirm complete").
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…omponent - Upgrade @lobehub/ui from ^5.10.1 to ^5.10.4 - Replace custom HtmlPreviewAction with lobe-ui's enableHtmlPreview - Wire lobe-ui's onExpand callback to existing HtmlPreviewDrawer - Remove HtmlPreviewAction.tsx (no longer needed) - Keep HtmlPreviewDrawer for the expanded full-screen view
b8d22ef to
53e30f3
Compare
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nent (#14703) * 💄 style(home,i18n): use 已阅 for brief confirm/confirmDone in zh-CN Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(home): use 确认完成 for brief.action.confirmDone in zh-CN confirmDone signals the terminal transition (task marked complete), not just dismissing the brief, so 已阅 loses the semantic distinction from `confirm`. Use 确认完成 to match the EN intent ("Confirm complete"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor: use @lobehub/ui built-in HtmlPreview instead of custom component - Upgrade @lobehub/ui from ^5.10.1 to ^5.10.4 - Replace custom HtmlPreviewAction with lobe-ui's enableHtmlPreview - Wire lobe-ui's onExpand callback to existing HtmlPreviewDrawer - Remove HtmlPreviewAction.tsx (no longer needed) - Keep HtmlPreviewDrawer for the expanded full-screen view * 🐛 fix(task): sync useMarkdown destructuring with assistant MessageContent * 🐛 fix(task): correct mangled search.X JSX expressions in MessageContent Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 💄 style(review): move revert icon to right edge of file row Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…nent (lobehub#14703) * 💄 style(home,i18n): use 已阅 for brief confirm/confirmDone in zh-CN Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 🐛 fix(home): use 确认完成 for brief.action.confirmDone in zh-CN confirmDone signals the terminal transition (task marked complete), not just dismissing the brief, so 已阅 loses the semantic distinction from `confirm`. Use 确认完成 to match the EN intent ("Confirm complete"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * ♻️ refactor: use @lobehub/ui built-in HtmlPreview instead of custom component - Upgrade @lobehub/ui from ^5.10.1 to ^5.10.4 - Replace custom HtmlPreviewAction with lobe-ui's enableHtmlPreview - Wire lobe-ui's onExpand callback to existing HtmlPreviewDrawer - Remove HtmlPreviewAction.tsx (no longer needed) - Keep HtmlPreviewDrawer for the expanded full-screen view * 🐛 fix(task): sync useMarkdown destructuring with assistant MessageContent * 🐛 fix(task): correct mangled search.X JSX expressions in MessageContent Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * 💄 style(review): move revert icon to right edge of file row Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…#14811) PR #14703 wired @lobehub/ui's `enableHtmlPreview` into the Assistant useMarkdown but missed the AssistantGroup path, so any full HTML document the LLM emits in a grouped step rendered as a plain code block instead of an iframe preview. Extract the shared markdown wiring (components, plugins, animated, HtmlPreviewDrawer) into useChatMarkdown so both paths use the same configuration and the next markdown feature won't drift between them. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Replace the custom HtmlPreviewAction with lobe-ui's built-in HtmlPreview component (available since v5.10.4).
Changes
Architecture
Before (custom):
CodeBlock -> Highlighter actionsRender -> HtmlPreviewAction(Eye) -> HtmlPreviewDrawer(iframe)
After (lobe-ui built-in):
CodeBlock -> lobe-ui HtmlPreview (inline iframe + Preview/Source toggle + Expand) -> onExpand -> HtmlPreviewDrawer (full-screen Drawer)
Benefits