[GH-ISSUE #5509] [GUI] Saved chats: keep a small preview of attached pictures #5480

Open
opened 2026-11-07 23:43:58 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Astemiir on GitHub (Nov 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/5509

[GUI] Saved chats: keep a small preview of attached pictures

Area: GUI (web chat) — serve/web/history.js, serve/web/app.js

Versions: app 0.2.12 / control 0.1.58

Problem

history.js stores attachments by name only:

// pictures and files are kept as their names only: a data URL would fill the browser's storage
const cleanMessages = (list) => list.map((m) => ({...m, images: (m.images || []).map((i) => ({name: i.name})), ...

so a chat reopened after a reload (or after switching to another chat and back) shows a chip with
the file name instead of the picture. The full data URL is intentionally not stored — that part is
right — but the user loses the visual reference.

Proposal

Store a small thumbnail next to the name, never the original:

  1. when a picture is attached, draw it to a canvas (long side ≤ 480 px) and toDataURL("image/jpeg", 0.72);
  2. the message keeps {name, thumb}; cleanMessages passes thumb through;
  3. rendering uses im.url || im.thumb (session keeps the original, history shows the preview);
  4. apiMessages() still sends only entries with url, so a thumbnail is never sent to the model.

Measured: a 900×600 PNG → thumbnail 6 131 bytes. A chat with 20 pictures keeps ~120 KB instead of
tens of megabytes.

Test plan

  • attach a picture, send, switch to another chat, return — picture and answer are still there;
  • reload the page, open the chat — the preview is rendered (src starts with data:image/jpeg);
  • in the same session the model still receives the original (prompt_tokens includes image tokens);
  • a chat saved before the change still opens, just without a preview (no thumb in the record).
Originally created by @Astemiir on GitHub (Nov 7, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/5509 # [GUI] Saved chats: keep a small preview of attached pictures **Area:** GUI (web chat) — `serve/web/history.js`, `serve/web/app.js` **Versions:** app 0.2.12 / control 0.1.58 ## Problem `history.js` stores attachments by name only: ```js // pictures and files are kept as their names only: a data URL would fill the browser's storage const cleanMessages = (list) => list.map((m) => ({...m, images: (m.images || []).map((i) => ({name: i.name})), ... ``` so a chat reopened after a reload (or after switching to another chat and back) shows a chip with the file name instead of the picture. The full data URL is intentionally not stored — that part is right — but the user loses the visual reference. ## Proposal Store a small thumbnail next to the name, never the original: 1. when a picture is attached, draw it to a canvas (long side ≤ 480 px) and `toDataURL("image/jpeg", 0.72)`; 2. the message keeps `{name, thumb}`; `cleanMessages` passes `thumb` through; 3. rendering uses `im.url || im.thumb` (session keeps the original, history shows the preview); 4. `apiMessages()` still sends only entries with `url`, so a thumbnail is never sent to the model. Measured: a 900×600 PNG → thumbnail 6 131 bytes. A chat with 20 pictures keeps ~120 KB instead of tens of megabytes. ## Test plan - attach a picture, send, switch to another chat, return — picture and answer are still there; - reload the page, open the chat — the preview is rendered (`src` starts with `data:image/jpeg`); - in the same session the model still receives the original (`prompt_tokens` includes image tokens); - a chat saved before the change still opens, just without a preview (no thumb in the record).
Author
Owner

@github-actions[bot] commented on GitHub (Nov 7, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Add your graphics card with its VRAM, your RAM and your operating system.

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6709594960 --> @github-actions[bot] commented on GitHub (Nov 7, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Add your graphics card with its VRAM, your RAM and your operating system. Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
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#5480
No description provided.