From 97cf0677cfcce2f3034aff995c22bcf79066e652 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 2 Apr 2026 20:14:25 -0400 Subject: [PATCH] rename, cleanup --- .../2026-04-02-083548-0000_characters/up.sql | 4 ++-- .../characters/characters.sql | 4 ++-- .../src/characters/create_character.rs | 4 ++-- .../characters/create_pending_character.rs | 12 ++++++------ .../characters/create_character_handler.rs | 19 +++++++++++-------- 5 files changed, 23 insertions(+), 20 deletions(-) diff --git a/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql b/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql index 6676eb0140..dfdf7cbf74 100644 --- a/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql +++ b/_database/sql/migrations/2026-04-02-083548-0000_characters/up.sql @@ -22,7 +22,7 @@ CREATE TABLE characters ( -- ========== CHARACTER DETAILS ========== -- User's display name for the character. - name VARCHAR(255) NOT NULL, + character_name VARCHAR(255) NOT NULL, -- Optional user description of the character. maybe_description VARCHAR(512) DEFAULT NULL, @@ -60,7 +60,7 @@ CREATE TABLE characters ( -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. -- The name used by the third party. -- Important for Kinovi since characters are referenced by name in prompts. - kinovi_name VARCHAR(255) DEFAULT NULL, + kinovi_character_name VARCHAR(255) DEFAULT NULL, -- TEMPORARY FOR GOING FAST : -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. diff --git a/_database/sql/migrations_squashed/characters/characters.sql b/_database/sql/migrations_squashed/characters/characters.sql index 16f77f252b..88c045fc4e 100644 --- a/_database/sql/migrations_squashed/characters/characters.sql +++ b/_database/sql/migrations_squashed/characters/characters.sql @@ -25,7 +25,7 @@ CREATE TABLE characters ( -- ========== CHARACTER DETAILS ========== -- Display name for the character. - name VARCHAR(255) NOT NULL, + character_name VARCHAR(255) NOT NULL, -- Optional description of the character. maybe_description VARCHAR(512) DEFAULT NULL, @@ -63,7 +63,7 @@ CREATE TABLE characters ( -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. -- The name used by the third party. -- Important for Kinovi since characters are referenced by name in prompts. - kinovi_name VARCHAR(255) DEFAULT NULL, + kinovi_character_name VARCHAR(255) DEFAULT NULL, -- TEMPORARY FOR GOING FAST : -- IDEALLY WE MOVE THIS TO A SEPARATE TABLE. diff --git a/crates/api_clients/artcraft/artcraft_api_defs/src/characters/create_character.rs b/crates/api_clients/artcraft/artcraft_api_defs/src/characters/create_character.rs index dfb98cb64a..bfec60e703 100644 --- a/crates/api_clients/artcraft/artcraft_api_defs/src/characters/create_character.rs +++ b/crates/api_clients/artcraft/artcraft_api_defs/src/characters/create_character.rs @@ -18,10 +18,10 @@ pub struct CreateCharacterRequest { pub image_media_token: MediaFileToken, /// Name of the character. - pub name: Option, + pub character_name: String, /// Description of the character. - pub description: Option, + pub character_description: Option, } /// Response body for creating a character. diff --git a/crates/schema/database/mysql_queries/src/queries/characters/create_pending_character.rs b/crates/schema/database/mysql_queries/src/queries/characters/create_pending_character.rs index 40ae148577..27afd60895 100644 --- a/crates/schema/database/mysql_queries/src/queries/characters/create_pending_character.rs +++ b/crates/schema/database/mysql_queries/src/queries/characters/create_pending_character.rs @@ -17,7 +17,7 @@ pub struct CreatePendingCharacterArgs<'e, 'c, E> pub character_type: CharacterType, /// User's display name for the character (truncated to 255 chars by caller). - pub name: &'e str, + pub character_name: &'e str, /// Optional user description (truncated to 512 chars by caller). pub maybe_description: Option<&'e str>, @@ -35,7 +35,7 @@ pub struct CreatePendingCharacterArgs<'e, 'c, E> pub kinovi_character_id: &'e str, /// The name Kinovi assigned to the character. - pub kinovi_name: &'e str, + pub kinovi_character_name: &'e str, /// Our inference job token for tracking the character creation. pub maybe_generic_inference_job_token: Option<&'e InferenceJobToken>, @@ -62,7 +62,7 @@ SET token = ?, character_type = ?, is_active = false, - name = ?, + character_name = ?, maybe_description = ?, maybe_avatar_media_token = NULL, maybe_full_image_media_token = NULL, @@ -70,19 +70,19 @@ SET maybe_creator_user_token = ?, creator_ip_address = ?, kinovi_character_id = ?, - kinovi_name = ?, + kinovi_character_name = ?, maybe_kinovi_asset_id = NULL, maybe_generic_inference_job_token = ? "#, token.as_str(), args.character_type.to_str(), - args.name, + args.character_name, args.maybe_description, args.maybe_original_upload_media_token.map(|t| t.as_str()), args.maybe_creator_user_token.map(|t| t.as_str()), args.creator_ip_address, args.kinovi_character_id, - args.kinovi_name, + args.kinovi_character_name, args.maybe_generic_inference_job_token.map(|t| t.as_str()), ); diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/characters/create_character_handler.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/characters/create_character_handler.rs index 024ebd4ce3..0a2b69047d 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/characters/create_character_handler.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/characters/create_character_handler.rs @@ -81,9 +81,10 @@ pub async fn create_character_handler( } // For now we use the model name as the character name and description. - let name = request.name.clone().unwrap_or_else(|| format!("{:?} Character", request.model)); - let name = truncate_string(&name, MAX_NAME_LENGTH); - let description = request.description; + let character_name = request.character_name.clone(); + let character_name = truncate_string(&character_name, MAX_NAME_LENGTH); + let character_description = request.character_description.as_deref() + .map(|desc| desc.trim()); // --- Look up the image media file --- @@ -127,8 +128,10 @@ pub async fn create_character_handler( let gen_result = generate_character(GenerateCharacterArgs { session: &session, - name: name.clone(), - description: description.clone().unwrap_or_else(|| "".to_string()), + name: character_name.clone(), + description: character_description + .map(|d| d.to_string()) + .unwrap_or_else(|| "".to_string()), reference_image_url: seedance_image_url, is_public: false, host_override: None, @@ -160,13 +163,13 @@ pub async fn create_character_handler( let character_token = create_pending_character(CreatePendingCharacterArgs { character_type: CharacterType::KinoviSeedance, - name: &name, - maybe_description: description.as_deref(), + character_name: &character_name, + maybe_description: character_description, maybe_original_upload_media_token: Some(&request.image_media_token), maybe_creator_user_token: Some(user_token), creator_ip_address: &ip_address, kinovi_character_id: &gen_result.character_id, - kinovi_name: &gen_result.name, + kinovi_character_name: &gen_result.name, maybe_generic_inference_job_token: Some(&apriori_job_token), mysql_executor: &mut *transaction, phantom: PhantomData,