mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
@@ -1,5 +1,5 @@
|
||||
from fastapi.exceptions import HTTPException
|
||||
from fastapi.responses import JSONResponse, Response
|
||||
from fastapi.responses import Response
|
||||
from modules import shared
|
||||
from modules.logger import log
|
||||
from modules.api import models, helpers
|
||||
@@ -92,7 +92,7 @@ def get_embeddings():
|
||||
def get_wildcards():
|
||||
"""List wildcard basenames (relative path with `.txt` stripped) from the configured wildcards directory."""
|
||||
from modules import ui_extra_networks_wildcards
|
||||
return [models.ItemWildcard(name=n) for n in ui_extra_networks_wildcards.list_wildcard_names()]
|
||||
return [{"name": n} for n in ui_extra_networks_wildcards.list_wildcard_names()]
|
||||
|
||||
def get_extra_networks(page: str | None = None, name: str | None = None, filename: str | None = None, title: str | None = None, fullname: str | None = None, hash: str | None = None): # pylint: disable=redefined-builtin
|
||||
"""List extra networks (LoRA, checkpoints, embeddings, etc.) with optional filtering by page, name, filename, title, fullname, or hash."""
|
||||
|
||||
@@ -10,11 +10,9 @@ from PIL import Image
|
||||
from modules import shared, images, files_cache, modelstats
|
||||
from modules.logger import log
|
||||
from modules.paths import resolve_output_path
|
||||
from modules.api import models
|
||||
|
||||
|
||||
debug = log.debug if os.environ.get('SD_BROWSER_DEBUG', None) is not None else lambda *args, **kwargs: None
|
||||
|
||||
|
||||
OPTS_FOLDERS = [
|
||||
"outdir_samples",
|
||||
"outdir_txt2img_samples",
|
||||
@@ -140,13 +138,13 @@ def register_api(api): # register api
|
||||
log.error(f'Gallery image failed: file="{filepath}" | Error: {e}')
|
||||
return {}
|
||||
|
||||
# @app.get('/sdapi/v1/browser/folders', response_model=list[models.ItemFolder])
|
||||
# @app.get('/sdapi/v1/browser/folders', response_model=list[dict])
|
||||
def get_folders():
|
||||
def make_folder(path, label=None):
|
||||
"""Create folder entry with path and display label."""
|
||||
if label is None:
|
||||
label = os.path.basename(path) or path
|
||||
return models.ItemFolder(path=path, label=label)
|
||||
return {"path": path, "label": label}
|
||||
|
||||
reference_dir = os.path.join('models', 'Reference')
|
||||
base_samples = shared.opts.outdir_samples
|
||||
|
||||
@@ -262,13 +262,6 @@ class ItemExtension(BaseModel):
|
||||
commit_date: str | int = Field(title="Commit Date", description="Extension Repository Commit Date")
|
||||
enabled: bool = Field(title="Enabled", description="Flag specifying whether this extension is enabled")
|
||||
|
||||
class ItemFolder(BaseModel):
|
||||
path: str = Field(title="Path", description="Full path to the folder")
|
||||
label: str = Field(title="Label", description="Display label for the folder")
|
||||
|
||||
class ItemWildcard(BaseModel):
|
||||
name: str = Field(title="Name", description="Wildcard basename (relative path with .txt stripped)")
|
||||
|
||||
class ItemScheduler(BaseModel):
|
||||
name: str = Field(title="Name", description="Scheduler name")
|
||||
cls: str = Field(title="Class", description="Scheduler class name")
|
||||
|
||||
Reference in New Issue
Block a user