Finish the mobile performance pass

- Cache the model catalog once per user and each conversation's setting
  separately; clear both on logout and after model saves
- Compress hashed assets asynchronously with a byte budget and set Vary
- Memoize message parsing and throttle selection reads
- Debounce draft writes to localStorage
- Keep the composer editor on the page and focused, as before
- Add a bundle budget check and run it in CI
- Show a loading block while sessions load and a workspace avatar in the
  mobile conversation header
This commit is contained in:
2026-10-20 14:37:11 +01:00
parent c1a94fc9a5
commit 4f7e0a6bf0
38 changed files with 1320 additions and 334 deletions
+17 -8
View File
@@ -12,11 +12,18 @@ export const AppData = {
*/
ComposerDraftStorageKey: `${SiteData["SiteSlug"]}_composer_draft`,
/**
* Prefix of the chat header's models modal data in `localStorage`, one
* per bot and workspace, and how long it is shown before it is fetched
* again.
* Prefix of the chat header's model data in `localStorage`: one catalog
* per user, and one small setting per bot and workspace.
* `HarnessCatalogCacheMs` is how long the catalog is shown before it is
* fetched again, `HarnessOverviewCacheMs` the setting.
*/
HarnessOverviewStorageKey: `${SiteData["SiteSlug"]}_harness_overview`,
HarnessCacheStorageKey: `${SiteData["SiteSlug"]}_harness_cache`,
HarnessCatalogCacheMs: 60 * 60 * 1000,
/**
* The per-conversation key an older version wrote. Removed on logout
* and by `clearHarnessCache`.
*/
LegacyHarnessOverviewStorageKey: `${SiteData["SiteSlug"]}_harness_overview`,
HarnessOverviewCacheMs: 10 * 60 * 1000,
ServerHealthMessage: "Server Running Well",
/**
@@ -366,12 +373,14 @@ export const AppData = {
/**
* Brotli quality for page scripts and styles, compressed once per
* file and kept in memory (`compressResponse`). 11 is about 25 times
* slower for 10% less.
* slower for 10% less; 5 is close to 9's size at half the time.
*/
CompressBrotliQuality: 9,
CompressBrotliQuality: 5,
/**
* How many compressed page scripts and styles stay in memory. A
* rebuild names its files anew, so the oldest go first.
* How many compressed page scripts and styles, and how many bytes of
* them, stay in memory. A rebuild names its files anew, so the oldest
* go first.
*/
CompressCacheMaxFiles: 600,
CompressCacheMaxBytes: 32 * 1024 * 1024,
} as const;