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:
Leonid Pershin
2026-08-21 06:44:50 +03:00
parent f93ac5a66a
commit 7ed6a99df2
25 changed files with 455 additions and 177 deletions
+21 -9
View File
@@ -40,17 +40,19 @@ def resolve_llm_runtime(cfg: Config) -> str:
def collect_access_links(cfg: Config, *, tunneled: bool) -> list[AccessLink]:
"""Build the list of user-facing endpoints (unit-tested)."""
port = cfg.swarmui_local_port
base = f"http://127.0.0.1:{port}"
links: list[AccessLink] = []
swarm = bool(getattr(cfg, "enable_swarmui", True))
if tunneled:
links.extend(
[
AccessLink("SwarmUI UI", base, "браузер"),
AccessLink("SwarmUI API", f"{base}/API/", "HTTP JSON"),
AccessLink("SwarmUI MCP", f"{base}/mcp", "Cursor mcp.json"),
]
)
if swarm:
port = cfg.swarmui_local_port
base = f"http://127.0.0.1:{port}"
links.extend(
[
AccessLink("SwarmUI UI", base, "браузер"),
AccessLink("SwarmUI API", f"{base}/API/", "HTTP JSON"),
AccessLink("SwarmUI MCP", f"{base}/mcp", "Cursor mcp.json"),
]
)
runtime = resolve_llm_runtime(cfg)
if runtime == "ollama":
o = cfg.ollama_local_port
@@ -82,6 +84,14 @@ def collect_access_links(cfg: Config, *, tunneled: bool) -> list[AccessLink]:
AccessLink("Models", f"http://127.0.0.1:{p}/v1/models", "list"),
]
)
if not links:
links.append(
AccessLink(
"Туннель",
"gpu-rent tunnel",
"нет сервисов — ENABLE_SWARMUI / LLM_RUNTIME",
)
)
else:
links.append(
AccessLink(
@@ -94,6 +104,8 @@ def collect_access_links(cfg: Config, *, tunneled: bool) -> list[AccessLink]:
def mcp_snippet_lines(cfg: Config) -> list[str]:
if not bool(getattr(cfg, "enable_swarmui", True)):
return ["# SwarmUI MCP skip (llm-only)"]
port = cfg.swarmui_local_port
return [
"{",