From 050240b27a0c0cba0f33a1720e14dde8f48a6eb2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 15 Mar 2026 12:16:58 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/llama_cpp.py | 14 +++----------- studio/backend/core/inference/orchestrator.py | 3 +-- studio/backend/routes/models.py | 3 +++ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/studio/backend/core/inference/llama_cpp.py b/studio/backend/core/inference/llama_cpp.py index 9561280bcc..3ed4589dc0 100644 --- a/studio/backend/core/inference/llama_cpp.py +++ b/studio/backend/core/inference/llama_cpp.py @@ -405,9 +405,7 @@ class LlamaCppBackend: files = list_repo_files(hf_repo, token = hf_token) variant_lower = hf_variant.lower() boundary = re.compile( - r"(? 0: @@ -506,11 +502,7 @@ class LlamaCppBackend: logger.info( f"Downloading GGUF: {hf_repo}/{gguf_filename}" - + ( - f" (+{len(gguf_extra_shards)} shards)" - if gguf_extra_shards - else "" - ) + + (f" (+{len(gguf_extra_shards)} shards)" if gguf_extra_shards else "") ) try: if self._cancel_event.is_set(): diff --git a/studio/backend/core/inference/orchestrator.py b/studio/backend/core/inference/orchestrator.py index 6c50f2b753..99c43bbd88 100644 --- a/studio/backend/core/inference/orchestrator.py +++ b/studio/backend/core/inference/orchestrator.py @@ -124,8 +124,7 @@ class InferenceOrchestrator: if resp.status_code == 200: models = resp.json() gguf_ids = [ - m["id"] for m in models - if m.get("id", "").upper().endswith("-GGUF") + m["id"] for m in models if m.get("id", "").upper().endswith("-GGUF") ][:4] if gguf_ids: self._top_gguf_cache = gguf_ids diff --git a/studio/backend/routes/models.py b/studio/backend/routes/models.py index 2b1fb09b79..4258731712 100644 --- a/studio/backend/routes/models.py +++ b/studio/backend/routes/models.py @@ -14,11 +14,14 @@ import structlog from loggers import get_logger import re as _re + _VALID_REPO_ID = _re.compile(r"^[A-Za-z0-9._-]+/[A-Za-z0-9._-]+$") + def _is_valid_repo_id(repo_id: str) -> bool: return bool(_VALID_REPO_ID.fullmatch(repo_id)) + # Add backend directory to path backend_path = Path(__file__).parent.parent.parent if str(backend_path) not in sys.path: