Files
odysseus/tests/test_setup_llamacpp_hint_js.py
T
Joel Alejandro Escareño Fernández e0ccf250a4 feat(discovery): detect llama.cpp servers and label local providers (#4729)
* feat(discovery): detect llama.cpp servers and label local providers

Scan port 8080 (llama-server) and 11435 (APFEL) during discovery, fingerprint
llama.cpp via its native /props endpoint, and label well-known local serving
ports (8080 llama.cpp, 8000 vLLM, 1234 LM Studio, 11434 Ollama) consistently
in both the Python provider helper and the JS endpoint UI. Adds a llama.cpp
hint to the /setup slash command.

* fix(discovery): don't infer the serving tool from the port alone

Per review: vLLM, SGLang, llama.cpp and plain OpenAI-compatible servers all
share 8000/8080, so labeling by port mislabels real setups (a vLLM box on 8080
shown as llama.cpp). Drop the port->tool assertions from _provider_label and
providerLabel; the authoritative signal is the /props fingerprint done during
discovery, which is unchanged. Loopback now reads a neutral 'local endpoint' /
'Local'. Tests updated to assert the neutral labels.
2026-06-23 23:39:56 +02:00

18 lines
770 B
Python

"""The /setup guide must offer a llama.cpp (llama-server) local example.
Without it, the port-8080 "llama.cpp" provider label (src/llm_core.py
_provider_label) is never reachable from first-run setup — a user pasting a
local endpoint only saw the Ollama and generic examples. Both the static-HTML
and the streamed-blocks renderings of the setup guide must carry the example.
"""
from pathlib import Path
_SRC = Path(__file__).resolve().parent.parent / "static" / "js" / "slashCommands.js"
def test_setup_guide_offers_llamacpp_local_example():
src = _SRC.read_text(encoding="utf-8")
# The example URL appears in both the HTML-string and streamed renderings.
assert src.count("http://localhost:8080/v1") >= 2
assert "llama.cpp (llama-server)" in src