Aller au contenu principal

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 OK with the list of backends now active.
  • 503 Service Unavailable when llm_backend_repo is None (the runtime was started without system.db, typically a unit test).
  • 500 Internal Server Error when the repository is reachable but building the router fails (invalid config_json, model file missing for a local backend, etc.).

Responses​

Router reloaded with the live backend list