mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-02 08:28:18 +00:00
use publicweightstype in server
This commit is contained in:
1 parent
114cdc10a0
commit
4e6285acd2
20 files changed
+53
-44
No files matched your search
Generated
+1
@@ -6813,6 +6813,7 @@ dependencies = [
|
||||
"elasticsearch_schema",
|
||||
"email_sender",
|
||||
"enums",
|
||||
"enums_public",
|
||||
"errors",
|
||||
"filesys",
|
||||
"futures 0.1.31",
|
||||
|
||||
@@ -1 +1 @@
|
||||
pub mod weights_types;
|
||||
pub mod public_weights_types;
|
||||
File renamed without changes.
@@ -68,6 +68,7 @@ impl VcModelForList {
|
||||
WeightsType::LoRA => None,
|
||||
WeightsType::VallE => None,
|
||||
WeightsType::ComfyUi => None,
|
||||
WeightsType::GptSoVits => None,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ impl VcModel {
|
||||
WeightsType::LoRA => VcModelType::Invalid,
|
||||
WeightsType::VallE => VcModelType::Invalid,
|
||||
WeightsType::ComfyUi => VcModelType::Invalid,
|
||||
WeightsType::GptSoVits => VcModelType::Invalid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ impl VcModelLite {
|
||||
WeightsType::LoRA => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::VallE => None, // TODO(bt,2023-12-18): Does this mean speaker weights?
|
||||
WeightsType::ComfyUi => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::GptSoVits => None, // TODO: Fixme
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,6 +100,7 @@ impl VcModelLite {
|
||||
WeightsType::LoRA => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::VallE => None, // TODO(bt,2023-12-18): Does this mean speaker weights?
|
||||
WeightsType::ComfyUi => None, // NB: not used directly in inference. Included in other models.
|
||||
WeightsType::GptSoVits => None, // TODO: Fixme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ easyenv = { path = "../../../lib/easyenv" }
|
||||
elasticsearch_schema = { path = "../../../lib/elasticsearch_schema" }
|
||||
email_sender= { path = "../../../lib/email_sender" }
|
||||
enums = { path = "../../../_types/enums" }
|
||||
enums_public = { path = "../../../_types/enums_public" }
|
||||
errors = { path = "../../../lib/errors" }
|
||||
filesys = { path = "../../../lib/files/filesys" }
|
||||
hashing = { path = "../../../lib/files/hashing" }
|
||||
|
||||
@@ -25,6 +25,7 @@ use enums::by_table::users::user_feature_flag::UserFeatureFlag;
|
||||
use enums::common::job_status_plus::JobStatusPlus;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use tokens::tokens::batch_generations::*;
|
||||
use tokens::tokens::beta_keys::*;
|
||||
use tokens::tokens::browser_session_logs::*;
|
||||
@@ -242,6 +243,7 @@ use crate::http_server::web_utils::response_success_helpers::*;
|
||||
MediaFileSubtype,
|
||||
MediaFileType,
|
||||
PromptType,
|
||||
PublicWeightsType,
|
||||
StyleTransferName,
|
||||
UserFeatureFlag,
|
||||
WeightsCategory,
|
||||
|
||||
+1
-2
@@ -12,15 +12,14 @@ use utoipa::ToSchema;
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use mysql_queries::queries::media_files::get::get_media_file::get_media_file;
|
||||
use mysql_queries::queries::tts::tts_results::query_tts_result::select_tts_result_by_token;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
|
||||
+4
-3
@@ -22,16 +22,17 @@ use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::media_files::get::batch_get_media_files::batch_get_media_files;
|
||||
use mysql_queries::queries::tts::tts_results::query_tts_result::select_tts_result_by_token;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::prompts::PromptToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::media_file_cover_image_details::{MediaFileCoverImageDetails, MediaFileDefaultCover};
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -162,7 +163,7 @@ pub struct BatchMediaFileInfo {
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct BatchGetMediaFilesModelInfo {
|
||||
pub weight_token: ModelWeightToken,
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
pub title: String,
|
||||
|
||||
@@ -329,7 +330,7 @@ pub async fn batch_get_media_files_handler(
|
||||
weight_token,
|
||||
// TODO(bt,2023-12-28): Instead of giving bogus defaults on None, make these optional or return
|
||||
// None for *everything* on any field being absent.
|
||||
weight_type: result.maybe_model_weights_type.unwrap_or(WeightsType::Tacotron2),
|
||||
weight_type: PublicWeightsType::from_enum(result.maybe_model_weights_type.unwrap_or(WeightsType::Tacotron2)),
|
||||
weight_category: result.maybe_model_weights_category.unwrap_or(WeightsCategory::TextToSpeech),
|
||||
title: result.maybe_model_weights_title.unwrap_or_else(|| "model".to_string()),
|
||||
maybe_cover_image_public_bucket_path,
|
||||
|
||||
+5
-4
@@ -19,16 +19,17 @@ use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::media_files::get::get_media_file::get_media_file;
|
||||
use mysql_queries::queries::tts::tts_results::query_tts_result::select_tts_result_by_token;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::prompts::PromptToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::media_file_cover_image_details::{MediaFileCoverImageDetails, MediaFileDefaultCover};
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -161,7 +162,7 @@ pub struct GetMediaFileModeratorFields {
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct GetMediaFileModelInfo {
|
||||
pub weight_token: ModelWeightToken,
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
pub title: String,
|
||||
|
||||
@@ -369,7 +370,7 @@ async fn modern_media_file_lookup(
|
||||
weight_token,
|
||||
// TODO(bt,2023-12-28): Instead of giving bogus defaults on None, make these optional or return
|
||||
// None for *everything* on any field being absent.
|
||||
weight_type: result.maybe_model_weights_type.unwrap_or(WeightsType::Tacotron2),
|
||||
weight_type: PublicWeightsType::from_enum(result.maybe_model_weights_type.unwrap_or(WeightsType::Tacotron2)),
|
||||
weight_category: result.maybe_model_weights_category.unwrap_or(WeightsCategory::TextToSpeech),
|
||||
title: result.maybe_model_weights_title.unwrap_or_else(|| "model".to_string()),
|
||||
maybe_cover_image_public_bucket_path,
|
||||
@@ -468,7 +469,7 @@ async fn emulate_media_file_with_legacy_tts_result_lookup(
|
||||
maybe_model_weight_info: Some(GetMediaFileModelInfo {
|
||||
// NB: These should be reasonable synthetic defaults for emulated TT2 results, even the "ModelWeightToken".
|
||||
weight_token: ModelWeightToken::new_from_str(&result.tts_model_token),
|
||||
weight_type: WeightsType::Tacotron2,
|
||||
weight_type: PublicWeightsType::Tacotron2,
|
||||
weight_category: WeightsCategory::TextToSpeech,
|
||||
title: result.tts_model_title.unwrap_or_else(|| "tacotron2 model".to_string()),
|
||||
maybe_cover_image_public_bucket_path: None,
|
||||
|
||||
+1
-2
@@ -12,7 +12,6 @@ use utoipa::ToSchema;
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::by_table::prompts::prompt_type::PromptType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
@@ -23,9 +22,9 @@ use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::prompts::PromptToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::endpoints::media_files::get::get_media_file_handler::GetMediaFileError;
|
||||
use crate::http_server::web_utils::require_user_session::require_user_session;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
|
||||
+4
-3
@@ -19,12 +19,13 @@ use enums::by_table::media_files::media_file_type::MediaFileType;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::by_table::user_bookmarks::user_bookmark_entity_type::UserBookmarkEntityType;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::users::user_bookmarks::list_user_bookmarks::{list_user_bookmarks_by_maybe_entity_type, ListUserBookmarksForUserArgs};
|
||||
use tokens::tokens::user_bookmarks::UserBookmarkToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::pagination_page::PaginationPage;
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -111,7 +112,7 @@ pub struct MediaFileData {
|
||||
#[derive(Serialize, ToSchema)]
|
||||
pub struct WeightsData {
|
||||
pub title: String,
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
|
||||
/// Cover images are small descriptive images that can be set for any model.
|
||||
@@ -255,7 +256,7 @@ pub async fn list_user_bookmarks_for_user_handler(
|
||||
UserBookmarkEntityType::ModelWeight => Some(WeightsData {
|
||||
// TODO(bt,2023-12-28): Proper default, optional, or "unknown" values would be better.
|
||||
title: user_bookmark.maybe_entity_descriptive_text.clone().unwrap_or_else(|| "weight".to_string()),
|
||||
weight_type: user_bookmark.maybe_model_weight_type.unwrap_or(WeightsType::Tacotron2),
|
||||
weight_type: PublicWeightsType::from_enum(user_bookmark.maybe_model_weight_type.unwrap_or(WeightsType::Tacotron2)),
|
||||
weight_category: user_bookmark.maybe_model_weight_category.unwrap_or(WeightsCategory::TextToSpeech),
|
||||
maybe_cover_image_public_bucket_path: maybe_model_weight_cover_image,
|
||||
maybe_creator: maybe_model_weight_creator,
|
||||
|
||||
+4
-3
@@ -13,11 +13,12 @@ use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::model_weights::get::get_weight::get_weight_by_token;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -26,7 +27,7 @@ pub struct GetWeightResponse {
|
||||
success: bool,
|
||||
weight_token: ModelWeightToken,
|
||||
title: String,
|
||||
weight_type: WeightsType,
|
||||
weight_type: PublicWeightsType,
|
||||
weight_category: WeightsCategory,
|
||||
|
||||
// TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend
|
||||
@@ -184,7 +185,7 @@ pub async fn get_weight_handler(
|
||||
success: true,
|
||||
weight_token: weight.token,
|
||||
title: weight.title,
|
||||
weight_type: weight.weights_type,
|
||||
weight_type: PublicWeightsType::from_enum(weight.weights_type),
|
||||
weight_category: weight.weights_category,
|
||||
// TODO(bt,2023-12-24): Migrated the column. We should return nullable fields, but I don't want to break the frontend
|
||||
description_markdown: weight.maybe_description_markdown.unwrap_or_else(|| "".to_string()),
|
||||
|
||||
+6
-5
@@ -10,16 +10,17 @@ use utoipa::ToSchema;
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::pagination_cursors::PaginationCursors;
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -28,7 +29,7 @@ pub struct ListAvailableWeightsQuery {
|
||||
pub sort_ascending: Option<bool>,
|
||||
pub page_size: Option<u16>,
|
||||
pub username: Option<String>,
|
||||
pub weight_type: Option<WeightsType>,
|
||||
pub weight_type: Option<PublicWeightsType>,
|
||||
pub weight_category: Option<WeightsCategory>,
|
||||
pub cursor_is_reversed: Option<bool>,
|
||||
pub cursor: Option<String>,
|
||||
@@ -161,7 +162,7 @@ pub async fn list_available_weights_handler(
|
||||
.sort_ascending(sort_ascending)
|
||||
.cursor_is_reversed(cursor_is_reversed)
|
||||
.weights_category(query.weight_category)
|
||||
.weights_type(query.weight_type)
|
||||
.weights_type(query.weight_type.map(|wt| wt.to_enum()))
|
||||
.scope_creator_username(None)
|
||||
.include_user_hidden(include_user_hidden)
|
||||
.include_user_deleted_results(false) // NB: Mods don't want to see deleted models. We'll improve this later.
|
||||
|
||||
+5
-7
@@ -10,18 +10,16 @@ use r2d2_redis::redis::Commands;
|
||||
use utoipa::{IntoParams, ToSchema};
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::media_files::list::list_media_files::{list_media_files, ListMediaFilesArgs};
|
||||
use mysql_queries::queries::model_weights::list::list_featured_weights::{list_featured_weights, ListFeaturedWeightsArgs};
|
||||
use mysql_queries::queries::model_weights::list::list_weights_by_tokens::list_weights_by_tokens;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::http_server::endpoints::media_files::list::list_featured_media_files_handler::ListFeaturedMediaFilesError;
|
||||
use crate::http_server::endpoints::media_files::list::list_media_files_handler::{ListMediaFilesError, ListMediaFilesQueryParams};
|
||||
@@ -75,7 +73,7 @@ pub struct ListFeaturedWeightsSuccessResponse {
|
||||
pub struct FeaturedModelWeightForList {
|
||||
pub weight_token: ModelWeightToken,
|
||||
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
@@ -249,7 +247,7 @@ pub async fn list_featured_weights_handler(
|
||||
FeaturedModelWeightForList {
|
||||
weight_token: w.token,
|
||||
title: w.title,
|
||||
weight_type: w.weights_type,
|
||||
weight_type: PublicWeightsType::from_enum(w.weights_type),
|
||||
weight_category: w.weights_category,
|
||||
cover_image: cover_image_details,
|
||||
maybe_cover_image_public_bucket_path: maybe_cover_image,
|
||||
|
||||
+5
-7
@@ -9,15 +9,13 @@ use r2d2_redis::redis::Commands;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::{
|
||||
weights_category::WeightsCategory,
|
||||
weights_types::WeightsType,
|
||||
};
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::model_weights::list::list_weights_by_tokens::list_weights_by_tokens;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -31,7 +29,7 @@ pub struct ListPinnedWeightsSuccessResponse {
|
||||
pub struct PinnedModelWeightForList {
|
||||
pub weight_token: ModelWeightToken,
|
||||
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
|
||||
pub title: String,
|
||||
@@ -156,7 +154,7 @@ pub async fn list_pinned_weights_handler(
|
||||
PinnedModelWeightForList {
|
||||
weight_token: w.token,
|
||||
title: w.title,
|
||||
weight_type: w.weights_type,
|
||||
weight_type: PublicWeightsType::from_enum(w.weights_type),
|
||||
weight_category: w.weights_category,
|
||||
cover_image: cover_image_details,
|
||||
maybe_cover_image_public_bucket_path: maybe_cover_image,
|
||||
|
||||
+4
-4
@@ -11,15 +11,15 @@ use utoipa::{IntoParams, ToSchema};
|
||||
|
||||
use buckets::public::media_files::bucket_file_path::MediaFileBucketPath;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::view_as::ViewAs;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use mysql_queries::queries::model_weights::list::list_weights_by_user::{list_weights_by_creator_username, ListWeightsForUserArgs};
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::pagination_page::PaginationPage;
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::state::server_state::ServerState;
|
||||
|
||||
@@ -71,7 +71,7 @@ pub struct ListWeightsForUserQueryParams {
|
||||
|
||||
/// Optional. Scope to only the exact weight type.
|
||||
/// Shouldn't be used with weight category scoping
|
||||
pub maybe_scoped_weight_type: Option<WeightsType>,
|
||||
pub maybe_scoped_weight_type: Option<PublicWeightsType>,
|
||||
|
||||
/// Optional. Scope to only the exact weight category, which may include
|
||||
/// multiple types of model (eg voice_conversion includes RVC, SVC, etc.)
|
||||
@@ -169,7 +169,7 @@ pub async fn list_weights_by_user_handler(
|
||||
sort_ascending,
|
||||
view_as,
|
||||
maybe_scoped_weight_category: query.maybe_scoped_weight_category,
|
||||
maybe_scoped_weight_type: query.maybe_scoped_weight_type,
|
||||
maybe_scoped_weight_type: query.maybe_scoped_weight_type.map(|w| w.to_enum()),
|
||||
mysql_pool: &server_state.mysql_pool,
|
||||
}
|
||||
).await.map_err(|e| {
|
||||
|
||||
+4
-3
@@ -19,10 +19,11 @@ use elasticsearch_schema::searches::search_model_weights::search_model_weights;
|
||||
use enums::by_table::model_weights::weights_category::WeightsCategory;
|
||||
use enums::by_table::model_weights::weights_types::WeightsType;
|
||||
use enums::common::visibility::Visibility;
|
||||
use enums_public::by_table::model_weights::public_weights_types::PublicWeightsType;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
|
||||
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
|
||||
use crate::http_server::common_responses::user_details_lite::UserDetailsLight;
|
||||
use crate::http_server::common_responses::weights_cover_image_details::WeightsCoverImageDetails;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::state::server_state::ServerState;
|
||||
@@ -39,7 +40,7 @@ pub struct SearchModelWeightsRequest {
|
||||
pub struct ModelWeightSearchResult {
|
||||
pub weight_token: ModelWeightToken,
|
||||
|
||||
pub weight_type: WeightsType,
|
||||
pub weight_type: PublicWeightsType,
|
||||
pub weight_category: WeightsCategory,
|
||||
|
||||
pub creator_set_visibility: Visibility,
|
||||
@@ -148,7 +149,7 @@ pub async fn search_model_weights_handler(
|
||||
|
||||
ModelWeightSearchResult {
|
||||
weight_token: result.token,
|
||||
weight_type: result.weights_type,
|
||||
weight_type: PublicWeightsType::from_enum(result.weights_type),
|
||||
weight_category: result.weights_category,
|
||||
title: result.title,
|
||||
creator: UserDetailsLight::from_db_fields(
|
||||
|
||||
@@ -123,6 +123,7 @@ async fn query_model_weight_models(mysql_pool: &MySqlPool)
|
||||
WeightsType::LoRA => continue, // TODO(bt,2023-12-18): Not yet set up with enums for inference
|
||||
WeightsType::VallE => continue, // TODO(bt,2023-12-18): ??? We have vall-e weights?? Not sure what this means yet.
|
||||
WeightsType::ComfyUi => continue, // Not supported for inference
|
||||
WeightsType::GptSoVits => continue, // TODO: FIXME
|
||||
};
|
||||
|
||||
let info = ModelInfoForInferenceJob {
|
||||
|
||||
Reference in new issue
Block a user