feat: add models list endpoint

This commit is contained in:
2026-04-09 20:51:20 +02:00
parent b429f6256b
commit 8d26907c89
9 changed files with 467 additions and 43 deletions
+16
View File
@@ -0,0 +1,16 @@
use axum::{Json, extract::State};
use serde_json::Value;
use crate::state::app_state::AppState;
pub async fn list_models(
State(state): State<AppState>,
) -> Result<Json<Value>, (axum::http::StatusCode, String)> {
match state.ollama.list_models().await {
Ok(models) => Ok(Json(models)),
Err(err) => Err((
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
err.to_string(),
)),
}
}