diff options
| author | Adam Malczewski <[email protected]> | 2026-09-18 18:39:00 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-09-18 18:39:00 +0900 |
| commit | 72663945ef0a0053fbfd83b168e90f12169a5c3a (patch) | |
| tree | d4a7c0071c2a9baeba657316d59b7212031363e0 /src/features/workspaces/ui/WorkspaceTile.test.ts | |
| parent | 9c201c60a727106f1e3bf8c2af5f86aa7427098f (diff) | |
| download | dispatch-web-72663945ef0a0053fbfd83b168e90f12169a5c3a.tar.gz dispatch-web-72663945ef0a0053fbfd83b168e90f12169a5c3a.zip | |
feat(chat): compress images at attach time (JPEG re-encode + rescale) with a per-image toggle
Staged images now default to a compressed variant: LOSSLESS sources
(PNG/BMP) are re-encoded to JPEG at q0.85, rescaled to cap the longest
edge at 2048px (never upscaled, high-quality smoothing, alpha flattened
onto white), and used only under a smaller-wins rule. JPEG/WebP/GIF are
sent verbatim. Each staged thumbnail gets a Compress checkmark (default
ON, reversible until send, cached so flipping never re-encodes); OFF
sends the original untouched bytes. Conversion runs async at staging and
any failure silently falls back to the original — sending is never
blocked or broken.
Pure decision logic lives in features/chat/logic/image-compress.ts
(format selection, dimension math, smaller-wins); the canvas encode is a
thin injected edge (features/chat/adapter/image-encode.ts, Composer prop
encodeJpeg). No wire-contract, send-path, or backend changes; complements
the backend's body-budget eviction safety net by shrinking payloads at
the source.
Verification: typecheck 0 errors, vitest 1720/1720 (twice), biome clean,
build succeeds. New tests: 12 pure-logic, 2 encoder-edge, 6 component.
Diffstat (limited to 'src/features/workspaces/ui/WorkspaceTile.test.ts')
0 files changed, 0 insertions, 0 deletions
