File size: 1,259 Bytes
1944112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 * WebLLM's `cleanModelUrl`, mirrored deliberately.
 *
 * Kept character-for-character with the bundle's version (see the contract
 * test) because the whole point is to produce the same cache keys its loader
 * will look for.
 */
export function resolveModelUrl(modelUrl: any): string;
/**
 * @param {object} opts
 * @param {string} opts.modelId
 * @param {object} opts.record the merged app-config entry: `model`, `model_lib`
 * @param {(p: {phase: string, done: number, total: number, label: string}) => void} [opts.onProgress]
 * @param {AbortSignal} [opts.signal]
 * @param {(url: string, init?: object) => Promise<Response>} [opts.fetchImpl]
 * @returns {Promise<{modelId: string, files: number, bytes: number, alreadyCached: boolean}>}
 */
export function prefetchModel({ modelId, record, onProgress, signal, fetchImpl, }: {
    modelId: string;
    record: object;
    onProgress?: (p: {
        phase: string;
        done: number;
        total: number;
        label: string;
    }) => void;
    signal?: AbortSignal;
    fetchImpl?: (url: string, init?: object) => Promise<Response>;
}): Promise<{
    modelId: string;
    files: number;
    bytes: number;
    alreadyCached: boolean;
}>;
export function isAlreadyLocal(record: any): boolean;