feat(ui): NPU package download API + npu://download events (T3.4)

This commit is contained in:
iamdoubz committed 2026-07-02 17:16:44 -05:00
1 parent 2b435f3629
commit b23b00490a
1 file changed
+13
+13
View File
@@ -37,6 +37,8 @@ export interface HardwareStatus {
active: BackendId;
modelSize: string;
estRtf: number;
/** NPU package state (T3.4): chip detected, runtime staged, model fetched. */
npu?: { present: boolean; runtimeReady: boolean; modelInstalled: boolean };
}
export interface LlmStatus {
@@ -298,6 +300,7 @@ export const api = {
hardwareStatus: () => invoke<HardwareStatus>("hardware_status"),
setPreferredBackend: (backend: BackendId | "auto") =>
invoke<void>("set_preferred_backend", { args: { backend } }),
downloadNpuPackage: () => invoke<void>("download_npu_package"),
listModels: () => invoke<ModelInfo[]>("list_models"),
downloadModel: (id: string, kind: "whisper" = "whisper") =>
invoke<void>("download_model", { args: { kind, id } }),
@@ -440,6 +443,16 @@ export const events = {
onHardwareChanged: (
cb: (p: { active: BackendId; reason: string }) => void,
): Promise<UnlistenFn> => listen("hardware://changed", (e) => cb(e.payload as never)),
onNpuDownload: (
cb: (p: {
stage: "model" | "runtime" | "done";
file?: number;
received?: number;
total?: number | null;
copied?: number;
ready?: boolean;
}) => void,
): Promise<UnlistenFn> => listen("npu://download", (e) => cb(e.payload as never)),
onSyncJob: (
cb: (p: {
jobId: string;