mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-17 07:04:36 +00:00
cleanup
This commit is contained in:
1 parent
ede53b2c22
commit
e8e4c1298e
3 files changed
+5
-352
No files matched your search
+1
-198
@@ -4,13 +4,8 @@
|
||||
#![forbid(unused_variables)]
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use enums::by_table::media_files::media_file_animation_type::MediaFileAnimationType;
|
||||
use enums::by_table::media_files::media_file_class::MediaFileClass;
|
||||
use enums::by_table::media_files::media_file_engine_category::MediaFileEngineCategory;
|
||||
use enums::by_table::media_files::media_file_subtype::MediaFileSubtype;
|
||||
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 errors::AnyhowResult;
|
||||
use log::warn;
|
||||
@@ -19,12 +14,10 @@ use sqlx::{MySql, MySqlPool};
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::media_files::MediaFileToken;
|
||||
use tokens::tokens::model_weights::ModelWeightToken;
|
||||
use tokens::tokens::prompts::PromptToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
use crate::helpers::boolean_converters::{i64_to_bool, i8_to_bool};
|
||||
use crate::payloads::media_file_extra_info::media_file_extra_info::MediaFileExtraInfo;
|
||||
use crate::helpers::boolean_converters::i8_to_bool;
|
||||
use crate::payloads::prompt_args::prompt_inner_payload::PromptInnerPayload;
|
||||
use crate::utils::transactor::Transactor;
|
||||
|
||||
@@ -39,21 +32,10 @@ pub struct MediaFile {
|
||||
pub media_class: MediaFileClass,
|
||||
pub media_type: MediaFileType,
|
||||
|
||||
pub maybe_engine_category: Option<MediaFileEngineCategory>,
|
||||
pub maybe_animation_type: Option<MediaFileAnimationType>,
|
||||
|
||||
pub maybe_media_subtype: Option<MediaFileSubtype>,
|
||||
|
||||
pub maybe_mime_type: Option<String>,
|
||||
|
||||
// TODO: Other media details (file size, dimensions, duration, etc.)
|
||||
// TODO: Provenance data (product, upload vs inference, model details and foreign keys)
|
||||
|
||||
pub maybe_batch_token: Option<BatchGenerationToken>,
|
||||
|
||||
pub maybe_style_transfer_source_media_file_token: Option<MediaFileToken>,
|
||||
pub maybe_scene_source_media_file_token: Option<MediaFileToken>,
|
||||
|
||||
pub maybe_title: Option<String>,
|
||||
pub maybe_text_transcript: Option<String>,
|
||||
|
||||
@@ -81,52 +63,16 @@ pub struct MediaFile {
|
||||
pub maybe_file_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_file_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weights_token: Option<ModelWeightToken>,
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_model_weights_type: Option<WeightsType>,
|
||||
pub maybe_model_weights_category: Option<WeightsCategory>,
|
||||
|
||||
pub maybe_model_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub maybe_model_weight_creator_username: Option<String>,
|
||||
pub maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
/// Not all files have extra info.
|
||||
/// This is a polymorphic JSON blob that gets hydrated into structs.
|
||||
pub extra_media_file_info: Option<MediaFileExtraInfo>,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_ratings_positive_count: Option<u32>,
|
||||
pub maybe_ratings_negative_count: Option<u32>,
|
||||
pub maybe_bookmark_count: Option<u32>,
|
||||
|
||||
pub is_featured: bool,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
// pub maybe_moderator_fields: Option<MediaFileModeratorFields>,
|
||||
}
|
||||
|
||||
// /// "Moderator-only fields" that we wouldn't want to expose to ordinary users.
|
||||
// /// It's the web endpoint controller's responsibility to clear these for non-mods.
|
||||
// #[derive(Serialize)]
|
||||
// pub struct MediaFileModeratorFields {
|
||||
// pub model_creator_is_banned: bool,
|
||||
// pub result_creator_is_banned_if_user: bool,
|
||||
// pub result_creator_ip_address: String,
|
||||
// pub result_creator_deleted_at: Option<DateTime<Utc>>,
|
||||
// pub mod_deleted_at: Option<DateTime<Utc>>,
|
||||
// pub maybe_mod_user_token: Option<String>,
|
||||
// }
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct MediaFileRaw {
|
||||
pub token: MediaFileToken,
|
||||
@@ -134,18 +80,10 @@ pub struct MediaFileRaw {
|
||||
pub media_class: MediaFileClass,
|
||||
pub media_type: MediaFileType,
|
||||
|
||||
pub maybe_engine_category: Option<MediaFileEngineCategory>,
|
||||
pub maybe_animation_type: Option<MediaFileAnimationType>,
|
||||
|
||||
pub maybe_media_subtype: Option<MediaFileSubtype>,
|
||||
|
||||
pub maybe_mime_type: Option<String>,
|
||||
|
||||
pub maybe_batch_token: Option<BatchGenerationToken>,
|
||||
|
||||
pub maybe_style_transfer_source_media_file_token: Option<MediaFileToken>,
|
||||
pub maybe_scene_source_media_file_token: Option<MediaFileToken>,
|
||||
|
||||
pub maybe_title: Option<String>,
|
||||
pub maybe_text_transcript: Option<String>,
|
||||
|
||||
@@ -173,35 +111,10 @@ pub struct MediaFileRaw {
|
||||
pub maybe_file_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_file_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weights_token: Option<ModelWeightToken>,
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_model_weights_type: Option<WeightsType>,
|
||||
pub maybe_model_weights_category: Option<WeightsCategory>,
|
||||
|
||||
pub maybe_model_cover_image_public_bucket_hash: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_prefix: Option<String>,
|
||||
pub maybe_model_cover_image_public_bucket_extension: Option<String>,
|
||||
|
||||
pub maybe_model_weight_creator_user_token: Option<UserToken>,
|
||||
pub maybe_model_weight_creator_username: Option<String>,
|
||||
pub maybe_model_weight_creator_display_name: Option<String>,
|
||||
pub maybe_model_weight_creator_gravatar_hash: Option<String>,
|
||||
|
||||
pub extra_file_modification_info: Option<String>,
|
||||
|
||||
pub public_bucket_directory_hash: String,
|
||||
pub maybe_public_bucket_prefix: Option<String>,
|
||||
pub maybe_public_bucket_extension: Option<String>,
|
||||
|
||||
//pub model_is_mod_approved: bool, // converted
|
||||
//pub maybe_mod_user_token: Option<String>,
|
||||
|
||||
pub maybe_ratings_positive_count: Option<u32>,
|
||||
pub maybe_ratings_negative_count: Option<u32>,
|
||||
pub maybe_bookmark_count: Option<u32>,
|
||||
|
||||
pub is_featured: i64,
|
||||
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -248,14 +161,9 @@ pub async fn list_batch_generated_media_files_with_transactor(
|
||||
MediaFile {
|
||||
token: record.token,
|
||||
media_type: record.media_type,
|
||||
maybe_engine_category: record.maybe_engine_category,
|
||||
maybe_animation_type: record.maybe_animation_type,
|
||||
media_class: record.media_class,
|
||||
maybe_media_subtype: record.maybe_media_subtype,
|
||||
maybe_mime_type: record.maybe_mime_type,
|
||||
maybe_batch_token: record.maybe_batch_token,
|
||||
maybe_style_transfer_source_media_file_token: record.maybe_style_transfer_source_media_file_token,
|
||||
maybe_scene_source_media_file_token: record.maybe_scene_source_media_file_token,
|
||||
maybe_title: record.maybe_title,
|
||||
maybe_text_transcript: record.maybe_text_transcript,
|
||||
maybe_origin_filename: record.maybe_origin_filename,
|
||||
@@ -278,27 +186,9 @@ pub async fn list_batch_generated_media_files_with_transactor(
|
||||
maybe_file_cover_image_public_bucket_hash: record.maybe_file_cover_image_public_bucket_hash,
|
||||
maybe_file_cover_image_public_bucket_prefix: record.maybe_file_cover_image_public_bucket_prefix,
|
||||
maybe_file_cover_image_public_bucket_extension: record.maybe_file_cover_image_public_bucket_extension,
|
||||
maybe_model_weights_token: record.maybe_model_weights_token,
|
||||
maybe_model_weights_title: record.maybe_model_weights_title,
|
||||
maybe_model_weights_type: record.maybe_model_weights_type,
|
||||
maybe_model_weights_category: record.maybe_model_weights_category,
|
||||
maybe_model_cover_image_public_bucket_hash: record.maybe_model_cover_image_public_bucket_hash,
|
||||
maybe_model_cover_image_public_bucket_prefix: record.maybe_model_cover_image_public_bucket_prefix,
|
||||
maybe_model_cover_image_public_bucket_extension: record.maybe_model_cover_image_public_bucket_extension,
|
||||
maybe_model_weight_creator_user_token: record.maybe_model_weight_creator_user_token,
|
||||
maybe_model_weight_creator_username: record.maybe_model_weight_creator_username,
|
||||
maybe_model_weight_creator_display_name: record.maybe_model_weight_creator_display_name,
|
||||
maybe_model_weight_creator_gravatar_hash: record.maybe_model_weight_creator_gravatar_hash,
|
||||
extra_media_file_info: record.extra_file_modification_info
|
||||
.map(|info| MediaFileExtraInfo::from_json_str(&info).ok())
|
||||
.flatten(), // NB: Fail open. Do not fail the query if we can't hydrate the JSON.
|
||||
public_bucket_directory_hash: record.public_bucket_directory_hash,
|
||||
maybe_public_bucket_prefix: record.maybe_public_bucket_prefix,
|
||||
maybe_public_bucket_extension: record.maybe_public_bucket_extension,
|
||||
maybe_ratings_positive_count: record.maybe_ratings_positive_count,
|
||||
maybe_ratings_negative_count: record.maybe_ratings_negative_count,
|
||||
maybe_bookmark_count: record.maybe_bookmark_count,
|
||||
is_featured: i64_to_bool(record.is_featured),
|
||||
created_at: record.created_at,
|
||||
updated_at: record.updated_at,
|
||||
}
|
||||
@@ -323,11 +213,6 @@ SELECT
|
||||
m.media_class as `media_class: enums::by_table::media_files::media_file_class::MediaFileClass`,
|
||||
m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,
|
||||
|
||||
m.maybe_engine_category as `maybe_engine_category: enums::by_table::media_files::media_file_engine_category::MediaFileEngineCategory`,
|
||||
m.maybe_animation_type as `maybe_animation_type: enums::by_table::media_files::media_file_animation_type::MediaFileAnimationType`,
|
||||
|
||||
m.maybe_media_subtype as `maybe_media_subtype: enums::by_table::media_files::media_file_subtype::MediaFileSubtype`,
|
||||
|
||||
m.maybe_mime_type,
|
||||
|
||||
users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
@@ -339,9 +224,6 @@ SELECT
|
||||
|
||||
m.maybe_batch_token as `maybe_batch_token: tokens::tokens::batch_generations::BatchGenerationToken`,
|
||||
|
||||
m.maybe_style_transfer_source_media_file_token as `maybe_style_transfer_source_media_file_token: tokens::tokens::media_files::MediaFileToken`,
|
||||
m.maybe_scene_source_media_file_token as `maybe_scene_source_media_file_token: tokens::tokens::media_files::MediaFileToken`,
|
||||
|
||||
m.maybe_title,
|
||||
m.maybe_text_transcript,
|
||||
|
||||
@@ -361,55 +243,20 @@ SELECT
|
||||
m.is_user_upload,
|
||||
m.is_intermediate_system_file,
|
||||
|
||||
model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
model_weight_cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,
|
||||
model_weight_cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,
|
||||
model_weight_cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,
|
||||
|
||||
model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
model_weight_creator.username as maybe_model_weight_creator_username,
|
||||
model_weight_creator.display_name as maybe_model_weight_creator_display_name,
|
||||
model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,
|
||||
|
||||
m.extra_file_modification_info,
|
||||
|
||||
m.public_bucket_directory_hash,
|
||||
m.maybe_public_bucket_prefix,
|
||||
m.maybe_public_bucket_extension,
|
||||
|
||||
entity_stats.ratings_positive_count as maybe_ratings_positive_count,
|
||||
entity_stats.ratings_negative_count as maybe_ratings_negative_count,
|
||||
entity_stats.bookmark_count as maybe_bookmark_count,
|
||||
|
||||
featured_items.entity_token IS NOT NULL AS is_featured,
|
||||
|
||||
m.created_at,
|
||||
m.updated_at
|
||||
|
||||
FROM media_files AS m
|
||||
LEFT OUTER JOIN users
|
||||
ON m.maybe_creator_user_token = users.token
|
||||
LEFT OUTER JOIN model_weights
|
||||
ON m.maybe_origin_model_token = model_weights.token
|
||||
LEFT OUTER JOIN media_files as media_file_cover_image
|
||||
ON media_file_cover_image.token = m.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN media_files as model_weight_cover_image
|
||||
ON model_weight_cover_image.token = model_weights.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN users as model_weight_creator
|
||||
ON model_weight_creator.token = model_weights.creator_user_token
|
||||
LEFT OUTER JOIN entity_stats
|
||||
ON entity_stats.entity_type = "media_file"
|
||||
AND entity_stats.entity_token = m.token
|
||||
LEFT OUTER JOIN prompts
|
||||
ON prompts.token = m.maybe_prompt_token
|
||||
LEFT OUTER JOIN featured_items
|
||||
ON featured_items.entity_type = 'media_file'
|
||||
AND featured_items.entity_token = m.token
|
||||
AND featured_items.deleted_at IS NULL
|
||||
WHERE
|
||||
m.maybe_batch_token = ?
|
||||
"#,
|
||||
@@ -457,11 +304,6 @@ SELECT
|
||||
m.media_class as `media_class: enums::by_table::media_files::media_file_class::MediaFileClass`,
|
||||
m.media_type as `media_type: enums::by_table::media_files::media_file_type::MediaFileType`,
|
||||
|
||||
m.maybe_engine_category as `maybe_engine_category: enums::by_table::media_files::media_file_engine_category::MediaFileEngineCategory`,
|
||||
m.maybe_animation_type as `maybe_animation_type: enums::by_table::media_files::media_file_animation_type::MediaFileAnimationType`,
|
||||
|
||||
m.maybe_media_subtype as `maybe_media_subtype: enums::by_table::media_files::media_file_subtype::MediaFileSubtype`,
|
||||
|
||||
m.maybe_mime_type,
|
||||
|
||||
users.token as `maybe_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
@@ -473,10 +315,6 @@ SELECT
|
||||
|
||||
m.maybe_batch_token as `maybe_batch_token: tokens::tokens::batch_generations::BatchGenerationToken`,
|
||||
|
||||
m.maybe_style_transfer_source_media_file_token as `maybe_style_transfer_source_media_file_token: tokens::tokens::media_files::MediaFileToken`,
|
||||
m.maybe_scene_source_media_file_token as `maybe_scene_source_media_file_token: tokens::tokens::media_files::MediaFileToken`,
|
||||
|
||||
|
||||
m.maybe_title,
|
||||
m.maybe_text_transcript,
|
||||
|
||||
@@ -496,55 +334,20 @@ SELECT
|
||||
m.is_user_upload,
|
||||
m.is_intermediate_system_file,
|
||||
|
||||
model_weights.token as `maybe_model_weights_token: tokens::tokens::model_weights::ModelWeightToken`,
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
model_weights.weights_type as `maybe_model_weights_type: enums::by_table::model_weights::weights_types::WeightsType`,
|
||||
model_weights.weights_category as `maybe_model_weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,
|
||||
|
||||
model_weight_cover_image.public_bucket_directory_hash as maybe_model_cover_image_public_bucket_hash,
|
||||
model_weight_cover_image.maybe_public_bucket_prefix as maybe_model_cover_image_public_bucket_prefix,
|
||||
model_weight_cover_image.maybe_public_bucket_extension as maybe_model_cover_image_public_bucket_extension,
|
||||
|
||||
model_weight_creator.token as `maybe_model_weight_creator_user_token: tokens::tokens::users::UserToken`,
|
||||
model_weight_creator.username as maybe_model_weight_creator_username,
|
||||
model_weight_creator.display_name as maybe_model_weight_creator_display_name,
|
||||
model_weight_creator.email_gravatar_hash as maybe_model_weight_creator_gravatar_hash,
|
||||
|
||||
m.extra_file_modification_info,
|
||||
|
||||
m.public_bucket_directory_hash,
|
||||
m.maybe_public_bucket_prefix,
|
||||
m.maybe_public_bucket_extension,
|
||||
|
||||
entity_stats.ratings_positive_count as maybe_ratings_positive_count,
|
||||
entity_stats.ratings_negative_count as maybe_ratings_negative_count,
|
||||
entity_stats.bookmark_count as maybe_bookmark_count,
|
||||
|
||||
featured_items.entity_token IS NOT NULL AS is_featured,
|
||||
|
||||
m.created_at,
|
||||
m.updated_at
|
||||
|
||||
FROM media_files AS m
|
||||
LEFT OUTER JOIN users
|
||||
ON m.maybe_creator_user_token = users.token
|
||||
LEFT OUTER JOIN model_weights
|
||||
ON m.maybe_origin_model_token = model_weights.token
|
||||
LEFT OUTER JOIN media_files as media_file_cover_image
|
||||
ON media_file_cover_image.token = m.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN media_files as model_weight_cover_image
|
||||
ON model_weight_cover_image.token = model_weights.maybe_cover_image_media_file_token
|
||||
LEFT OUTER JOIN users as model_weight_creator
|
||||
ON model_weight_creator.token = model_weights.creator_user_token
|
||||
LEFT OUTER JOIN entity_stats
|
||||
ON entity_stats.entity_type = "media_file"
|
||||
AND entity_stats.entity_token = m.token
|
||||
LEFT OUTER JOIN prompts
|
||||
ON prompts.token = m.maybe_prompt_token
|
||||
LEFT OUTER JOIN featured_items
|
||||
ON featured_items.entity_type = 'media_file'
|
||||
AND featured_items.entity_token = m.token
|
||||
AND featured_items.deleted_at IS NULL
|
||||
WHERE
|
||||
m.maybe_batch_token = ?
|
||||
AND m.user_deleted_at IS NULL
|
||||
|
||||
+4
-90
@@ -25,6 +25,7 @@ pub struct ListBatchGeneratedMediaFilesSuccessResponse {
|
||||
|
||||
#[derive(Serialize, Deserialize, ToSchema)]
|
||||
pub struct BatchGeneratedMediaFileInfo {
|
||||
/// Primary key identifier
|
||||
pub token: MediaFileToken,
|
||||
|
||||
/// The coarse-grained class of media file: image, video, etc.
|
||||
@@ -66,96 +67,9 @@ pub struct BatchGeneratedMediaFileInfo {
|
||||
/// Measured in milliseconds.
|
||||
pub maybe_duration_millis: Option<u64>,
|
||||
|
||||
/// Created timestamp
|
||||
pub created_at: DateTime<Utc>,
|
||||
|
||||
/// Updated timestamp
|
||||
pub updated_at: DateTime<Utc>,
|
||||
|
||||
// /// Text transcripts for TTS, etc.
|
||||
// pub maybe_text_transcript: Option<String>,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// If this is an engine/3D asset, this is the broad category (scene,
|
||||
// /// animation, etc.) of that object.
|
||||
// /// This can also be used for filtering in list/batch endpoints.
|
||||
// pub maybe_engine_category: Option<MediaFileEngineCategory>,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// If this is an engine/3D asset for an animation or a rig that can
|
||||
// /// be animated with either (or both) skeletal or blend shape animations,
|
||||
// /// this describes the animation regime used or supported.
|
||||
// pub maybe_animation_type: Option<MediaFileAnimationType>,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// If the media file has a subtype, we'll report it.
|
||||
// /// This is mostly used for Bevy engine files.
|
||||
// #[deprecated(note="This was for the Bevy engine. Do not use.")]
|
||||
// pub maybe_media_subtype: Option<MediaFileSubtype>,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// Extension for the engine to load over remote:// URLs.
|
||||
// #[deprecated(note="This was for the Bevy engine. Do not use.")]
|
||||
// pub maybe_engine_extension: Option<String>,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// (DEPRECATED) URL path to the media file
|
||||
// #[deprecated(note="This field doesn't point to the full URL. Use media_links instead to leverage the CDN.")]
|
||||
// pub public_bucket_path: String,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// /// (DEPRECATED) Full URL to the media file
|
||||
// #[deprecated(note="This points to the bucket. Use media_links instead to leverage the CDN.")]
|
||||
// pub public_bucket_url: String,
|
||||
|
||||
// NB: This is in the old APIs, but it's irrelevant now.
|
||||
// // Provenance Data
|
||||
// pub origin_product: MediaFileOriginProductCategory,
|
||||
// pub origin_category: MediaFileOriginCategory,
|
||||
// pub maybe_origin_model_type: Option<MediaFileOriginModelType>,
|
||||
// pub maybe_origin_model_token: Option<String>,
|
||||
// pub maybe_origin_filename: Option<String>,
|
||||
|
||||
// /// Possible model info (if generated by inference)
|
||||
// pub maybe_model_weight_info: Option<ListBatchGeneratedMediaFilesModelInfo>,
|
||||
|
||||
// /// The file was uploaded by the user.
|
||||
// /// This does not include files generated on the client side, like studio renders.
|
||||
// pub is_user_upload: bool,
|
||||
|
||||
// /// The file was created by the system.
|
||||
// /// This includes files generated on the client side, like studio renders.
|
||||
// pub is_intermediate_system_file: bool,
|
||||
|
||||
// NB: Legacy baggage. Killing this field.
|
||||
// /// OPTIONAL. Details on live portrait generated media files,
|
||||
// /// if this is a live portrait generated file.
|
||||
// pub maybe_live_portrait_details: Option<MediaFileLivePortraitDetails>,
|
||||
|
||||
// NB: Legacy baggage. Killing this field.
|
||||
// /// For Comfy / Video Style Transfer jobs, this might include
|
||||
// /// the name of the selected style.
|
||||
// pub maybe_style_name: Option<StyleTransferName>,
|
||||
|
||||
// /// We can simulate media files for "tts_results" records.
|
||||
// /// If this is set as true, this informs the frontend and API callers not to treat
|
||||
// /// the token as a media file and improperly assume it can be used with the rest of
|
||||
// /// the media file APIs.
|
||||
// pub is_emulated_media_file: bool,
|
||||
|
||||
// /// Statistics about the media file
|
||||
// pub stats: SimpleEntityStats,
|
||||
}
|
||||
|
||||
// #[derive(Serialize, Deserialize, ToSchema)]
|
||||
// pub struct ListBatchGeneratedMediaFilesModelInfo {
|
||||
// pub weight_token: ModelWeightToken,
|
||||
// pub weight_type: PublicWeightsType,
|
||||
// pub weight_category: WeightsCategory,
|
||||
// pub title: String,
|
||||
//
|
||||
// /// 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.
|
||||
// pub maybe_cover_image_public_bucket_path: Option<String>,
|
||||
//
|
||||
// /// NB: Technically this shouldn't be a nullable field, but since there are so many
|
||||
// /// joins we'll relax that this must exist (for now).
|
||||
// pub maybe_weight_creator: Option<UserDetailsLight>,
|
||||
// }
|
||||
-64
@@ -107,28 +107,6 @@ pub async fn list_batch_generated_media_files_handler(
|
||||
result.maybe_public_bucket_prefix.as_deref(),
|
||||
result.maybe_public_bucket_extension.as_deref());
|
||||
|
||||
// let maybe_cover_image_public_bucket_path = match result.maybe_model_cover_image_public_bucket_hash
|
||||
// .as_deref()
|
||||
// {
|
||||
// None => None,
|
||||
// Some(hash) => Some(MediaFileBucketPath::from_object_hash(
|
||||
// &hash,
|
||||
// result.maybe_model_cover_image_public_bucket_prefix.as_deref(),
|
||||
// result.maybe_model_cover_image_public_bucket_extension.as_deref())
|
||||
// .get_full_object_path_str()
|
||||
// .to_string()
|
||||
// )
|
||||
// };
|
||||
|
||||
// // NB: Some engine pages will need to know the engine extension to load the file.
|
||||
// let maybe_engine_extension = match result.media_type {
|
||||
// MediaFileType::Bvh => Some(".bvh".to_string()),
|
||||
// MediaFileType::Glb => Some(".glb".to_string()),
|
||||
// MediaFileType::Gltf => Some(".gltf".to_string()),
|
||||
// MediaFileType::SceneRon => Some(".scn.ron".to_string()),
|
||||
// _ => None,
|
||||
// };
|
||||
|
||||
BatchGeneratedMediaFileInfo {
|
||||
token: result.token.clone(),
|
||||
media_class: result.media_class,
|
||||
@@ -155,48 +133,6 @@ pub async fn list_batch_generated_media_files_handler(
|
||||
maybe_duration_millis: result.maybe_duration_millis,
|
||||
created_at: result.created_at,
|
||||
updated_at: result.updated_at,
|
||||
// maybe_text_transcript: result.maybe_text_transcript,
|
||||
// maybe_live_portrait_details: result.extra_media_file_info
|
||||
// .as_ref()
|
||||
// .map(|info| MediaFileLivePortraitDetails::maybe_from_extra_info(&info))
|
||||
// .flatten(),
|
||||
// maybe_style_name: result.maybe_prompt_args
|
||||
// .as_ref()
|
||||
// .and_then(|args| args.style_name.as_ref())
|
||||
// .and_then(|style| style.to_style_name()),
|
||||
// public_bucket_path: public_bucket_path
|
||||
// .get_full_object_path_str()
|
||||
// .to_string(),
|
||||
// public_bucket_url: bucket_url_string_from_media_path(&public_bucket_path),
|
||||
// maybe_engine_category: result.maybe_engine_category,
|
||||
// maybe_animation_type: result.maybe_animation_type,
|
||||
// maybe_media_subtype: result.maybe_media_subtype,
|
||||
// maybe_engine_extension,
|
||||
// maybe_model_weight_info: match result.maybe_model_weights_token {
|
||||
// None => None,
|
||||
// Some(weight_token) => Some(ListBatchGeneratedMediaFilesModelInfo {
|
||||
// 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: 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,
|
||||
// maybe_weight_creator: UserDetailsLightBuilder::from_optional_db_fields_owned(
|
||||
// result.maybe_model_weight_creator_user_token,
|
||||
// result.maybe_model_weight_creator_username,
|
||||
// result.maybe_model_weight_creator_display_name,
|
||||
// result.maybe_model_weight_creator_gravatar_hash,
|
||||
// ),
|
||||
// })
|
||||
// },
|
||||
// is_user_upload: result.is_user_upload,
|
||||
// is_intermediate_system_file: result.is_intermediate_system_file,
|
||||
// is_emulated_media_file: false,
|
||||
// stats: SimpleEntityStats {
|
||||
// positive_rating_count: result.maybe_ratings_positive_count.unwrap_or(0),
|
||||
// bookmark_count: result.maybe_bookmark_count.unwrap_or(0),
|
||||
// },
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
Reference in new issue
Block a user