cover image details on list weights

This commit is contained in:
Brandon Thomas committed 2024-01-11 21:28:32 -05:00
1 parent 5643ecae89
commit 65ea06767a
2 files changed
+13 -3

No files matched your search

+1 -3
View File
@@ -55,11 +55,9 @@ pub async fn main() -> AnyhowResult<()> {
seed_user_accounts(&pool).await?;
seed_media_files(&pool, maybe_bucket_clients.as_ref()).await?;
seed_zero_shot_tts(&pool, maybe_bucket_clients.as_ref()).await?;
//seed_zero_shot_tts(&pool, maybe_bucket_clients.as_ref()).await?;
seed_voice_conversion(&pool).await?;
seed_weights(&pool).await?;
seed_tts_tacotron2(&pool, maybe_bucket_clients.as_ref()).await?;
// should seed the weights with a few files for hanashi
@@ -16,6 +16,7 @@ use enums::by_table::model_weights::{
use enums::common::visibility::Visibility;
use mysql_queries::queries::model_weights::list::list_weights_query_builder::ListWeightsQueryBuilder;
use tokens::tokens::model_weights::ModelWeightToken;
use crate::http_server::common_responses::cover_image_details::CoverImageDetails;
use crate::http_server::common_responses::pagination_cursors::PaginationCursors;
use crate::http_server::common_responses::simple_entity_stats::SimpleEntityStats;
@@ -56,8 +57,12 @@ pub struct ModelWeightForList {
/// Cover images are small descriptive images that can be set for any model.
/// If a cover image is set, this is the path to the asset.
#[deprecated(note="switch to CoverImageDetails")]
pub maybe_cover_image_public_bucket_path: Option<String>,
/// Information about the cover image.
pub cover_image: CoverImageDetails,
pub creator: UserDetailsLight,
pub creator_set_visibility: Visibility,
@@ -199,6 +204,12 @@ pub async fn list_available_weights_handler(
success: true,
results: weights_page.weights.into_iter()
.map(|weight| {
let cover_image_details = CoverImageDetails::from_optional_db_fields(
&weight.token,
weight.maybe_cover_image_public_bucket_hash.as_deref(),
weight.maybe_cover_image_public_bucket_prefix.as_deref(),
weight.maybe_cover_image_public_bucket_extension.as_deref(),
);
let maybe_cover_image = weight.maybe_cover_image_public_bucket_hash
.as_deref()
@@ -218,6 +229,7 @@ pub async fn list_available_weights_handler(
weight_category: weight.weights_category,
maybe_cover_image_public_bucket_path: maybe_cover_image,
cover_image: cover_image_details,
creator: UserDetailsLight::from_db_fields(
&weight.creator_user_token,