feat: update test
This commit is contained in:
@@ -20,13 +20,9 @@ pub async fn load_model(
|
||||
Path(model): Path<String>,
|
||||
Json(body): Json<api::LoadModelBody>,
|
||||
) -> Result<Json<api::LoadModelResponse>, (axum::http::StatusCode, String)> {
|
||||
let keep_alive = body.keep_alive.as_deref().unwrap_or("5m");
|
||||
|
||||
api::LoadModelBody::parse_keep_alive(keep_alive).map_err(ollama_err)?;
|
||||
|
||||
let response = state
|
||||
.ollama
|
||||
.load_model(&model, keep_alive)
|
||||
.load_model(&model, body.keep_alive.as_deref())
|
||||
.await
|
||||
.map_err(ollama_err)?;
|
||||
|
||||
@@ -64,6 +60,10 @@ fn ollama_err(e: OllamaError) -> (axum::http::StatusCode, String) {
|
||||
axum::http::StatusCode::BAD_REQUEST,
|
||||
"messages array with at least one user message is required".to_string(),
|
||||
),
|
||||
OllamaError::MissingKeepAlive => (
|
||||
axum::http::StatusCode::BAD_REQUEST,
|
||||
"keep alive is required and cannot be empty".to_string(),
|
||||
),
|
||||
OllamaError::InvalidKeepAlive(v) => (
|
||||
axum::http::StatusCode::BAD_REQUEST,
|
||||
format!("invalid keep_alive '{v}' — use 30s / 10m / 2h, a plain integer, or -1"),
|
||||
|
||||
Reference in New Issue
Block a user