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:
@@ -0,0 +1,44 @@
|
||||
from gpu_rent.config import parse_enable_swarmui
|
||||
from gpu_rent.tunnel import tunnel_forwards
|
||||
|
||||
|
||||
def test_parse_enable_swarmui_workload(monkeypatch):
|
||||
monkeypatch.delenv("WORKLOAD", raising=False)
|
||||
assert parse_enable_swarmui(None) is True
|
||||
assert parse_enable_swarmui("false") is False
|
||||
monkeypatch.setenv("WORKLOAD", "llm")
|
||||
assert parse_enable_swarmui("true") is False
|
||||
monkeypatch.setenv("WORKLOAD", "both")
|
||||
assert parse_enable_swarmui("false") is True
|
||||
|
||||
|
||||
def test_tunnel_forwards_llm_only(monkeypatch):
|
||||
class Cfg:
|
||||
swarmui_local_port = 17801
|
||||
llm_runtime = "llamacpp"
|
||||
enable_swarmui = False
|
||||
ollama_local_port = 17811
|
||||
llamacpp_local_port = 17812
|
||||
|
||||
monkeypatch.setattr("gpu_rent.tunnel.load_state", lambda: type("S", (), {"notes": {}})())
|
||||
assert tunnel_forwards(Cfg()) == [(17812, 8080)]
|
||||
|
||||
|
||||
def test_access_links_llm_only(monkeypatch):
|
||||
from gpu_rent.access_card import collect_access_links, mcp_snippet_lines
|
||||
|
||||
class Cfg:
|
||||
swarmui_local_port = 17801
|
||||
llm_runtime = "llamacpp"
|
||||
enable_swarmui = False
|
||||
ollama_local_port = 17811
|
||||
llamacpp_local_port = 17812
|
||||
|
||||
monkeypatch.setattr(
|
||||
"gpu_rent.access_card.load_state",
|
||||
lambda: type("S", (), {"notes": {}})(),
|
||||
)
|
||||
labels = [x.label for x in collect_access_links(Cfg(), tunneled=True)]
|
||||
assert "SwarmUI UI" not in labels
|
||||
assert "llama.cpp" in labels
|
||||
assert mcp_snippet_lines(Cfg())[0].startswith("#")
|
||||
Reference in New Issue
Block a user