feat: add models list endpoint
This commit is contained in:
@@ -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(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user