feat: refine wooden fish runtime generation
This commit is contained in:
@@ -90,6 +90,9 @@ pub struct WoodenFishActionRequest {
|
||||
#[serde(default, skip_deserializing)]
|
||||
pub hit_object_asset: Option<WoodenFishImageAsset>,
|
||||
#[serde(default)]
|
||||
#[serde(skip_deserializing)]
|
||||
pub background_asset: Option<WoodenFishImageAsset>,
|
||||
#[serde(default)]
|
||||
pub hit_sound_prompt: Option<String>,
|
||||
#[serde(default)]
|
||||
pub hit_sound_asset: Option<WoodenFishAudioAsset>,
|
||||
@@ -123,6 +126,8 @@ pub struct WoodenFishDraftResponse {
|
||||
#[serde(default)]
|
||||
pub hit_object_asset: Option<WoodenFishImageAsset>,
|
||||
#[serde(default)]
|
||||
pub background_asset: Option<WoodenFishImageAsset>,
|
||||
#[serde(default)]
|
||||
pub hit_sound_asset: Option<WoodenFishAudioAsset>,
|
||||
#[serde(default)]
|
||||
pub cover_image_src: Option<String>,
|
||||
@@ -185,6 +190,8 @@ pub struct WoodenFishWorkProfileResponse {
|
||||
pub summary: WoodenFishWorkSummaryResponse,
|
||||
pub draft: WoodenFishDraftResponse,
|
||||
pub hit_object_asset: WoodenFishImageAsset,
|
||||
#[serde(default)]
|
||||
pub background_asset: Option<WoodenFishImageAsset>,
|
||||
pub hit_sound_asset: WoodenFishAudioAsset,
|
||||
pub floating_words: Vec<String>,
|
||||
}
|
||||
@@ -365,6 +372,18 @@ mod tests {
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
}),
|
||||
background_asset: Some(WoodenFishImageAsset {
|
||||
asset_id: "background-1".to_string(),
|
||||
image_src: "/generated-wooden-fish-assets/profile/background/image.png"
|
||||
.to_string(),
|
||||
image_object_key: "generated-wooden-fish-assets/profile/background/image.png"
|
||||
.to_string(),
|
||||
asset_object_id: "background-object-1".to_string(),
|
||||
generation_provider: "image2".to_string(),
|
||||
prompt: "赛博莲花背景".to_string(),
|
||||
width: 1024,
|
||||
height: 1536,
|
||||
}),
|
||||
hit_sound_prompt: Some("短促木鱼声".to_string()),
|
||||
hit_sound_asset: Some(WoodenFishAudioAsset {
|
||||
asset_id: "sound-1".to_string(),
|
||||
@@ -386,6 +405,7 @@ mod tests {
|
||||
payload["hitObjectAsset"]["imageObjectKey"],
|
||||
json!("generated-wooden-fish-assets/profile/hit-object/image.png")
|
||||
);
|
||||
assert_eq!(payload["backgroundAsset"]["height"], json!(1536));
|
||||
assert_eq!(payload["hitSoundAsset"]["source"], json!("upload"));
|
||||
assert_eq!(payload["hitSoundAsset"]["durationMs"], json!(800));
|
||||
}
|
||||
@@ -464,11 +484,13 @@ mod tests {
|
||||
hit_sound_prompt: Some("清脆木鱼".to_string()),
|
||||
floating_words: vec!["功德".to_string()],
|
||||
hit_object_asset: Some(image.clone()),
|
||||
background_asset: None,
|
||||
hit_sound_asset: Some(audio.clone()),
|
||||
cover_image_src: Some(image.image_src.clone()),
|
||||
generation_status: WoodenFishGenerationStatus::Ready,
|
||||
},
|
||||
hit_object_asset: image,
|
||||
background_asset: None,
|
||||
hit_sound_asset: audio,
|
||||
floating_words: vec!["功德".to_string()],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user