Enhance LLM and SwarmUI integration with improved configuration options
- Updated `env.example` and `gpu-rent.vars.example` to include new variables for LLM runtime and SwarmUI options. - Refactored CLI commands to support interactive selection of LLM runtime and workload type (SwarmUI, LLM, or both). - Improved access link generation to handle cases where SwarmUI is disabled, providing clearer user feedback. - Enhanced provisioning logic to conditionally bootstrap SwarmUI based on user configuration, allowing for LLM-only setups. - Updated documentation across multiple files to reflect changes in LLM integration, CLI usage, and configuration management.
This commit is contained in:
@@ -31,6 +31,20 @@ def _as_bool(value: str | None, default: bool) -> bool:
|
||||
return value.strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
def parse_enable_swarmui(raw: str | None, *, default: bool = True) -> bool:
|
||||
"""ENABLE_SWARMUI / WORKLOAD=llm|swarm|both → whether to install SwarmUI."""
|
||||
wl = (os.environ.get("WORKLOAD") or "").strip().lower()
|
||||
if wl in {"llm", "llm-only", "llm_only", "llama", "ollama-only"}:
|
||||
return False
|
||||
if wl in {"swarm", "swarmui", "ui"}:
|
||||
return True
|
||||
if wl in {"both", "all", "full"}:
|
||||
return True
|
||||
if raw is None or str(raw).strip() == "":
|
||||
return default
|
||||
return _as_bool(str(raw), default)
|
||||
|
||||
|
||||
def _as_int(value: str | None, default: int) -> int:
|
||||
if value is None or value.strip() == "":
|
||||
return default
|
||||
@@ -84,6 +98,7 @@ class Config:
|
||||
update_git: bool
|
||||
|
||||
llm_runtime: str
|
||||
enable_swarmui: bool
|
||||
ollama_models_manifest: Path
|
||||
llamacpp_models_manifest: Path
|
||||
ollama_local_port: int
|
||||
@@ -169,6 +184,8 @@ def load_config(*, require_auth: bool = True) -> Config:
|
||||
except ValueError:
|
||||
llm_runtime = "none"
|
||||
|
||||
enable_swarmui = parse_enable_swarmui(os.environ.get("ENABLE_SWARMUI"), default=True)
|
||||
|
||||
def _dir(env_name: str, folder: str) -> Path:
|
||||
raw = (os.environ.get(env_name) or "").strip()
|
||||
return Path(raw).expanduser() if raw else (root / folder)
|
||||
@@ -210,6 +227,7 @@ def load_config(*, require_auth: bool = True) -> Config:
|
||||
swarmui_image=(os.environ.get("SWARMUI_IMAGE") or "").strip(),
|
||||
update_git=_as_bool(os.environ.get("UPDATE_GIT"), True),
|
||||
llm_runtime=llm_runtime,
|
||||
enable_swarmui=enable_swarmui,
|
||||
ollama_models_manifest=ollama_manifest,
|
||||
llamacpp_models_manifest=llamacpp_manifest,
|
||||
ollama_local_port=_as_int(os.environ.get("OLLAMA_LOCAL_PORT"), 17811),
|
||||
|
||||
Reference in New Issue
Block a user