MCPcopy Create free account
hub / github.com/Datakitpage/Datakit / startDownload

Method startDownload

frontend/src/lib/ai/modelManager.ts:195–219  ·  view source on GitHub ↗
(model: LocalModel)

Source from the content-addressed store, hash-verified

193
194 // Start download process (to be called by WebLLM provider)
195 async startDownload(model: LocalModel): Promise<void> {
196 const canDownload = await this.canDownloadModel(model.size);
197
198 if (!canDownload.canDownload) {
199 this.emitProgress({
200 modelId: model.id,
201 progress: 0,
202 stage: 'error',
203 message: canDownload.reason || 'Cannot download model',
204 error: canDownload.reason,
205 });
206 throw new Error(canDownload.reason);
207 }
208
209 // Emit initial progress
210 this.emitProgress({
211 modelId: model.id,
212 progress: 0,
213 stage: 'downloading',
214 message: 'Starting download...',
215 });
216
217 // The actual download will be handled by WebLLM provider
218 // This just tracks the state
219 }
220
221 // Handle download completion
222 handleDownloadComplete(model: LocalModel): void {

Callers 1

handleDownloadModelFunction · 0.80

Calls 2

canDownloadModelMethod · 0.95
emitProgressMethod · 0.95

Tested by

no test coverage detected