mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
feat(dicts): add remote dict management via HuggingFace
Add endpoints for browsing, downloading, and deleting dicts hosted on
HuggingFace. Manifest is fetched and cached from the remote repo to
show available dicts with download status and version comparison.
- /dicts/remote GET: list available dicts from HF manifest
- /dicts/{name}/download POST: download dict from HF with atomic write
- /dicts/{name} DELETE: remove local copy and evict cache
- ItemDictRemote model with downloaded/update_available flags
- Exclude manifest.json from local dict listing in all scan paths
This commit is contained in:
@@ -522,6 +522,15 @@ class ItemDictContent(BaseModel):
|
||||
categories: dict = Field(default_factory=dict, title="Categories", description="Category definitions with name and color")
|
||||
tags: list = Field(default_factory=list, title="Tags", description="Tag entries as [name, category_id, post_count] tuples")
|
||||
|
||||
class ItemDictRemote(BaseModel):
|
||||
name: str = Field(title="Name", description="Dictionary identifier")
|
||||
description: str = Field(default="", title="Description", description="Human-readable description")
|
||||
version: str = Field(default="", title="Version", description="Version string")
|
||||
tag_count: int = Field(default=0, title="Tag count", description="Number of tags")
|
||||
size_mb: float = Field(default=0, title="Size (MB)", description="Approximate file size in megabytes")
|
||||
downloaded: bool = Field(default=False, title="Downloaded", description="Whether the dict is available locally")
|
||||
update_available: bool = Field(default=False, title="Update available", description="Whether a newer version exists remotely")
|
||||
|
||||
# helper function
|
||||
|
||||
def create_model_from_signature(func: Callable, model_name: str, base_model: type[BaseModel] = BaseModel, additional_fields: list | None = None, exclude_fields: list[str] | None = None) -> type[BaseModel]:
|
||||
|
||||
Reference in New Issue
Block a user