Handler for `POST /api/v1/llm/reload`.
POST/api/v1/llm/reload
Rebuilds the active LlmRouter from system.db and swaps it into the
shared cell exposed by [AppState::llm_router], without restarting the
daemon. The new router becomes visible to every subsequent reader
(ping, chat, complete, status); in-flight requests that already
hold a snapshot of the previous router finish against the old router and
are not interrupted.
The route also forwards the freshly-built router to the
[ChatSessionManager] via its ReloadLlm actor command so live chat
sessions pick up the new model on their next turn.
Returns:
200 OKwith the list of backends now active.503 Service Unavailablewhenllm_backend_repoisNone(the runtime was started withoutsystem.db, typically a unit test).500 Internal Server Errorwhen the repository is reachable but building the router fails (invalid config_json, model file missing for a local backend, etc.).
Responses
- 200
- 500
- 503
Router reloaded with the live backend list
Router rebuild failed
Backend repository unavailable or no default backend