Repository navigation
Studio: document viewer for PDF, Word, Excel and PowerPoint, with origin links in Library - #12001
Conversation
…gin links in Library
This comment has been minimized.
This comment has been minimized.
…nd text downloads
…slides, originals sweep on message removal
…lized PDF pages, large DOCX images
…ch, run origins under outputs
… attach, whole-text downloads
… and sweep lock, deduplicated storage
Spreadsheets - Read sheet XML as text instead of through DOMParser, and only up to the rows kept. Unpack only the parts the workbook uses, so custom XML and pivot caches are skipped. Shared strings decode lazily. - Parse each number format once per workbook instead of once per cell. - Grid renders only the columns in view, with memoized rows. - Quoted semicolons no longer split format sections, scientific formats keep their literals, and elapsed times show fractional seconds. Presentations - Pictures stay as Blobs with object URLs made per mounted slide, instead of base64 data URLs for the whole deck. Video and audio are not unpacked. - Native tables are capped like chart tables. SmartArt labels are read. Word - Rendering stops after 50,000 elements, with a note. Chat - Office text for the model is budgeted in UTF-8 bytes, delimiters included. - Attaching an XLSX or PPTX reads the file once. Chat originals - Sweeps no longer create the originals folder, so a late sweep cannot recreate a deleted account's workspace. - Startup sweeps every account. Deleting an attachment from the Library sweeps too.
- A negative value in its own fraction section, such as (# ?/?), no longer gets an extra minus. - String cells use the format's text section: the fourth section, or a single section with @. ABC in 0;0;0;"SKU-"@ shows SKU-ABC. - Shared strings are scanned from the part's bytes only up to the highest index a cell uses, and decoded one at a time, instead of building the whole table.
|
@codex review |
|
@codex security review |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b3e2a5334
ℹ️ 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".
| with _due_changed: | ||
| if directory in _due: | ||
| return | ||
| _due[directory] = (time.monotonic() + _SWEEP_GRACE_SECONDS + 60, contextvars.copy_context()) |
There was a problem hiding this comment.
Schedule throttled sweeps for the earliest eligible time
When a sweep is throttled, or finds an unreferenced file already close to the one-hour grace limit, this always delays the next attempt by another 61 minutes. For example, deleting a days-old attachment one minute after another sweep leaves its original on disk for over an hour rather than only the remaining nine-minute throttle interval; a 59-minute-old orphan can remain for roughly two hours. Compute the due time from the remaining throttle/grace interval so deleted originals are not retained substantially longer than configured.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Below the bar: this only changes when an orphaned original is deleted, not whether it is; nothing referenced is ever removed and the file still goes on the next sweep.
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f763e4f2a0
ℹ️ 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".
| : "utf-8"; | ||
| const text = new TextDecoder(encoding).decode(bytes); |
There was a problem hiding this comment.
Honor the declared charset when decoding delimited files
For CSV or TSV files whose MIME type declares a non-UTF-8 charset, such as text/csv; charset=windows-1252, this path ignores the declaration and always decodes BOM-less data as UTF-8. The viewer therefore silently replaces or corrupts accented and non-Latin cell values even though TextDecoder supports the declared encoding; parse the MIME charset before falling back to UTF-8.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not reachable: browsers type a File from its extension with no charset parameter, and Library types uploads by extension on the server (test_uploads_are_listed_and_typed_by_their_extension_not_the_client), so no contentType reaching this decoder carries a charset.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Library and chat can now open PDF, Word, Excel, PowerPoint, CSV and TSV files as they look, instead of as extracted text. Every Library item also links back to where it came from.
Changes
Viewer (
components/file-viewer)Library preview
Library grid and sort
Origin links (the
...menu)-gguf,-adapterand-mergedexports.From chat · <chat title>in the subtitle, so they read apart from a direct upload of the same file.Chat
chat-originals/throughPOST /api/chat/attachment-originals, and the attachment records it asoriginal. Temporary chats store nothing, and a failed upload only affects viewing.GET /api/chat/attachments/{message_id}/{attachment_id}/fileserves the original when there is one, asapplication/octet-streamwithnosniff.original_sha256, so the Library lists sent documents with their originals.Performance
Measured in Chromium, before and after the reader and grid changes:
Testing
tscclean, tests pass (including new reader tests intests/file-viewer-office.test.ts), build within budget, no new missing keys ini18n:check:strict.Notes
.xlsxor.pptxyet. The attach button does.Screenshots
Before is the merge base on main, after is this branch, each in its own Studio install.
XLSX in the Library: before, "No preview for this file type"; after, the sheet as a grid with its sheet tabs.
DOCX in the Library: before, "No preview for this file type"; after, the rendered page including its table.