mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
rename, cleanup
This commit is contained in:
1 parent
a389cc31cf
commit
97cf0677cf
5 files changed
+23
-20
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -18,10 +18,10 @@ pub struct CreateCharacterRequest {
|
||||
pub image_media_token: MediaFileToken,
|
||||
|
||||
/// Name of the character.
|
||||
pub name: Option<String>,
|
||||
pub character_name: String,
|
||||
|
||||
/// Description of the character.
|
||||
pub description: Option<String>,
|
||||
pub character_description: Option<String>,
|
||||
}
|
||||
|
||||
/// Response body for creating a character.
|
||||
|
||||
+6
-6
@@ -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()),
|
||||
);
|
||||
|
||||
|
||||
+11
-8
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user