char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
3dc7285b4
char/aliceai-t5-moe
1/** 2* versionStore - Build version information 3* 4* - `build`: llama.cpp build number from `build.json`, embedded at llama.cpp 5* build time (LLAMA_BUILD_NUMBER). Shown in the UI when `showBuildVersion` 6* is enabled. 7* - `frontend`: frontend build version from SvelteKit's `_app/version.json`, 8* generated by the @vite-pwa/sveltekit plugin. Changes on every build, so 9* comparing it against localStorage reliably detects server upgrades. 10* 11* In dev mode both fall back to `'dev'`. 12*/ 13 14import { browser } from '$app/environment' ; 15import { base } from '$app/paths' ; 16 17class VersionStore { 18build = $state < string >( '' ); 19frontend = $state < string >( '' ); 20 21/** 22* Fetch the version files. Called by initStores(); order-independent, 23* so it runs in the background. 24*/ 25initialize () :void { 26if ( ! browser ) return ; 27 28if ( import . meta. env . DEV ) { 29this . build = 'dev' ; 30this . frontend = 'dev' ; 31 32return ; 33} 34 35void this . load (); 36} 37 38private async load () :Promise < void > { 39try { 40const res = await fetch ( ` ${ base } /build.json` , { cache :'no-store' }); 41 42if ( res . ok ) { 43const data = await res . json (); 44 45this . build = data . version ?? '' ; 46} 47} catch { 48// build.json missing or unreachable - leave as empty string 49} 50 51try { 52const res = await fetch ( ` ${ base } /_app/version.json` , { cache :'no-store' }); 53 54if ( res . ok ) { 55const data = await res . json (); 56 57this . frontend = data . version ?? '' ; 58} 59} catch { 60// version.json missing or unreachable - leave as empty string 61} 62} 63} 64 65export const versionStore = new VersionStore ();