Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1import { PersistedState, watch } from "runed";2import { isBrowser, noopStorage } from "./utils.js";3import { modeStorageKey } from "./storage-keys.svelte.js";4import { isValidMode } from "./modes.js";5import { MediaQuery } from "svelte/reactivity";6export class UserPrefersMode {7 #defaultValue = "system";8 #storage = isBrowser ? localStorage : noopStorage;9 #initialValue = this.#storage.getItem(modeStorageKey.current);10 #value = isValidMode(this.#initialValue) ? this.#initialValue : this.#defaultValue;11 #persisted = $state(this.#makePersisted());12 #makePersisted(value = this.#value) {13 return new PersistedState(modeStorageKey.current, value, {14 serializer: {15 serialize: (v) => v,16 deserialize: (v) => {17 if (isValidMode(v))18 return v;19 return this.#defaultValue;20 },21 },22 });23 }24 constructor() {25 $effect.root(() => {26 return watch.pre(() => modeStorageKey.current, (_, prevStorageKey) => {27 const currModeValue = this.#persisted.current;28 this.#persisted = this.#makePersisted(currModeValue);29 if (prevStorageKey) {30 localStorage.removeItem(prevStorageKey);31 }32 });33 });34 }35 get current() {36 return this.#persisted.current;37 }38 set current(newValue) {39 this.#persisted.current = newValue;40 }41}42export class SystemPrefersMode {43 #defaultValue = undefined;44 #track = true;45 #current = $state(this.#defaultValue);46 #mediaQueryState = typeof window !== "undefined" && typeof window.matchMedia === "function"47 ? new MediaQuery("prefers-color-scheme: light")48 : { current: false };49 query() {50 if (!isBrowser)51 return;52 this.#current = this.#mediaQueryState.current ? "light" : "dark";53 }54 tracking(active) {55 this.#track = active;56 }57 constructor() {58 $effect.root(() => {59 $effect.pre(() => {60 if (!this.#track)61 return;62 this.query();63 });64 });65 this.query = this.query.bind(this);66 this.tracking = this.tracking.bind(this);67 }68 get current() {69 return this.#current;70 }71}72/**73 * Writable state that represents the user's preferred mode74 * (`"dark"`, `"light"` or `"system"`)75 */76export const userPrefersMode = new UserPrefersMode();77/**78 * Readable store that represents the system's preferred mode (`"dark"`, `"light"` or `undefined`)79 */80export const systemPrefersMode = new SystemPrefersMode();81 