everything-webgpu / types /engine /ingest.d.ts
nyaaorick's picture
feat: publish everything-webgpu package, engine source and documentation
1944112 verified
Raw History Blame Contribute Delete
1.99 kB
/**
* Walk a DataTransfer from a drop event into flat `{ path, file }` entries.
* Uses the entries API so dropping a *folder* works, not just a file selection.
*/
export function filesFromDataTransfer(dataTransfer: any): Promise<any[]>;
/**
* Turns `<input webkitdirectory>` output into the same `{ path, file }` shape.
*
* `Array.from`, not spread: a real `FileList` is iterable, but plenty of things
* that behave like one are only array-like, and spreading those fails with
* "fileList is not iterable" — an error that names none of the three places it
* could have come from. Array.from accepts both.
*/
export function filesFromInput(fileList: any): {
path: any;
file: any;
}[];
/**
* @param {Array<{path: string, file: File}>} entries
* @param {object} opts
* @param {import("./model-store.js").ModelStore} opts.store where the registry entry lands
* @param {string} [opts.modelId] overrides the id inferred from the folder name
* @param {"llm"|"embedding"|"vlm"} [opts.modelType] declare a vision model, or WebLLM
* rejects every image sent to it
* @param {(p: {phase: string, done: number, total: number, label: string}) => void} [opts.onProgress]
* @returns {Promise<object>} the saved registry record
*/
export function ingestModelFolder(entries: Array<{
path: string;
file: File;
}>, { store, modelId, modelType, onProgress }?: {
store: import("./model-store.js").ModelStore;
modelId?: string;
modelType?: "llm" | "embedding" | "vlm";
onProgress?: (p: {
phase: string;
done: number;
total: number;
label: string;
}) => void;
}): Promise<object>;
/** WebLLM asks for this name; older MLC exports ship `ndarray-cache.json`. */
export const TENSOR_MANIFEST: "tensor-cache.json";
export const LEGACY_TENSOR_MANIFEST: "ndarray-cache.json";
export const CHAT_CONFIG: "mlc-chat-config.json";
export namespace CONTENT_TYPES {
let json: string;
let wasm: string;
let bin: string;
}