C++ backend for downloading and managing AI models. More...
| Import Statement: | import Clayground.Ai |
AiModelManagerBackend handles model downloads from HuggingFace or custom registries, caching, and platform detection. It is typically used internally by the AiModelManager QML component.
See also AiModelManager.
activeDownloads : list |
List of currently active downloads.
Each item contains: modelId, progress, bytesDownloaded, totalBytes.
hasWebGPU : bool |
Whether WebGPU is available (browser only).
platform : string |
Current platform identifier.
Returns "desktop", "wasm", "ios", or "android".
registryReady : bool |
Whether the model registry has been loaded.
registryUrl : url |
Custom model registry URL.
When set, the manager fetches the model registry from this URL. Leave empty to use the embedded registry.
downloadCancelled(string modelId) |
Emitted when a download is cancelled.
Note: The corresponding handler is onDownloadCancelled.
downloadComplete(string modelId) |
Emitted when a download finishes successfully.
Note: The corresponding handler is onDownloadComplete.
downloadError(string modelId, string message) |
Emitted when a download fails.
Note: The corresponding handler is onDownloadError.
downloadProgress(string modelId, real progress, int bytesDownloaded, int totalBytes) |
Emitted during download with progress (0.0 to 1.0).
Note: The corresponding handler is onDownloadProgress.
downloadStarted(string modelId, int totalBytes) |
Emitted when a download begins.
Note: The corresponding handler is onDownloadStarted.
registryUpdated() |
Emitted when the model registry is refreshed.
Note: The corresponding handler is onRegistryUpdated.
list availableModels(string type) |
Returns model IDs for the given type.
type can be "llm", "stt", "tts", or empty for all models.
list cachedModels() |
Returns list of locally cached model IDs.
void cancelDownload(string modelId) |
Cancel an in-progress download.
bool checkMemory(string modelId) |
Returns true if there is likely enough memory to load the model.
void download(string modelId) |
Start downloading a model.
bool isAvailable(string modelId) |
Returns true if the model is cached locally.
object modelInfo(string modelId) |
Returns information about a model.
Returns an object with: name, type, description, size, platforms, quantization, memoryRequired.
string modelPath(string modelId) |
Returns the local file path for a cached model.
void refreshRegistry() |
Refresh the model registry from registryUrl or embedded source.
void remove(string modelId) |
Remove a model from the local cache.