File size: 1,464 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 37 38 39 40 41 42 43 | /**
* The local label for a model loaded from a URL.
*
* Safe to derive, unlike `modelLib`: an id is a key in our own registry, never
* a path anything fetches, so a wrong guess is visible immediately and costs
* nothing. `.../mlc-ai/Foo-MLC` and `.../models/foo/` both give the last real
* segment.
*/
export function idFromUrl(url: any): string;
/**
* @param {string | object} src
* @param {{id?: string, modelLib?: string}} [opts]
* @returns {{kind: SourceKind, modelId?: string, model?: string, modelLib?: string, files?: unknown}}
*/
export function classifySource(src: string | object, opts?: {
id?: string;
modelLib?: string;
}): {
kind: SourceKind;
modelId?: string;
model?: string;
modelLib?: string;
files?: unknown;
};
/**
* Ids close enough to be a typo, so an unknown id can say "did you mean".
*
* Cheap on purpose — case-insensitive substring both ways, then a bounded edit
* distance. The list is at most a few hundred entries and this runs once, on a
* path that is already about to throw.
*/
export function nearMatches(wanted: any, available: any, limit?: number): any;
export namespace SOURCE_KIND {
let ID: string;
let REMOTE: string;
let REGISTER: string;
let FILES: string;
}
export function looksLikeUrl(s: any): any;
export function isDataTransfer(v: any): boolean;
export function isFileList(v: any): boolean;
export type SourceKind = "id" | "remote" | "register" | "files";
|