feat: unify creation entry templates
This commit is contained in:
@@ -102,6 +102,18 @@ pub const UNIFIED_CREATION_FIELD_KINDS: [&str; 4] = ["text", "select", "image",
|
||||
|
||||
pub fn build_phase1_unified_creation_spec(play_id: &str) -> Option<UnifiedCreationSpecResponse> {
|
||||
let (workspace_stage, generation_stage, result_stage, fields) = match play_id {
|
||||
"rpg" => (
|
||||
"agent-workspace",
|
||||
"custom-world-generating",
|
||||
"custom-world-result",
|
||||
vec![unified_creation_field("message", "text", "创作想法", true)],
|
||||
),
|
||||
"big-fish" => (
|
||||
"big-fish-agent-workspace",
|
||||
"big-fish-generating",
|
||||
"big-fish-result",
|
||||
vec![unified_creation_field("message", "text", "玩法想法", true)],
|
||||
),
|
||||
"puzzle" => (
|
||||
"puzzle-agent-workspace",
|
||||
"puzzle-generating",
|
||||
@@ -147,6 +159,62 @@ pub fn build_phase1_unified_creation_spec(play_id: &str) -> Option<UnifiedCreati
|
||||
unified_creation_field("floatingWords", "text", "功德有什么", true),
|
||||
],
|
||||
),
|
||||
"square-hole" => (
|
||||
"square-hole-agent-workspace",
|
||||
"square-hole-generating",
|
||||
"square-hole-result",
|
||||
vec![unified_creation_field("message", "text", "玩法想法", true)],
|
||||
),
|
||||
"bark-battle" => (
|
||||
"bark-battle-workspace",
|
||||
"bark-battle-generating",
|
||||
"bark-battle-result",
|
||||
vec![
|
||||
unified_creation_field("title", "text", "作品标题", true),
|
||||
unified_creation_field("themeDescription", "text", "主题/场景描述", true),
|
||||
unified_creation_field(
|
||||
"playerImageDescription",
|
||||
"text",
|
||||
"玩家形象描述",
|
||||
true,
|
||||
),
|
||||
unified_creation_field(
|
||||
"opponentImageDescription",
|
||||
"text",
|
||||
"对手形象描述",
|
||||
true,
|
||||
),
|
||||
unified_creation_field("onomatopoeia", "text", "拟声词", false),
|
||||
unified_creation_field("difficultyPreset", "select", "难度", true),
|
||||
],
|
||||
),
|
||||
"visual-novel" => (
|
||||
"visual-novel-agent-workspace",
|
||||
"visual-novel-generating",
|
||||
"visual-novel-result",
|
||||
vec![
|
||||
unified_creation_field("ideaText", "text", "一句话创作", true),
|
||||
unified_creation_field("visualStyleId", "select", "视觉画风", true),
|
||||
],
|
||||
),
|
||||
"baby-object-match" => (
|
||||
"baby-object-match-workspace",
|
||||
"baby-object-match-generating",
|
||||
"baby-object-match-result",
|
||||
vec![
|
||||
unified_creation_field("itemAName", "text", "物品 A", true),
|
||||
unified_creation_field("itemBName", "text", "物品 B", true),
|
||||
],
|
||||
),
|
||||
"creative-agent" => (
|
||||
"creative-agent-workspace",
|
||||
"puzzle-generating",
|
||||
"puzzle-result",
|
||||
vec![
|
||||
unified_creation_field("message", "text", "创作想法", true),
|
||||
unified_creation_field("referenceImage", "image", "参考图", false),
|
||||
],
|
||||
),
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
@@ -268,7 +336,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn phase1_unified_creation_specs_cover_four_templates() {
|
||||
fn phase1_unified_creation_specs_cover_existing_templates() {
|
||||
let puzzle = build_phase1_unified_creation_spec("puzzle").expect("puzzle spec");
|
||||
assert_eq!(puzzle.fields[0].id, "pictureDescription");
|
||||
assert_eq!(puzzle.fields[1].kind, "image");
|
||||
@@ -300,8 +368,25 @@ mod tests {
|
||||
let wooden_fish =
|
||||
build_phase1_unified_creation_spec("wooden-fish").expect("wooden-fish spec");
|
||||
assert!(wooden_fish.fields.iter().any(|field| field.kind == "audio"));
|
||||
assert!(build_phase1_unified_creation_spec("visual-novel").is_none());
|
||||
assert!(build_phase1_unified_creation_spec("bark-battle").is_none());
|
||||
|
||||
let visual_novel =
|
||||
build_phase1_unified_creation_spec("visual-novel").expect("visual-novel spec");
|
||||
assert_eq!(visual_novel.workspace_stage, "visual-novel-agent-workspace");
|
||||
|
||||
let bark_battle =
|
||||
build_phase1_unified_creation_spec("bark-battle").expect("bark-battle spec");
|
||||
assert_eq!(bark_battle.generation_stage, "bark-battle-generating");
|
||||
|
||||
let baby_object_match = build_phase1_unified_creation_spec("baby-object-match")
|
||||
.expect("baby-object-match spec");
|
||||
assert_eq!(
|
||||
baby_object_match
|
||||
.fields
|
||||
.iter()
|
||||
.filter(|field| field.kind == "text")
|
||||
.count(),
|
||||
2
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user