Add asset cache system for IC message rendering#291
Draft
OmniTroid wants to merge 3 commits intoAttorneyOnline:masterfrom
Draft
Add asset cache system for IC message rendering#291OmniTroid wants to merge 3 commits intoAttorneyOnline:masterfrom
OmniTroid wants to merge 3 commits intoAttorneyOnline:masterfrom
Conversation
Implements preloading of all assets before IC message rendering begins, eliminating visual glitches from sprites popping in late. Adds caching to avoid repeated HEAD requests for previously loaded assets. New cache system (webAO/cache/): - AssetCache: Cache API wrapper with in-memory metadata (LRU, 1000 entries) - UrlResolver: Extension probing with request deduplication - AssetPreloader: Parallel resolution of all URLs for a ChatMsg Modified render flow: - handleMS now preloads all assets before calling handle_ic_speaking - handleICSpeaking and chat_tick use pre-resolved manifest URLs - Graceful fallback to original setEmote() when manifest unavailable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
Only set image src if the URL has changed, preventing the idle animation from restarting when paired characters receive new messages. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move appendICLog and checkCallword to handleMS before preloading to ensure messages are logged in arrival order - Add message sequence counter to track current message - Skip rendering if a newer message arrived during preload - Prevents out-of-order IC log entries when messages arrive rapidly Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| if (result) { | ||
| manifest.pairCharIdleUrl = result.resolvedUrl; | ||
| } else { | ||
| manifest.failedAssets.push(`pair-idle:${pairName}/${pairEmote}`); |
Member
There was a problem hiding this comment.
why are pair sprites treated seperately
|
|
||
| export const getAssetPreloader = ( | ||
| emoteExtensions: string[], | ||
| animationExtensions: string[] = [".gif", ".webp", ".apng"], |
Member
There was a problem hiding this comment.
file extension priority can be set by the server using extensions.json
|
|
||
| if (extension === ".png") { | ||
| url = `${characterFolder}${encodedChar}/${encodedEmote}${extension}`; | ||
| } else if (extension === ".webp.static") { |
Member
There was a problem hiding this comment.
this is duplicate code, either use it from setEmote.ts, remove it there or put it in a seperate file.
Merged
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
Changes
New cache system (
webAO/cache/):AssetCache: Cache API wrapper with browser-managed storage and in-memory metadataUrlResolver: Extension probing with request deduplication via pending resolutions MapAssetPreloader: Parallel resolution of all URLs needed for a ChatMsg, returns PreloadManifestModified render flow:
handleMSnow preloads all assets before callinghandle_ic_speakinghandleICSpeakingandchat_tickuse pre-resolved manifest URLs directlysetEmote()behavior when manifest unavailableTest plan
🤖 Generated with Claude Code