feat(model-manager): base-model multi-select filter on CivitAI browse
Add a checkbox dropdown to filter the CivitAI catalog by one or more base models (SD 1.5, SDXL, Pony, Illustrious, Flux, etc.), mapped to the API's `baseModels` array param. Backend search accepts comma-separated base_models; button shows the selected count with a Clear action. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -189,7 +189,8 @@ async def start_download(body: DownloadIn) -> dict:
|
||||
@app.get("/api/civitai/search")
|
||||
async def civitai_search(
|
||||
query: Optional[str] = None,
|
||||
types: Optional[str] = None, # comma-separated CivitAI types
|
||||
types: Optional[str] = None, # comma-separated CivitAI types
|
||||
base_models: Optional[str] = None, # comma-separated CivitAI base models
|
||||
sort: Optional[str] = "Most Downloaded",
|
||||
period: Optional[str] = "AllTime",
|
||||
nsfw: bool = False,
|
||||
@@ -199,10 +200,11 @@ async def civitai_search(
|
||||
if not db.get_setting("civitai_api_key"):
|
||||
raise HTTPException(400, "Set your CivitAI API key in Settings first.")
|
||||
type_list = [t for t in (types or "").split(",") if t] or None
|
||||
base_model_list = [b for b in (base_models or "").split(",") if b] or None
|
||||
try:
|
||||
return await registries.civitai_search(
|
||||
query=query, types=type_list, sort=sort, period=period,
|
||||
nsfw=nsfw, page=page, cursor=cursor)
|
||||
query=query, types=type_list, base_models=base_model_list,
|
||||
sort=sort, period=period, nsfw=nsfw, page=page, cursor=cursor)
|
||||
except Exception as exc: # noqa: BLE001 - surface API errors to the UI
|
||||
raise HTTPException(502, f"CivitAI search failed: {exc}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user