Studio: hide single-file image checkpoints from the chat model picker

The chat picker treats a cached repo as an image model, and hides it, only
when it ships a diffusers model_index.json. Single-file, ComfyUI, and
ControlNet image checkpoints (an FP8 Qwen-Image, a z-image safetensors, a
Qwen-Image ControlNet) carry none, so they surfaced as loadable chat models.
Fall back to resolving the repo id against the known diffusion families, the
same resolver the Images backend loads from, so these checkpoints are tagged
text-to-image and stay in the Images picker only.
This commit is contained in:
Daniel Han 2026-07-01 09:29:51 +00:00
commit c846c9896a

View file

@ -3185,9 +3185,15 @@ async def list_cached_gguf(current_subject: str = Depends(get_current_subject)):
def _repo_is_diffusers(repo_info) -> bool:
"""A diffusers pipeline repo (e.g. a Z-Image / FLUX base) carries a top-level
model_index.json. These render images rather than chat, so the chat picker
hides them mirroring how cached diffusion GGUFs are classified by arch."""
"""True for an image-diffusion repo, so the chat picker hides it (it renders
images, not chat) and the Images picker claims it mirroring how cached
diffusion GGUFs are classified by arch.
Two signals: a full diffusers pipeline carries a top-level model_index.json,
while single-file / ComfyUI / ControlNet image checkpoints (e.g. an FP8
Qwen-Image or a z-image .safetensors) ship none. For those, fall back to the
repo id resolving to a known diffusion family the same resolver the Images
backend loads from so they don't surface as loadable chat models."""
try:
for rev in repo_info.revisions:
for f in rev.files:
@ -3195,6 +3201,13 @@ def _repo_is_diffusers(repo_info) -> bool:
return True
except Exception:
pass
try:
from core.inference.diffusion_families import detect_family
if detect_family(getattr(repo_info, "repo_id", "") or "") is not None:
return True
except Exception:
pass
return False