[PR #724] [CLOSED] Add local PDF, Word and Excel attachments with screenshot previews #2791

Closed
opened 2026-11-04 02:03:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/724
Author: @medking82
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: codex/document-attachments


📝 Commits (10+)

  • b0dda4b AMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cards
  • cc97fcd setup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each)
  • e9e2ba3 pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decode
  • cacffa9 CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats
  • a348c7a Merge branch 'f-131-srv' into r131-q4
  • b93a00c Merge branch 'f-q4-on242' into r131-q4
  • 8f5148c CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on
  • 5ffda19 CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)
  • ed6c124 #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down
  • 450149d --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV

📊 Changes

11 files changed (+991 additions, -27 deletions)

View changed files

📝 docs/DETAILS.md (+20 -0)
📝 requirements.txt (+10 -0)
➕ serve/file_extract.py (+305 -0)
📝 serve/server.py (+33 -1)
➕ serve/test_file_extract.py (+183 -0)
➕ serve/test_file_extract_http.py (+75 -0)
📝 serve/web/app.css (+8 -0)
📝 serve/web/app.js (+133 -25)
📝 serve/web/index.html (+2 -0)
➕ tools/test_chat_attachments.cjs (+211 -0)
📝 tools/test_setup_pins.py (+11 -1)

📄 Description

The web chat currently accepts text files and sends images, but screenshots have no preview or persisted draft and PDF, Word and Excel files cannot be read. This adds screenshot paste/drop previews and bounded, local document extraction to the existing single-chat UI.

Behavior

  • PDF, DOCX, XLSX and text/source files are attached as extracted text. Scanned PDF pages can fall back to PNG images when the model supports vision.
  • Images retain the existing native OpenAI image_url format. Drafts survive reload when browser storage permits; a storage failure explicitly warns that the current draft is only in memory.
  • Document batches extract serially. Send waits for queued files, removal updates the draft, and New chat cancels old extraction work so stale files cannot enter the next chat.
  • The same-origin, authenticated /v1/files/extract route checks declared request size before reading uploads. A separate worker reuses the existing process-lifetime containment, with a 30-second timeout, 768 MiB memory limit and two-worker admission cap. Uploaded originals are not written to disk.

Limits

20 MiB per file, 512 KiB extracted text, at most eight rendered PDF pages with a 1600-pixel edge and an 8 MiB image payload cap. DOCX extraction covers body paragraphs and tables; embedded images are not extracted. XLSX reads cached values and does not execute formulas. Complex files may hit these bounds. This uses pinned parser dependencies and leaves installed engine/runtime dependencies alone.

Validation

  • Windows: 32 extraction, HTTP-admission and setup dependency tests passed.
  • Windows: 149 existing server, security, lifecycle and process-containment regression tests passed.
  • 12 Node attachment tests passed, including serial batches, cancellation, pending Send, draft reload and storage-quota failure/recovery.
  • JavaScript syntax and scoped whitespace checks passed.
  • Isolated synthetic browser fixture: screenshot plus PDF/DOCX/XLSX batch, disabled Send during extraction, persisted previews after reload, removal and captured native image/text request passed. Desktop and 390-pixel layout checked.

This is independent of chat persistence, compaction and adaptive memory policy. It does not alter the native engine or require a running model for document extraction. Linux worker limits are implemented but have not been exercised in this contribution's Windows validation.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/724 **Author:** [@medking82](https://github.com/medking82) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/document-attachments` --- ### 📝 Commits (10+) - [`b0dda4b`](https://github.com/Niko1221/Strata/commit/b0dda4b14886293575e5fe5c92e5ba6636adc4a1) AMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cards - [`cc97fcd`](https://github.com/Niko1221/Strata/commit/cc97fcde526e1b2d4cbee39ba21e54a0ef7505b1) setup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each) - [`e9e2ba3`](https://github.com/Niko1221/Strata/commit/e9e2ba31abdc211a618b5faf7226732d40bbcf2b) pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decode - [`cacffa9`](https://github.com/Niko1221/Strata/commit/cacffa95aff016939edd7c15534c0067ec0ee93c) CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats - [`a348c7a`](https://github.com/Niko1221/Strata/commit/a348c7a4ed64f5f7f24ce3f1cba2d1439f673fed) Merge branch 'f-131-srv' into r131-q4 - [`b93a00c`](https://github.com/Niko1221/Strata/commit/b93a00c65a21fcc5b6431b8091e348d2976259f0) Merge branch 'f-q4-on242' into r131-q4 - [`8f5148c`](https://github.com/Niko1221/Strata/commit/8f5148c14d34c404e8a2d6a45188088714f3c9bb) CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on - [`5ffda19`](https://github.com/Niko1221/Strata/commit/5ffda19098202b82943fc80281ce0eb34d8e08a3) CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory) - [`ed6c124`](https://github.com/Niko1221/Strata/commit/ed6c1244dcd31789007540cb9d8498fbd4134b7f) #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down - [`450149d`](https://github.com/Niko1221/Strata/commit/450149d3f248438d8a2526c600b5a75c3dbea6c6) --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV ### 📊 Changes **11 files changed** (+991 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+20 -0) 📝 `requirements.txt` (+10 -0) ➕ `serve/file_extract.py` (+305 -0) 📝 `serve/server.py` (+33 -1) ➕ `serve/test_file_extract.py` (+183 -0) ➕ `serve/test_file_extract_http.py` (+75 -0) 📝 `serve/web/app.css` (+8 -0) 📝 `serve/web/app.js` (+133 -25) 📝 `serve/web/index.html` (+2 -0) ➕ `tools/test_chat_attachments.cjs` (+211 -0) 📝 `tools/test_setup_pins.py` (+11 -1) </details> ### 📄 Description The web chat currently accepts text files and sends images, but screenshots have no preview or persisted draft and PDF, Word and Excel files cannot be read. This adds screenshot paste/drop previews and bounded, local document extraction to the existing single-chat UI. ## Behavior - PDF, DOCX, XLSX and text/source files are attached as extracted text. Scanned PDF pages can fall back to PNG images when the model supports vision. - Images retain the existing native OpenAI `image_url` format. Drafts survive reload when browser storage permits; a storage failure explicitly warns that the current draft is only in memory. - Document batches extract serially. Send waits for queued files, removal updates the draft, and New chat cancels old extraction work so stale files cannot enter the next chat. - The same-origin, authenticated `/v1/files/extract` route checks declared request size before reading uploads. A separate worker reuses the existing process-lifetime containment, with a 30-second timeout, 768 MiB memory limit and two-worker admission cap. Uploaded originals are not written to disk. ## Limits 20 MiB per file, 512 KiB extracted text, at most eight rendered PDF pages with a 1600-pixel edge and an 8 MiB image payload cap. DOCX extraction covers body paragraphs and tables; embedded images are not extracted. XLSX reads cached values and does not execute formulas. Complex files may hit these bounds. This uses pinned parser dependencies and leaves installed engine/runtime dependencies alone. ## Validation - Windows: 32 extraction, HTTP-admission and setup dependency tests passed. - Windows: 149 existing server, security, lifecycle and process-containment regression tests passed. - 12 Node attachment tests passed, including serial batches, cancellation, pending Send, draft reload and storage-quota failure/recovery. - JavaScript syntax and scoped whitespace checks passed. - Isolated synthetic browser fixture: screenshot plus PDF/DOCX/XLSX batch, disabled Send during extraction, persisted previews after reload, removal and captured native image/text request passed. Desktop and 390-pixel layout checked. This is independent of chat persistence, compaction and adaptive memory policy. It does not alter the native engine or require a running model for document extraction. Linux worker limits are implemented but have not been exercised in this contribution's Windows validation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:08 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2791
No description provided.