server: a control_vector request field, its admin switch and the Model-view panel

The field is per request, with the deployment's runtime default when absent, and a deployment with
no vector refuses 'true' by name rather than serving the stock model. Strata's
`experimental_speed_projection` is accepted as an alias.

The dashboard's Model view carries a "Control vectors" panel with the switch for that default;
GET/POST /admin/control-vector is its endpoint, behind the API key like every other route. The state
is in /stats and /server_info. Nothing here reloads the model: the directions are uploaded once and
each step carries a per-request mask.

The panel stays visible when the page has no API key, with the reason, instead of disappearing --
a control that vanishes because the page has not signed in reads exactly like a build without the
feature.
This commit is contained in:
C_Tamas authored and StillDeadcode committed 2026-10-21 09:26:17 +02:00
1 parent 66c6d71254
commit 6f26cdb5f4
7 files changed
+312 -3

No files matched your search

+17
View File
@@ -48,6 +48,19 @@ struct Deps {
* (liveview.h), so the terminal and the web page agree. Absent, the dashboard shows only the
* scheduler's metrics and omits the cards. */
LiveView::Source live;
/* The control vector (core/cvec.h), as the server sees it: whether the engine found one for
* this container, the runtime default for requests that name no choice, and the switch the
* admin endpoint flips. Absent (the function members null) means the feature does not exist on
* this deployment: a request that asks for it is refused by name, and the dashboard shows no
* control. Nothing here reloads the model. */
struct ControlVectorSwitch {
std::function<bool()> available;
std::function<bool()> get_default;
std::function<void(bool)> set_default;
std::function<std::string()> json;
};
ControlVectorSwitch control_vector;
};
struct ServerOptions {
@@ -312,6 +325,10 @@ private:
HttpResponse handle_stats(const HttpRequest& req);
HttpResponse handle_graph(const HttpRequest& req);
HttpResponse handle_sessions(const HttpRequest& req);
/* The control vector's runtime switch (dashboard.cpp): GET reports the state, POST
* {"enabled": bool} sets the default for requests that name no choice. Guarded by the API key
* like every other route but the health probes and the page. */
HttpResponse handle_control_vector(const HttpRequest& req);
HttpResponse error_response(const ApiError& e, const std::string& peer,
ApiShape shape = ApiShape::OpenAI);