//! The operational HTTP surface of the Original's Python server (`engine/strata/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 from `tests/golden/gen_goldens.py http`). //! //! 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!("../../engine/strata/serve/chat_template.jinja"); mod error_body; #[allow(unused_imports)] pub use error_body::*; mod slots; #[allow(unused_imports)] pub use slots::*; mod model_busy; #[allow(unused_imports)] pub use model_busy::*;