@@ -13,7 +13,7 @@ use axum::{
|
||||
(
|
||||
status = 200,
|
||||
description = "List of locally available Ollama models",
|
||||
body = api::types::ModelsResponse,
|
||||
body = api::types::ApiModelsResponse,
|
||||
content_type = "application/json",
|
||||
),
|
||||
(
|
||||
@@ -27,7 +27,7 @@ use axum::{
|
||||
// #[axum::debug_handler]
|
||||
pub async fn list_models(
|
||||
State(state): State<SharedState>,
|
||||
) -> Result<Json<api::types::ModelsResponse>, api::errors::ApiError> {
|
||||
) -> Result<Json<api::types::ApiModelsResponse>, api::errors::ApiError> {
|
||||
let models = state.chat_service.list_models().await?;
|
||||
|
||||
Ok(Json(models.into()))
|
||||
@@ -41,7 +41,7 @@ pub async fn list_models(
|
||||
("model" = String, Path, description = "Name of the model to load into memory (e.g. 'llama3')")
|
||||
),
|
||||
request_body(
|
||||
content = api::types::LoadModelRequest,
|
||||
content = api::types::ApiLoadModelRequest,
|
||||
description = "Load model request",
|
||||
content_type = "application/json",
|
||||
example = json!({ "keep_alive": "10m" })
|
||||
@@ -50,7 +50,7 @@ pub async fn list_models(
|
||||
(
|
||||
status = 200,
|
||||
description = "Model successfully loaded into memory",
|
||||
body = api::types::LoadModelResponse,
|
||||
body = api::types::ApiLoadModelResponse,
|
||||
content_type = "application/json",
|
||||
),
|
||||
(
|
||||
@@ -79,8 +79,8 @@ pub async fn list_models(
|
||||
pub async fn load_model(
|
||||
State(state): State<SharedState>,
|
||||
Path(model): Path<String>,
|
||||
Json(body): Json<api::types::LoadModelRequest>,
|
||||
) -> Result<Json<api::types::LoadModelResponse>, api::errors::ApiError> {
|
||||
Json(body): Json<api::types::ApiLoadModelRequest>,
|
||||
) -> Result<Json<api::types::ApiLoadModelResponse>, api::errors::ApiError> {
|
||||
let response = state
|
||||
.chat_service
|
||||
.load_model(crate::core::llm::models::LoadModelRequest {
|
||||
@@ -89,7 +89,7 @@ pub async fn load_model(
|
||||
})
|
||||
.await?;
|
||||
|
||||
Ok(Json(api::types::LoadModelResponse {
|
||||
Ok(Json(api::types::ApiLoadModelResponse {
|
||||
model: response.model,
|
||||
keep_alive: body.keep_alive,
|
||||
status: "loaded".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user