[GH-ISSUE #1927] Store gallery images as managed files instead of inline data URLs #943

Closed
opened 2026-10-21 05:23:54 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1927

Originally assigned to: @cha1latte on GitHub.

Summary

Chat and character gallery image uploads/generated illustrations are stored as inline data:image values in storage records instead of managed files. Legacy wrote gallery media to data/gallery/... and served it through file routes.

Expected behavior

Gallery uploads and generated gallery images should be persisted as managed media files, with storage records carrying stable file metadata/URLs. Deletes and cleanup should remove the matching file, and remote runtime should have a managed asset path for gallery media.

Actual behavior

Refactor gallery upload builds a base64 data URL and stores it directly in the row. Generated illustrations also create gallery rows with url set to a data URL. The remote managed asset route supports avatar, background, font, game, and lorebook, but not gallery.

Evidence:

  • src-tauri/src/commands/storage/shared.rs:2251 creates gallery records and stores url as data:<mime>;base64,....
  • src/engine/generation/start-generation.ts:744 creates generated gallery rows with url: imageUrl.
  • src-tauri/src/http_server.rs:199 does not include a gallery managed asset kind.
  • Legacy wrote/served files at packages/server/src/routes/gallery.routes.ts:118 and packages/server/src/services/image/image-generation.ts:210.

Steps to reproduce

  1. Upload a chat or character gallery image, or generate an illustration that saves to gallery.
  2. Inspect the created gallery or character-gallery storage record.
  3. Observe that url contains inline data:image payload and no durable managed gallery asset URL/path is used.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor-line audit at 8c36be60
  • Run mode: Static code audit; expected to affect Tauri desktop and remote runtime
  • OS + version: Not relevant
  • Node + pnpm versions: Not relevant
  • Rust version, if relevant: Not relevant
  • Remote Runtime URL configured? Relevant; route currently has no gallery asset kind
  • Provider, model, or integration, if relevant: Image generation/gallery flows

Logs, screenshots, or video

No runtime logs or screenshots. Static parity evidence only.

Regression notes

Legacy stored chat gallery images under data/gallery/<chatId> and generated images through saveImageToDisk(...). Refactor currently stores base64 payloads in storage records.

Additional context

This came from parity target 4, media and assets, under #1904. Suggested fix path: persist chat/character gallery media as managed files, add a gallery managed asset kind for remote runtime, make gallery UI resolve managed gallery URLs, delete files on record deletion, and migrate/repair existing data URL rows where practical.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Jun 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1927 Originally assigned to: @cha1latte on GitHub. ## Summary Chat and character gallery image uploads/generated illustrations are stored as inline `data:image` values in storage records instead of managed files. Legacy wrote gallery media to `data/gallery/...` and served it through file routes. ## Expected behavior Gallery uploads and generated gallery images should be persisted as managed media files, with storage records carrying stable file metadata/URLs. Deletes and cleanup should remove the matching file, and remote runtime should have a managed asset path for gallery media. ## Actual behavior Refactor gallery upload builds a base64 data URL and stores it directly in the row. Generated illustrations also create `gallery` rows with `url` set to a data URL. The remote managed asset route supports `avatar`, `background`, `font`, `game`, and `lorebook`, but not `gallery`. Evidence: - `src-tauri/src/commands/storage/shared.rs:2251` creates gallery records and stores `url` as `data:<mime>;base64,...`. - `src/engine/generation/start-generation.ts:744` creates generated `gallery` rows with `url: imageUrl`. - `src-tauri/src/http_server.rs:199` does not include a `gallery` managed asset kind. - Legacy wrote/served files at `packages/server/src/routes/gallery.routes.ts:118` and `packages/server/src/services/image/image-generation.ts:210`. ## Steps to reproduce 1. Upload a chat or character gallery image, or generate an illustration that saves to gallery. 2. Inspect the created `gallery` or `character-gallery` storage record. 3. Observe that `url` contains inline `data:image` payload and no durable managed gallery asset URL/path is used. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [x] Chat mode - [ ] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor-line audit at `8c36be60` - Run mode: Static code audit; expected to affect Tauri desktop and remote runtime - OS + version: Not relevant - Node + pnpm versions: Not relevant - Rust version, if relevant: Not relevant - Remote Runtime URL configured? Relevant; route currently has no gallery asset kind - Provider, model, or integration, if relevant: Image generation/gallery flows ## Logs, screenshots, or video No runtime logs or screenshots. Static parity evidence only. ## Regression notes Legacy stored chat gallery images under `data/gallery/<chatId>` and generated images through `saveImageToDisk(...)`. Refactor currently stores base64 payloads in storage records. ## Additional context This came from parity target 4, media and assets, under #1904. Suggested fix path: persist chat/character gallery media as managed files, add a `gallery` managed asset kind for remote runtime, make gallery UI resolve managed gallery URLs, delete files on record deletion, and migrate/repair existing data URL rows where practical. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:23:54 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 2, 2026):

fixed in #1941

<!-- gh-comment-id:4603836244 --> @cha1latte commented on GitHub (Jun 2, 2026): fixed in #1941
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#943
No description provided.