feat: add unload endpoint
CI / Rust CI (push) Successful in 1m24s

This commit is contained in:
2026-04-10 12:48:14 +02:00
parent 7e430bcf00
commit 686f9ff747
4 changed files with 194 additions and 0 deletions
+11
View File
@@ -36,6 +36,17 @@ pub async fn load_model(
}
}
pub async fn unload_model(
State(state): State<AppState>,
Path(model): Path<String>,
) -> Result<Json<Value>, (axum::http::StatusCode, String)> {
match state.ollama.unload_model(&model).await {
// ← correct method
Ok(response) => Ok(Json(response)),
Err(e) => Err(ollama_err(e)),
}
}
fn ollama_err(e: OllamaError) -> (axum::http::StatusCode, String) {
match e {
OllamaError::ModelNotFound(m) => (