Rust comments that named scripts/offline/*, gen_goldens.py, oracle/gen_*.{sh,cpp,py}, build_oracle.sh and similar retired generators now say where the data
came from (the Original's code, Strata 41cf05a0) or drop the sentence. The path/generator text of seven generated fixtures (sampler_oracle.json, sampling_keys.json,
memory_plan_golden.json, rope_golden.json, cvec_oracle.json, stra161 fixtures.json, commentary-tool-prompt.json) is reworded; no test reads those fields and no pin
covers their bytes. cmd_time/doc.rs: the two path texts in the format string; its lines are re-broken so they stay within 120 columns (the string is unchanged
otherwise). Comment-only except those data/string spots; no behaviour change.
43 lines
1.4 KiB
Rust
43 lines
1.4 KiB
Rust
//! The operational HTTP surface of the Original's Python server (`Strata 41cf05a0, serve/server.py`)
|
|
//! that is not an inference API: `GET /props`, `GET /slots`, `GET /v1/status`, `GET /api/health`,
|
|
//! `GET|POST /settings`, `POST /load`, `POST /unload`, `POST /v1/load`, `POST /v1/unload`, CORS and
|
|
//! the own-page guard. Behaviour is checked against the real Python handlers in
|
|
//! `tests/http_surface.rs` (fixtures recorded from the Original's Python server).
|
|
//!
|
|
//! One engine at a time: `total_slots` is 1 and `/slots` lists one slot while the engine is loaded.
|
|
|
|
use std::{
|
|
sync::Arc,
|
|
time::{Duration, SystemTime, UNIX_EPOCH},
|
|
};
|
|
|
|
use axum::{
|
|
Json,
|
|
body::Bytes,
|
|
extract::{RawQuery, Request, State},
|
|
http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode, header},
|
|
middleware::Next,
|
|
response::{IntoResponse, Response},
|
|
};
|
|
use leleka_serving_policy::{
|
|
cors::{Cors, own_page},
|
|
idle::Outcome,
|
|
};
|
|
use serde_json::{Value, json};
|
|
use tokio::sync::{mpsc, oneshot};
|
|
|
|
use crate::{
|
|
app::AppState,
|
|
worker::{Control, LoadError, WorkerState, WorkerStatus},
|
|
};
|
|
|
|
/// The chat template the Original serves in `/props` when the model ships none.
|
|
pub const DEFAULT_CHAT_TEMPLATE: &str = include_str!("../../third_party/strata/serve/chat_template.jinja");
|
|
|
|
mod engine_lifecycle;
|
|
pub use engine_lifecycle::*;
|
|
mod status_routes;
|
|
pub use status_routes::*;
|
|
mod model_control_routes;
|
|
pub use model_control_routes::*;
|