mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1582] [Issue]: character list transfers ~300 MB of embedded avatar images on every fetch #820
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#820
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Gunterlie on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1582
Originally assigned to: @Xelvanis on GitHub.
Summary
Every character list fetch transfers the full base64-encoded avatar image for every character inside the JSON payload. With 182 characters this is a 300 MB transfer taking ~12 seconds before any UI can render. Removing
avatarPathfrom list queries drops the payload to 144 KB and 0.35 seconds — a 2,180× reduction.Expected behavior
Character pickers and the library open in well under one second. Avatar images load per-card, on demand, only when visible.
Actual behavior
Measured against a live server with 182 characters:
useCharacters)avatarPath(useCharacterSummaries)avatarPathPer-character breakdown:
169 of 182 characters store their avatar as
data:image/png;base64,...directly in the record. BecauseavatarPathstarts withdata:,getCharacterAvatarLoadingModereturns'eager'— lazy loading provides zero relief.The field-selection optimization in
CHARACTER_SUMMARY_OPTIONShas no effect becauseavatarPathis one of the selected fields.Steps to reproduce
invokestorage_listPOST response is hundreds of MBEnvironment
Additional context
Root cause
avatarPathinCHARACTER_SUMMARY_OPTIONSis a precomputeddata:image/png;base64,...string, not a file path:The backend already stores the avatar as a file and exposes its path via
avatarFilePathandavatarFilenamefields (verified in full record responses).The existing
/api/assets/:kind/*pathHTTP endpoint serves backgrounds, fonts, and lorebook images but does not yet supportavataras a kind.Fix (three parts, one PR)
Part A — Remove
avatarPathfrom list queriesPart B — Add avatar file serving endpoint
Add one match arm to
managed_asset_pathinsrc-tauri/src/http_server.rs:This exposes
/api/assets/avatar/{filename}for remote/web deployments.Part C — Update
CharacterAvatarImageto load from URLBecause
srcis now a URL rather than a data URI, the browser usesloading="lazy"— avatars only load when a card scrolls into view.Constraint: local Tauri install keeps working
convertFileSrcis the standard Tauri utility for turning filesystem paths into webview-loadable URLs. It is already used elsewhere in the codebase. No IPC changes are required.Template check
@Xelvanis commented on GitHub (May 29, 2026):
Checked #1590 against this issue. It looks like #1590 is a partial fix, not a complete resolution of #1582 as written.
What #1590 fixed:
useCharacterSummariesno longer selects embeddedavatarPath; it now selectsavatarFilePathandavatarFilename./api/assets/avatar/...route and shared avatar URL helper were added for remote avatar serving.Remaining gap:
useCharacters()still callsstorageApi.list("characters")with no projection insrc/features/catalog/characters/hooks/use-characters.ts, so it still fetches full character records.CharacterLibraryViewandCharactersPanelstill calluseCharacters()on load, so the library/panel paths can still transfer full embedded base64avatarPathdata for large libraries.Also noting the GitHub closure state: #1590 merged into
refactorwhile the repo default branch ismain, so GitHub did not auto-close this issue from theCloses #1582text. The issue is still open andclosingIssuesReferencesis empty.Recommendation: keep this issue open until the character library/panel list paths stop using unprojected full-character reads, or narrow this issue to only the summary/sidebar/lorebook portion and track the remaining
useCharacters()payload work separately.