Repository navigation
Web GUI: no in-browser preview for .docx — "Not a text file, preview is unavailable for now" #7993
bennyfarsaci
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Clicking Open on a deliverable card (or an inline-code file reference) for a .docx file opens the right Sidebar preview and shows:
Not a text file, preview is unavailable for now.
The file itself is served correctly — there is simply no Office-document renderer in the browser half of the document-preview package. This affects every .docx deliverable; reproduced across multiple sessions.
Reproduction
In any session, have the agent create and present a .docx file (e.g., generated with python-docx).
On the closing turn's deliverables row, click the card / left side of its Open control.
The Sidebar preview opens and displays: "Not a text file, preview is unavailable for now."
The same file opened from disk (or via the chevron menu → Open with default application) is intact — confirming this is a rendering gap, not a transfer or corruption issue.
Root cause (verified in 0.1.5-rc.3)
Server side is fine. @deepseek-ai/dsh-api-session-controller mounts GET|HEAD /api/file?path= and uses the mime-types package, so .docx responses carry application/vnd.openxmlformats-officedocument.wordprocessingml.document. Bytes arrive complete.
Client side has no Office renderer. @deepseek-ai/dsh-client-ui-sidebar-documentpreview registers renderers for text/code, Markdown, HTML (sandboxed Blob iframe), PDF (pdf.js), and images only. A .docx falls through to the plain-text path and hits the error.notText locale string ("Not a text file, preview is unavailable for now." / "非文本文件,暂时无法预览。").
The only working path today is the card's chevron menu → Open with default application (native open via @deepseek-ai/dsh-native-command).
Suggested fix
Add an Office-document renderer to dsh-client-ui-sidebar-documentpreview, registered alongside the existing PDF and image renderers:
Phase 1 — .docx: convert docx → HTML in-browser with mammoth (MIT, single-file browser bundle, no native dependencies), then render through the package's existing document body component. Register it for MIME application/vnd.openxmlformats-officedocument.wordprocessingml.document and the .docx extension so the Open with dropdown offers it as a first-class viewer instead of falling back to plain text.
Follow the existing renderer contract: shared loading indicator, per-renderer locale keys (en/zh), and graceful failure strings for oversized or malformed files.
Phase 2 — optional: .xlsx / .pptx via SheetJS or equivalent, if demand warrants.
Environment
DSH 0.1.5-rc.3 (npx @deepseek-ai/dsh, Web profile)
Windows host; Web GUI at
http://127.0.0.1:3080/
Affects all .docx deliverables regardless of size or origin
All reactions