(model: LocalModel)
| 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 { |
no test coverage detected