Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/local_llm_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class ModelActivateRequest(BaseModel):
mlx_vlm_server_port: Optional[int] = Field(None, description="Internal mlx_vlm.server subprocess port.")
mmproj_path: Optional[str] = Field(None, description="Path to multimodal projector GGUF.")
startup_timeout: Optional[int] = Field(None, description="Backend subprocess startup timeout in seconds.")
no_download: Optional[bool] = Field(None, description="Fail closed if required model files are not installed locally.")
max_concurrent_requests: Optional[int] = Field(None, ge=1, description="Maximum admitted requests for this runtime.")
enable_thinking: Optional[bool] = Field(None, description="Enable thinking mode globally.")
show_thinking: Optional[bool] = Field(None, description="Show thinking globally.")
Expand Down Expand Up @@ -1074,7 +1075,7 @@ def _load_or_activate_model(
"timeout", "offload_kqv", "flash_attn", "use_mmap", "enable_thinking",
"show_thinking", "verbose", "llama_server_port", "llama_server_bin",
"mlx_vlm_server_port", "mmproj_path", "startup_timeout",
"max_concurrent_requests",
"max_concurrent_requests", "no_download",
]:
value = getattr(req, field_name)
if value is not None:
Expand Down
32 changes: 32 additions & 0 deletions tests/test_server_multimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,35 @@ def set_default(self, key):
)
assert payload["cfg"]["quantization"] == "PTQ1_0"
assert "/private/models" not in str(payload["runtime_identity"])

def test_admin_load_propagates_no_download_to_prevent_implicit_weights_download():
"""Playground can activate an installed image model without network access."""
engine = _Engine("image")
runtime = SimpleNamespace(
key="flux-3-image-klein-gguf-q5km",
model_id="unsloth/flux-3-image-klein-GGUF",
engine=engine,
cfg={
"model": "flux-3-image-klein-gguf-q5km",
"model_id": "unsloth/flux-3-image-klein-GGUF",
"model_path": "/tmp/bundle",
"backend": "stable_diffusion_cpp_image",
},
runtime_identity_snapshot=None,
)
class _Manager:
default_model = None
def load(self, model, **explicit):
assert model == runtime.key
assert explicit == {"no_download": True}
return runtime, True
def set_default(self, key):
self.default_model = key
state = SimpleNamespace(runtime_manager=_Manager(), cfg=None, llm=None)
result = _load_or_activate_model(
ModelActivateRequest(model=runtime.key, no_download=True),
set_default=False,
app_state=state,
)
assert result["default"] is False
assert result["cfg"]["backend"] == "stable_diffusion_cpp_image"
Loading