fix: imggen inlay rendering by wrapping stored image IDs#1200
Closed
joonsoome wants to merge 5 commits intokwaroran:mainfrom
Closed
fix: imggen inlay rendering by wrapping stored image IDs#1200joonsoome wants to merge 5 commits intokwaroran:mainfrom
joonsoome wants to merge 5 commits intokwaroran:mainfrom
Conversation
3 tasks
830bd75 to
0ad7509
Compare
ef73536 to
f83810f
Compare
This was referenced Feb 6, 2026
kwaroran
added a commit
that referenced
this pull request
Feb 11, 2026
# Issues Thank you for report @sub-hub . 1. Regressions introduced by #1219 (3 type error for awaiting #1200 , and 2. Pre-existing typecheck failures already present on upstream/main (6 issues) The branch is rebased on top of `upstream/main`, and both local checks now pass. **Branch** : `fork/fix/pr1219-typecheck-upstream` **Commit** : `8ea0a057134ba37db7557b41d9785041d6989786` — `fix: make typecheck pass` ### Verification - pnpm check → 0 errors - pnpm -s exec tsc -p tsconfig.json --noEmit → exit 0 --- ## 1) PR #1219 regressions fixed (new breakages introduced by the PR) While reproducing pnpm check on #1219 , I found 9 errors total: - 6 already exist on upstream/main (baseline) - 3 are introduced by PR #1219 (regressions) These PR-specific breakages are now fixed: - Missing module: `src/ts/util/inlayTokens` - `hypav3.ts` imported `src/ts/util/inlayTokens`, but the module did not exist, causing typecheck to fail. - **Fix** : added/implemented the missing module export via `inlayTokens.ts` and introduced `inlayTokenRegex` (resolves `TS2307`). - New settings keys without Database schema/defaults - `advancedSettingsData.ts` introduced `bindKey: 'checkCorruption'`, but `Database` had no such field/default. - `accessibilitySettingsData.ts` introduced `toggleConfirmRecommendedPreset`, also missing from `Database`. - Fix: added both keys to the `Database` type and ensured defaults are set in `database.svelte.ts` (`setDatabase()` defaults to `false`). --- ## 2) Pre-existing `upstream/main` typecheck failures fixed (not introduced by #1219 ) These issues were already failing on main, and are included here to keep the tree typecheck-clean: - `plugins.svelte.ts` - Removed `window.trustedTypes` typing error (with required `unknown` casting) - Removed `@ts-expect-error` - Forced `createRealScript()` return type to `string` - `IconButton.svelte` - Re-destructured `id` from `$props()` to remove the `id={id}` TS error\ - RealmFrame.svelte - Reverted `asBuffer(...buffer)` back to the #1200 approach using `toArrayBuffer(Uint8Array)` to fix `ArrayBuffer` typing mismatch - `hypav3.ts` - Kept sanitization behavior: replace `{{inlay...}}` tokens with `[Image]` in summaries --- ### Note: postcss-selector-parser TS2307 The `postcss-selector-parser` `TS2307` was caused by an out-of-date local `node_modules`. After running `pnpm install --frozen-lockfile`, the correct install/linking resolved it (no shim files added).
Contributor
Author
Resolve Conflicts and ... (26-02-13)Today I updated this PR with commit What was done
Validation
|
Contributor
Author
Conflict Resolution Summary (PR #1200)Synchronized the What I did
Why conflicts happened
Resolution policy used
Validation
|
8221589 to
a0c1068
Compare
Contributor
Author
|
I’ve rebuilt this in a clean for better review, upstream-friendly way and pushed it as 4 isolated commits. Key points:
Validation is done ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR rebuilds the inlay-asset lifecycle changes in a clean, non-duplicated way while respecting upstream updates.
What’s included
Commit structure
7efba86dfeat(inlay): move assets to metadata-backed storage with legacy migration829735bbfeat(inlay): clean orphan assets when chats/messages are deleted1bb072fcfeat(backup): include inlay media and legacy inlay metadata in local backups3e0dbf4afeat(chat-zip): bundle inlay media in chat zip export/importValidation
pnpm checkpassed (svelte-check found 0 errors and 0 warnings)Notes
Summary (Outdated)Fixes inlay rendering so generated IDs are wrapped and render properly, hardens the inlay pipeline, and persists inlay assets with metadata so they load consistently across devices.Updates (26-02-06)First, I apologize for continuously updating the same PR. Since this PR hasn't been merged, I should have created a separate Enhancement PR, but I had no choice but to add this update. I belatedly discovered that inlay media assets are not included when backing up individual chats or the entire chat history. Consequently, when restoring a backup after a system change or clearing the cache, the inlay assets fail to restore. Therefore, I've added the functionality below. I sincerely hope the admins will kindly approve this.commit - 6e69abcEnhancement: Include inlay media in backups + chat ZIP export/importThis commit ensures inlay media (image/audio/video) is preserved across:
Local Full Backup/Restore (including legacy inlays still stored in localforage), andChat export/import via a new ZIP format that bundles chat JSON + inlay files.Key ChangesLocal Full Backup now includes legacy inlay assets from localforage (name: "inlay") when they are not yet present in db.inlayAssets, and injects corresponding inlayAssets metadata into the backup DB payload.Single-chat export menu adds Export as ZIP (bundles inlays) alongside existing JSON/TXT/HTML options.All-chats export now prompts JSON Export vs Export as ZIP.Chat import now accepts .zip and deploys inlay files into assets/ if missing (skips if already present), registering db.inlayAssets for rendering.New Format :risuChatZip- ZIP structure:chat.json: same schema as existing JSON export: risuChat/risuAllChats ver 2)manifest.json:[", inlays: { ... } }]. (one file per referenced inlay token)Backward CompatibilityExisting JSON export/import remains unchanged.ZIP export/import is additive.How to VerifySingle chat ZIP export/import (with inlays)Open a character chat that contains inlay tokens (e.g. [{{inlayed::...}}]Click the chat export button → choose Export as ZIP.Import the resulting .zip via the chat Import icon.Confirm the chat is imported and inlay media renders correctly.All chats ZIP export/importClick the bottom-left download icon (all chats export).Choose Export as ZIPImport the resulting .zip via the chat Import icon.Confirm multiple chats/folders import correctly and inlays render.Local Full Backup/Restore includes legacy inlaysSettings → Account & Files → Save Backup Locally (creates .bin).Restore via Load Backup Locally.Confirm chats and inlay media render after restore.NotesImporting .json alone does not bundle inlay files; only .zip includes media.If some inlays are missing from the source device/storage, export/import will proceed and show a warning listing skipped/failed inlays.Files Changedbackuplocal.tscharacters.tschatZipExport.tsRebase Updates (26-01-30)This branch still modernizes the inlay pipeline beyond upstream’s localforage-only flow. Inlays are now persisted as assets with DB metadata, legacy blobs are migrated on access, and rendering is hardened so UUIDs never leak into chat output. The parser preserves inlay tokens through script/display processing and ignores code blocks, while imggen output is wrapped as {{inlayed::…}} with safer error handling. The pipeline also handles ComfyUI content-types correctly, keeps asset file extensions in sync with actual encodes (WebP-aware), and adds cleanup/backup coverage for image/audio/video inlays when chats or characters are removed or auto-purged.ChangesWrap writeInlayImage results with {{inlayed::...}} so the parser renders inlays instead of showing UUID text (notably for ComfyUI).Harden image load/encode with explicit error handling; guard inlay generation flow.Preserve inlay tokens through script/display processing and warn when image visibility settings hide inlays.Add WebP-aware conversion metadata and ensure asset paths match actual output extension.Store inlays in assets/ with metadata; load from assets first and migrate legacy localforage blobs on access.Clean up inlay assets when chats/messages are removed; include inlay assets in purge/backup paths.Remove inlay assets when a character is permanently deleted from the roster.Purge inlay assets when trash auto-removal deletes characters on startup.Testingtriggered /trigger image (custom V2 image generation) and character setup to show with inlay screen enabled (lorebook, character setting); image renders instead of UUID.tsconfig.json (existing error: RealmFrame.svelte (line 66, column 17)) <- It is not related with this PRVerification
Screenshot
Related Issue
#802