everything-webgpu / types /engine /sources.d.ts
nyaaorick's picture
feat: publish everything-webgpu package, engine source and documentation
1944112 verified
Raw History Blame Contribute Delete
1.46 kB
/**
* 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";