diff --git a/frontend/libs/components/pagescene/src/lib/enums/ArtStyle.ts b/frontend/libs/components/pagescene/src/lib/enums/ArtStyle.ts new file mode 100644 index 0000000000..8c27e06564 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/ArtStyle.ts @@ -0,0 +1,35 @@ +export enum ArtStyle { + Anime2_5D = "anime_2_5d", + Anime2DFlat = "anime_2d_flat", + Cartoon3D = "cartoon_3d", + ComicBook = "comic_book", + AnimeGhibli = "anime_ghibli", + InkPunk = "ink_punk", + InkSplash = "ink_splash", + InkBWStyle = "ink_bw_style", + JojoStyle = "jojo_style", + PaperOrigami = "paper_origami", + PixelArt = "pixel_art", + PopArt = "pop_art", + Realistic1 = "realistic_1", + Realistic2 = "realistic_2", + AnimeRetroNeon = "anime_retro_neon", + AnimeStandard = "anime_standard", + HRGiger = "hr_giger", + Simpsons = "simpsons", + Carnage = "carnage", + PastelCuteAnime = "pastel_cute_anime", + Bloom = "bloom_lighting", + Horror2_5D = "25d_horror", + Creepy = "creepy", + CreepyVHS = "creepy_vhs", + TrailCamFootage = "trail_cam_footage", + OldBWMovie = "old_black_white_movie", + HorrorNoirBW = "horror_noir_black_white", + TechnoNoirBW = "techno_noir_black_white", + BW20s = "black_white_20s", + AnimeCyberpunk = "cyberpunk_anime", + Dragonball = "dragonball", + RealisticMatrix = "realistic_matrix", + RealisticCyberpunk = "realistic_cyberpunk", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/FetchStatus.ts b/frontend/libs/components/pagescene/src/lib/enums/FetchStatus.ts new file mode 100644 index 0000000000..514a96bb74 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/FetchStatus.ts @@ -0,0 +1,8 @@ +export enum FetchStatus { + PAUSED, + // ready triggers a new fetch + READY, + IN_PROGRESS, + SUCCESS, + ERROR, +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/GenerateTtsAudioErrorType.ts b/frontend/libs/components/pagescene/src/lib/enums/GenerateTtsAudioErrorType.ts new file mode 100644 index 0000000000..3823fcb569 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/GenerateTtsAudioErrorType.ts @@ -0,0 +1,7 @@ +export enum GenerateTtsAudioErrorType { + BadRequest = "bad_request", + NotFound = "not_found", + TooManyRequests = "too_many_requests", + ServerError = "server_error", + UnknownError = "unknown_error", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/JobState.ts b/frontend/libs/components/pagescene/src/lib/enums/JobState.ts new file mode 100644 index 0000000000..29552f48f2 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/JobState.ts @@ -0,0 +1,10 @@ +export enum JobState { + UNKNOWN = "unknown", // Only on frontend. + PENDING = "pending", + STARTED = "started", + COMPLETE_SUCCESS = "complete_success", + COMPLETE_FAILURE = "complete_failure", + ATTEMPT_FAILED = "attempt_failed", + DEAD = "dead", + CANCELED_BY_USER = "canceled_by_user", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/MediaFileClass.ts b/frontend/libs/components/pagescene/src/lib/enums/MediaFileClass.ts new file mode 100644 index 0000000000..1535b7472e --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/MediaFileClass.ts @@ -0,0 +1,26 @@ +export enum MediaFileClass { + /// Unknown (default value) + /// This will be present until we migrate all old files. + Unknown = "unknown", + + /// Audio files: wav, mp3, etc. + Audio = "audio", + + /// Image files: png, jpeg, etc. + Image = "image", + + /// Video files: mp4, etc. + Video = "video", + + /// Engine "animations" + Animation = "animation", + + /// Engine "characters" + Character = "character", + + /// Engine "prop" items + Prop = "prop", + + /// Engine scenes (internal and external scenes) + Scene = "scene", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/MediaFileType.ts b/frontend/libs/components/pagescene/src/lib/enums/MediaFileType.ts new file mode 100644 index 0000000000..12f5261c2f --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/MediaFileType.ts @@ -0,0 +1,61 @@ +export enum MediaFileType { + Audio = "audio", + Video = "video", + Image = "image", + + // BVH is a very popular file format for motion capture. + // It is compatible with our engine. + BVH = "bvh", + + // GLTF is the text-based format of GLB. Unforunately it requires a + // second file to include the visual data, so we strongly discourage + // the use of this format in favor of GLB. + GLTF = "gltf", + + // GLB is the format we convert FBX files into. It's a very popular + // open source 3D file format. + GLB = "glb", + + // SPLAT file type. SPZ format is a compressed and smaller format. + SPZ = "spz", + + // MMD is the format for anime characters. + // open source 3D file format. + MMD = "mmd", + + // FBX isn't supported by Storyteller Engine, but we can get + // uploads in this format. It's a very popular 3D graphics format. + FBX = "fbx", + + // Full Storyteller Engine scenes (RON = Rusty Object Notation) + // This is a temporary format that will eventually go away. + Scene = "scene", + + None = "none", +} + +export enum MediaFileSubtype { + /// Animation file from Mixamo + /// Primarily used for FBX and GLB. + Mixamo = "mixamo", + + /// Animation file from MocapNet + /// Primarily used for BVH. + MocapNet = "mocap_net", + + /// Generic animation case + /// Used for BVH files, but can also pertain to animation-only files of other types. + AnimationOnly = "animation_only", + + // TODO(bt,2024-03-08): Migrate records and code, then remove + /// DEPRECATED: Use `SceneImport` instead. + Scene = "scene", + + /// Generic 3D scene file. + /// Can pertain to glTF, glB, FBX, etc. + SceneImport = "scene_import", + + /// Native Storyteller scene format. + /// Typically stored in a `.scn.ron` file. + StorytellerScene = "storyteller_scene", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/Visibility.ts b/frontend/libs/components/pagescene/src/lib/enums/Visibility.ts new file mode 100644 index 0000000000..a0f80fa4e9 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/Visibility.ts @@ -0,0 +1,5 @@ +export enum Visibility { + Public = "public", + Hidden = "hidden", + Private = "private", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/WeightCategory.ts b/frontend/libs/components/pagescene/src/lib/enums/WeightCategory.ts new file mode 100644 index 0000000000..834ed7b43f --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/WeightCategory.ts @@ -0,0 +1,8 @@ +export enum WeightCategory { + TTS = "text_to_speech", + VOCODER = "vocoder", + VC = "voice_conversion", + ZS = "zero_shot", + SD = "image_generation", + WF = "workflow_config", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/WeightType.ts b/frontend/libs/components/pagescene/src/lib/enums/WeightType.ts new file mode 100644 index 0000000000..246e7ca6b1 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/enums/WeightType.ts @@ -0,0 +1,11 @@ +export enum WeightType { + TT2 = "tt2", + HIFIGAN_TT2 = "hifigan_tt2", + RVCv2 = "rvc_v2", + SD_15 = "sd_1.5", + SDXL = "sdxl", + SVC = "so_vits_svc", + LORA = "loRA", + VALL_E = "vall_e", + NONE = "none", +} diff --git a/frontend/libs/components/pagescene/src/lib/enums/index.ts b/frontend/libs/components/pagescene/src/lib/enums/index.ts index 8e4116a013..4639ab1ee2 100644 --- a/frontend/libs/components/pagescene/src/lib/enums/index.ts +++ b/frontend/libs/components/pagescene/src/lib/enums/index.ts @@ -2,3 +2,12 @@ export * from "./AssetType"; export * from "./AssetFilterOption"; export * from "./ClipGroup"; export * from "./EditorState"; +export * from "./ArtStyle"; +export * from "./FetchStatus"; +export * from "./GenerateTtsAudioErrorType"; +export * from "./JobState"; +export * from "./MediaFileClass"; +export * from "./MediaFileType"; +export * from "./Visibility"; +export * from "./WeightCategory"; +export * from "./WeightType"; diff --git a/frontend/libs/components/pagescene/src/lib/models/index.ts b/frontend/libs/components/pagescene/src/lib/models/index.ts index 4ccdc7c5c5..5a7bc7458c 100644 --- a/frontend/libs/components/pagescene/src/lib/models/index.ts +++ b/frontend/libs/components/pagescene/src/lib/models/index.ts @@ -1 +1,6 @@ export * from "./assets"; +export * from "./mediaInfo"; +export * from "./pagination"; +export * from "./prompts"; +export * from "./types"; +export * from "./userBookmark"; diff --git a/frontend/libs/components/pagescene/src/lib/models/mediaInfo.ts b/frontend/libs/components/pagescene/src/lib/models/mediaInfo.ts new file mode 100644 index 0000000000..860d375e9a --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/mediaInfo.ts @@ -0,0 +1,95 @@ +import { UserDetailsLight } from "./types"; + +import { + MediaFileClass, + MediaFileSubtype, + MediaFileType, + WeightCategory, + WeightType, +} from "../enums"; + +export interface MediaInfo { + token: string; + media_type: MediaFileType; + media_class: MediaFileClass | null; + maybe_animation_type: string | null; + maybe_media_subtype: MediaFileSubtype | null; + maybe_engine_extension: string | null; + maybe_batch_token: string; + maybe_original_filename: string | null; + maybe_creator_user: UserDetailsLight | null; + maybe_prompt_token: string | null; + origin: { + origin_category: string; + product_category: string; + maybe_model: { title: string } | null; + }; + origin_category: string; + origin_product_category: string; + maybe_origin_model_type: null | string; + maybe_origin_model_token: null | string; + maybe_duration_millis: number | null; + maybe_style_name: null | string; + public_bucket_path: string; + cover_image: { + maybe_cover_image_public_bucket_path: null | string; + default_cover: { + image_index: number; + color_index: number; + }; + }; + creator_set_visibility: string; + maybe_title: null | string; + maybe_text_transcript: null | string; + stats: { + positive_rating_count: number; + bookmark_count: number; + }; + maybe_model_weight_info: { + title: string; + weight_token: string; + weight_category: WeightCategory; + weight_type: WeightType; + maybe_weight_creator: UserDetailsLight; + maybe_cover_image_public_bucket_path: string; + }; + created_at: string; + updated_at: string; +} + +export interface MaybeResult { + entity_token: string; + entity_type: string; + maybe_public_bucket_media_path: string; + maybe_successfully_completed_at: string; +} + +export interface Request { + inference_category: string; + maybe_model_title: string; + maybe_model_token: string; + maybe_model_type: string; + maybe_raw_inference_text: string; + maybe_style_name: string; +} + +export interface Status { + attempt_count: number; + maybe_assigned_cluster: string; + maybe_assigned_worker: string; + maybe_extra_status_description: string; + maybe_failure_category: string; + progress_percentage: number; + maybe_first_started_at: string; + requires_keepalive: boolean; + status: string; +} + +export interface ActiveJob { + created_at: string; + job_token: string; + maybe_result: MaybeResult; + request: Request; + status: Status; + updated_at: string; +} diff --git a/frontend/libs/components/pagescene/src/lib/models/pagination.ts b/frontend/libs/components/pagescene/src/lib/models/pagination.ts new file mode 100644 index 0000000000..8481f8c54e --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/pagination.ts @@ -0,0 +1,9 @@ +export interface Pagination { + current: number; + total_page_count: number; +} +export interface PaginationInfinite { + cursor_is_reversed: boolean; + maybe_next?: string; + maybe_previous?: string; +} diff --git a/frontend/libs/components/pagescene/src/lib/models/prompts.ts b/frontend/libs/components/pagescene/src/lib/models/prompts.ts new file mode 100644 index 0000000000..fafe2fd394 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/prompts.ts @@ -0,0 +1,16 @@ +export interface Prompts { + created_at: string; + lcm_disabled: boolean; + lipsync_enabled: boolean; + maybe_inference_duration_millis: number; + maybe_moderator_fields: string; + maybe_negative_prompt: string; + maybe_positive_prompt: string; + maybe_strength: number; + maybe_style_name: string; + prompt_type: string; + token: string; + use_cinematic: boolean; + used_face_detailer: boolean; + used_upscaler: boolean; +} diff --git a/frontend/libs/components/pagescene/src/lib/models/sceneGenerationMetadata.ts b/frontend/libs/components/pagescene/src/lib/models/sceneGenerationMetadata.ts new file mode 100644 index 0000000000..f915f4c844 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/sceneGenerationMetadata.ts @@ -0,0 +1,6 @@ +import { CameraAspectRatio } from "../enums"; + +export interface SceneGenereationMetaData { + positivePrompt: string; + cameraAspectRatio: CameraAspectRatio; +} diff --git a/frontend/libs/components/pagescene/src/lib/models/types.tsx b/frontend/libs/components/pagescene/src/lib/models/types.tsx new file mode 100644 index 0000000000..1729deecfe --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/types.tsx @@ -0,0 +1,89 @@ +/// A common type returned by several endpoints. +/// Basic information to display a user and their avatar. +import { + MediaFileClass, + MediaFileSubtype, + MediaFileType, + WeightCategory, + WeightType, +} from "../enums"; +import { MediaInfo } from "./mediaInfo"; +import { Pagination } from "./pagination"; + +export interface UserDetailsLight { + user_token: string; + /// Username (lowercase) + username: string; + /// Username with user-specified capitalization + display_name: string; + gravatar_hash: string; + default_avatar: DefaultAvatarInfo; +} + +export interface DefaultAvatarInfo { + image_index: number; + color_index: number; +} + +export interface MediaFile { + token: string; + media_type: MediaFileType; + media_class: MediaFileClass | null; + maybe_media_subtype: MediaFileSubtype | null; + public_bucket_path: string; + maybe_engine_extension: string | null; + maybe_batch_token: string; + maybe_title: string | null; + maybe_original_filename: string | null; + maybe_creator_user: UserDetailsLight | null; + maybe_prompt_token: string | null; + creator_set_visibility: string; + created_at: Date; + updated_at: Date; + maybe_model_weight_info: { + title: string; + weight_token: string; + weight_category: WeightCategory; + weight_type: WeightType; + maybe_weight_creator: UserDetailsLight; + maybe_cover_image_public_bucket_path: string; + }; +} +export interface GetMediaListResponse { + pagination: Pagination; + success: boolean; + results: MediaInfo[]; +} + +export interface GetMediaFileResponse { + success: boolean; + media_file?: MediaFile; +} + +export interface VoiceConversionModelListItem { + token: string; + model_type: string; + title: string; + + creator: CreatorDetails; + creator_set_visibility: string; + + ietf_language_tag: string; + ietf_primary_language_subtag: string; + is_front_page_featured: boolean; + + created_at: string; + updated_at: string; +} + +export interface CreatorDetails { + user_token: string; + username: string; + display_name: string; + gravatar_hash: string; +} + +export interface VoiceConversionModelListResponse { + success: boolean; + models: Array; +} diff --git a/frontend/libs/components/pagescene/src/lib/models/userBookmark.ts b/frontend/libs/components/pagescene/src/lib/models/userBookmark.ts new file mode 100644 index 0000000000..2477ffae53 --- /dev/null +++ b/frontend/libs/components/pagescene/src/lib/models/userBookmark.ts @@ -0,0 +1,75 @@ +export interface UserBookmarkBatch { + entity_token: string; + entity_type: string; + is_bookmarked: boolean; + maybe_bookmark_token: string; +} + +interface DefaultAvatar { + color_index: number; + image_index: number; +} + +interface User { + default_avatar: DefaultAvatar; + display_name: string; + gravatar_hash: string; + user_token: string; + username: string; +} + +export interface UserBookmarkByEntity { + created_at: string; + token: string; + updated_at: string; + user: User; +} + +interface DefaultAvatar { + color_index: number; + image_index: number; +} + +interface Creator { + default_avatar: DefaultAvatar; + display_name: string; + gravatar_hash: string; + user_token: string; + username: string; +} + +interface MediaFileData { + maybe_creator: Creator; + media_type: string; // Adjust type as per your specific schema + public_bucket_path: string; +} + +interface WeightData { + maybe_cover_image_public_bucket_path: string; + maybe_creator: Creator; + title: string; + weight_category: string; // Adjust type as per your specific schema + weight_type: string; // Adjust type as per your specific schema +} + +interface Stats { + bookmark_count: number; + positive_rating_count: number; +} + +interface Details { + entity_token: string; + entity_type: string; // Adjust type as per your specific schema + maybe_media_file_data?: MediaFileData; + maybe_summary_text?: string; + maybe_thumbnail_url?: string; + maybe_weight_data?: WeightData; + stats: Stats; +} + +export interface UserBookmarkByUser { + created_at: string; + details: Details; + token: string; + updated_at: string; +}