[PR #1956] [MERGED] Improve managed avatar image delivery #5359

Closed
opened 2026-10-22 04:15:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1956
Author: @Promansis
Created: 6/2/2026
Status: ✅ Merged
Merged: 6/2/2026
Merged by: @Promansis

Base: refactor ← Head: fix/1944-inline-avatar-thumbnails


📝 Commits (4)

  • 0772910 Fix inline avatar thumbnail serving
  • b86cd73 Defer avatar thumbnail resolution
  • ff2bd9e Improve managed asset image delivery
  • 79c12fd Fix managed avatar asset cache handling

📊 Changes

8 files changed (+587 additions, -45 deletions)

View changed files

📝 src-tauri/src/commands/storage/avatars.rs (+162 -6)
📝 src-tauri/src/commands/storage/commands/media.rs (+8 -1)
📝 src-tauri/src/http_dispatch.rs (+1 -0)
📝 src-tauri/src/http_server.rs (+144 -5)
📝 src/features/catalog/characters/components/CharacterAvatarImage.tsx (+80 -10)
📝 src/features/modes/shared/chat-ui/components/ChatMessage.tsx (+34 -0)
📝 src/features/modes/shared/chat-ui/components/ResolvedAvatarImage.tsx (+43 -12)
📝 src/shared/api/local-file-api.ts (+115 -11)

📄 Description

Linked issue

Closes #1944 - mostly.

Why this change

  • Fixes slow and oversized avatar/image delivery paths where chat and catalog views could load full managed avatar images for tiny displayed dimensions.
  • Restores reliable inline avatar thumbnail serving for remote and embedded runtimes.
  • Adds related refactor-branch fixes for gallery managed media, active world info scanning, roleplay narrator style, and game asset background handling.

What changed

  • Added managed avatar thumbnail generation and serving, including inline data URL thumbnail support.
  • Routed small chat and catalog avatar displays through size-bucketed thumbnail URLs while preserving full-size avatar lightbox behavior.
  • Added cache and validation headers for managed HTTP assets.
  • Hardened gallery/media managed file handling and remote asset URL resolution paths.
  • Included active world info scan, roleplay narrator style, swipe, and game asset background fixes already present on this branch.

Refactor impact

Primary owner:

shared API, shared mode UI, Rust storage, remote runtime

Impact areas reviewed:

  • Managed avatar storage and thumbnail cache paths.
  • Chat message avatar rendering, merged avatars, roleplay avatar panels, and catalog avatar cards.
  • Hostable HTTP asset routing and remote runtime asset resolution.
  • Gallery managed media and related storage cleanup/restore paths.
  • Active world info scan and prompt assembly call sites touched by this branch.

Boundary notes:

  • Feature UI continues to call shared API avatar/file helpers rather than raw Tauri or remote fetch.
  • Rust keeps privileged file access, thumbnail generation, and managed asset HTTP serving.
  • Engine changes remain React-free and stay within generation/storage capability boundaries.

Pressure points touched:

  • Shared mode UI: ChatMessage, ResolvedAvatarImage, chat settings and transcript actions.
  • Rust command registration and HTTP dispatch for avatar thumbnail file paths.
  • Managed asset HTTP server route.
  • Import/storage modules for gallery and background managed media.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • pnpm typecheck
  • pnpm check:architecture
  • cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::managed_asset_headers_include_cache_and_validation_metadata

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • This is primarily bugfix/internal performance and compatibility work. The branch includes discovery metadata changes from existing commits; no new user-facing feature discovery path is required for the avatar thumbnail/cache fix.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • Not captured.

🔄 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/Pasta-Devs/Marinara-Engine/pull/1956 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/1944-inline-avatar-thumbnails` --- ### 📝 Commits (4) - [`0772910`](https://github.com/Pasta-Devs/Marinara-Engine/commit/07729105c95907b1dc04c876f55cf59a6b14366e) Fix inline avatar thumbnail serving - [`b86cd73`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b86cd73b6aa97a769247fb94f5e4d81d14a04ce3) Defer avatar thumbnail resolution - [`ff2bd9e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ff2bd9e55d8ec0456d60c2d94dd7350c3aa01558) Improve managed asset image delivery - [`79c12fd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/79c12fdc7a51753fcaa146df4e4d54fcbfde7e90) Fix managed avatar asset cache handling ### 📊 Changes **8 files changed** (+587 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/avatars.rs` (+162 -6) 📝 `src-tauri/src/commands/storage/commands/media.rs` (+8 -1) 📝 `src-tauri/src/http_dispatch.rs` (+1 -0) 📝 `src-tauri/src/http_server.rs` (+144 -5) 📝 `src/features/catalog/characters/components/CharacterAvatarImage.tsx` (+80 -10) 📝 `src/features/modes/shared/chat-ui/components/ChatMessage.tsx` (+34 -0) 📝 `src/features/modes/shared/chat-ui/components/ResolvedAvatarImage.tsx` (+43 -12) 📝 `src/shared/api/local-file-api.ts` (+115 -11) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes #1944 - mostly. ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Fixes slow and oversized avatar/image delivery paths where chat and catalog views could load full managed avatar images for tiny displayed dimensions. - Restores reliable inline avatar thumbnail serving for remote and embedded runtimes. - Adds related refactor-branch fixes for gallery managed media, active world info scanning, roleplay narrator style, and game asset background handling. ## What changed <!-- List the key changes in this PR. --> - Added managed avatar thumbnail generation and serving, including inline data URL thumbnail support. - Routed small chat and catalog avatar displays through size-bucketed thumbnail URLs while preserving full-size avatar lightbox behavior. - Added cache and validation headers for managed HTTP assets. - Hardened gallery/media managed file handling and remote asset URL resolution paths. - Included active world info scan, roleplay narrator style, swipe, and game asset background fixes already present on this branch. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> shared API, shared mode UI, Rust storage, remote runtime Impact areas reviewed: - Managed avatar storage and thumbnail cache paths. - Chat message avatar rendering, merged avatars, roleplay avatar panels, and catalog avatar cards. - Hostable HTTP asset routing and remote runtime asset resolution. - Gallery managed media and related storage cleanup/restore paths. - Active world info scan and prompt assembly call sites touched by this branch. Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - Feature UI continues to call shared API avatar/file helpers rather than raw Tauri or remote fetch. - Rust keeps privileged file access, thumbnail generation, and managed asset HTTP serving. - Engine changes remain React-free and stay within generation/storage capability boundaries. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - Shared mode UI: `ChatMessage`, `ResolvedAvatarImage`, chat settings and transcript actions. - Rust command registration and HTTP dispatch for avatar thumbnail file paths. - Managed asset HTTP server route. - Import/storage modules for gallery and background managed media. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [x] Human/manual validation completed by contributor or reviewer ### Manual verification notes <!-- Describe exact commands and manual steps, including typecheck/build/docs/architecture/Rust/browser/remote-runtime checks when they apply. If an AI agent filled this out, verify it yourself before ticking boxes. --> - `pnpm typecheck` - `pnpm check:architecture` - `cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::managed_asset_headers_include_cache_and_validation_metadata` ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - This is primarily bugfix/internal performance and compatibility work. The branch includes discovery metadata changes from existing commits; no new user-facing feature discovery path is required for the avatar thumbnail/cache fix. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence <!-- Add before/after screenshots or recordings for visible UI changes. --> - Not captured. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:33 +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
Pasta-Devs/Marinara-Engine#5359
No description provided.