fix(local-models): point _assign_default's late-bound model assignment at web_server_config
The whole-codebase refactor moved _apply_model_assignment_sync from the web_server facade into web_server_config, but _assign_default in web_routers/local_models.py still resolved it through the default late() module (web_server), which no longer carries the symbol. A local-model quickstart therefore failed its final 'making it your default' step with AttributeError: module 'hermes_cli.web_server' has no attribute '_apply_model_assignment_sync'. Pass the defining module explicitly to web_deps.late() so the call resolves against hermes_cli.web_server_config, matching how the sibling models.py router imports the same helper. Update the two quickstart test stubs to accept the module argument the real late(name, module=...) takes.
This commit is contained in:
@@ -270,7 +270,7 @@ def _ensure_server(job: Dict[str, Any], config: dict, model_id: str, *, fail_det
|
||||
def _assign_default(job: Dict[str, Any], model_id: str) -> None:
|
||||
"""Make ``model_id`` the main model via the same machinery as /api/model/set (late-bound: tests stub web_deps.late)."""
|
||||
_step(job, "setting-default", "Making it your default")
|
||||
web_deps.late("_apply_model_assignment_sync")("main", "llamacpp", model_id, "", "", "")
|
||||
web_deps.late("_apply_model_assignment_sync", "hermes_cli.web_server_config")("main", "llamacpp", model_id, "", "", "")
|
||||
|
||||
|
||||
# ── downloads: ranged parallel streams ───────────────────────
|
||||
|
||||
@@ -84,7 +84,7 @@ def test_quickstart_runs_all_three_legs(client, monkeypatch, tmp_path):
|
||||
|
||||
monkeypatch.setattr(
|
||||
web_deps, "late",
|
||||
lambda name: (lambda *a, **k: calls.append("assign")))
|
||||
lambda name, module="hermes_cli.web_server": (lambda *a, **k: calls.append("assign")))
|
||||
|
||||
r = client.post("/api/local-models/quickstart", json={})
|
||||
assert r.status_code == 200
|
||||
@@ -137,7 +137,7 @@ def test_quickstart_skips_satisfied_legs(client, monkeypatch):
|
||||
|
||||
monkeypatch.setattr(
|
||||
web_deps, "late",
|
||||
lambda name: (lambda *a, **k: calls.append("assign")))
|
||||
lambda name, module="hermes_cli.web_server": (lambda *a, **k: calls.append("assign")))
|
||||
|
||||
r = client.post("/api/local-models/quickstart", json={})
|
||||
assert r.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user