mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 09:48:44 +00:00
Builds and docs work
This commit is contained in:
1 parent
f4176bf84a
commit
f327dfcdbb
3 files changed
+23
-5
No files matched your search
@@ -18,12 +18,14 @@ use enums::common::visibility::Visibility;
|
||||
use chrono::{DateTime, Utc};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(paths(crate::http_server::endpoints::voice_designer::inference::enqueue_tts_request::enqueue_tts_request,
|
||||
crate::http_server::endpoints::weights::list_available_weights::list_available_weights_handler,
|
||||
crate::http_server::endpoints::weights::delete_weight::delete_weight_handler,
|
||||
crate::http_server::endpoints::weights::update_weight::update_weight_handler,
|
||||
crate::http_server::endpoints::weights::get_weight::get_weight_handler,
|
||||
crate::http_server::endpoints::weights::list_weights_by_user::list_weights_by_user_handler
|
||||
),components(schemas(
|
||||
// Tokens
|
||||
UserToken,Visibility,
|
||||
@@ -38,6 +40,7 @@ use utoipa::OpenApi;
|
||||
DeleteWeightPathInfo,DeleteWeightRequest,DeleteWeightError,DeleteWeightRequest,DeleteWeightError,
|
||||
ListWeightError,ModelWeightForList,ListWeightError,
|
||||
ListAvailableWeightsQuery,ListAvailableWeightsSuccessResponse,ModelWeightForList,
|
||||
ListWeightsByUserError,ListWeightsByUserSuccessResponse,ListWeightsByUserPathInfo,Weight
|
||||
)))]
|
||||
pub struct ApiDoc;
|
||||
|
||||
+3
-1
@@ -106,7 +106,7 @@ impl ResponseError for ListWeightError {
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/v1/weights/list/",
|
||||
path = "/v1/weights/list",
|
||||
responses(
|
||||
(status = 200, description = "List Weights", body = ListAvailableWeightsSuccessResponse),
|
||||
(status = 401, description = "Not authorized", body = ListWeightError),
|
||||
@@ -139,6 +139,8 @@ pub async fn list_available_weights_handler(
|
||||
return Err(ListWeightError::NotAuthorized);
|
||||
}
|
||||
};
|
||||
let page_size: u16 = 10;
|
||||
let page_index : u16 = 0;
|
||||
|
||||
let limit = query.page_size;
|
||||
|
||||
|
||||
+17
-4
@@ -14,8 +14,9 @@ use tokens::tokens::model_weights::ModelWeightToken;
|
||||
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::server_state::ServerState;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[derive(Serialize, Clone,ToSchema)]
|
||||
pub struct Weight {
|
||||
weight_token: ModelWeightToken,
|
||||
title: String,
|
||||
@@ -41,18 +42,18 @@ pub struct Weight {
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[derive(Serialize,ToSchema)]
|
||||
pub struct ListWeightsByUserSuccessResponse {
|
||||
pub success: bool,
|
||||
pub weights: Vec<Weight>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[derive(Deserialize,ToSchema)]
|
||||
pub struct ListWeightsByUserPathInfo {
|
||||
username: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug,ToSchema)]
|
||||
pub enum ListWeightsByUserError {
|
||||
NotAuthorized,
|
||||
ServerError,
|
||||
@@ -73,6 +74,18 @@ impl ResponseError for ListWeightsByUserError {
|
||||
}
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/v1/weights/by_user/{username}",
|
||||
responses(
|
||||
(status = 200, description = "List Weights by user", body = ListWeightsByUserSuccessResponse),
|
||||
(status = 401, description = "Not authorized", body = ListWeightsByUserError),
|
||||
(status = 500, description = "Server error", body = ListWeightsByUserError),
|
||||
),
|
||||
params(
|
||||
("path" = ListWeightsByUserPathInfo, description = "Payload for Request"),
|
||||
)
|
||||
)]
|
||||
pub async fn list_weights_by_user_handler(
|
||||
http_request: HttpRequest,
|
||||
path: Path<ListWeightsByUserPathInfo>,
|
||||
|
||||
Reference in new issue
Block a user