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
1/** @import { SSRContext } from '#server' */2import { DEV } from 'esm-env';3import * as e from './errors.js';4 5/** @type {SSRContext | null} */6export var ssr_context = null;7 8/** @param {SSRContext | null} v */9export function set_ssr_context(v) {10 ssr_context = v;11}12 13/**14 * @template T15 * @returns {[() => T, (context: T) => T]}16 * @since 5.40.017 */18export function createContext() {19 const key = {};20 21 return [22 () => {23 if (!hasContext(key)) {24 e.missing_context();25 }26 27 return getContext(key);28 },29 (context) => setContext(key, context)30 ];31}32 33/**34 * @template T35 * @param {any} key36 * @returns {T}37 */38export function getContext(key) {39 const context_map = get_or_init_context_map('getContext');40 const result = /** @type {T} */ (context_map.get(key));41 42 return result;43}44 45/**46 * @template T47 * @param {any} key48 * @param {T} context49 * @returns {T}50 */51export function setContext(key, context) {52 get_or_init_context_map('setContext').set(key, context);53 return context;54}55 56/**57 * @param {any} key58 * @returns {boolean}59 */60export function hasContext(key) {61 return get_or_init_context_map('hasContext').has(key);62}63 64/** @returns {Map<any, any>} */65export function getAllContexts() {66 return get_or_init_context_map('getAllContexts');67}68 69/**70 * @param {string} name71 * @returns {Map<unknown, unknown>}72 */73function get_or_init_context_map(name) {74 if (ssr_context === null) {75 e.lifecycle_outside_component(name);76 }77 78 return (ssr_context.c ??= new Map(get_parent_context(ssr_context) || undefined));79}80 81/**82 * @param {Function} [fn]83 */84export function push(fn) {85 ssr_context = { p: ssr_context, c: null, r: null };86 87 if (DEV) {88 ssr_context.function = fn;89 ssr_context.element = ssr_context.p?.element;90 }91}92 93export function pop() {94 ssr_context = /** @type {SSRContext} */ (ssr_context).p;95}96 97/**98 * @param {SSRContext} ssr_context99 * @returns {Map<unknown, unknown> | null}100 */101function get_parent_context(ssr_context) {102 let parent = ssr_context.p;103 104 while (parent !== null) {105 const context_map = parent.c;106 if (context_map !== null) {107 return context_map;108 }109 parent = parent.p;110 }111 112 return null;113}114 115/**116 * Wraps an `await` expression in such a way that the component context that was117 * active before the expression evaluated can be reapplied afterwards —118 * `await a + b()` becomes `(await $.save(a))() + b()`, meaning `b()` will have access119 * to the context of its component.120 * @template T121 * @param {Promise<T>} promise122 * @returns {Promise<() => T>}123 */124export async function save(promise) {125 var previous_context = ssr_context;126 var value = await promise;127 128 return () => {129 ssr_context = previous_context;130 return value;131 };132}133 