Switch to VectorEngine gpt-image-2 and edits

Replace uses of the legacy `gpt-image-2-all` model with `gpt-image-2` and standardize image workflows: no-reference generation uses POST /v1/images/generations, any-reference flows use POST /v1/images/edits with multipart `image` parts. Update SKILLs, generation scripts, decision logs, and docs to reflect the contract change and edits-vs-generations guidance. Apply corresponding changes across backend (api-server match3d/puzzle modules, openai image adapter, mappers, telemetry, spacetime client/module), frontend components and services (Match3D, Puzzle, CreativeImageInputPanel, runtime shells), and add new spritesheet/parser files and tests. Also add media/logo.png. These changes align repository code and documentation with the VectorEngine image API contract and update generation/upload handling (green-screen -> alpha processing, spritesheet handling, and related tests).
This commit is contained in:
2026-05-22 03:06:41 +08:00
parent 321e1ea33a
commit ae014ac881
90 changed files with 7078 additions and 3389 deletions

View File

@@ -419,12 +419,12 @@ pub fn resolve_match3d_item_type_count_for_difficulty(clear_count: u32, difficul
8 => 3,
12 => 9,
16 => 15,
20 | 21 => 21,
20 | 21 => 20,
_ => match difficulty {
0..=2 => 3,
3..=4 => 9,
5..=6 => 15,
_ => 21,
_ => 20,
},
};
@@ -432,8 +432,8 @@ pub fn resolve_match3d_item_type_count_for_difficulty(clear_count: u32, difficul
}
pub fn normalize_match3d_runtime_clear_count(clear_count: u32, difficulty: u32) -> u32 {
// 中文注释:旧硬核草稿曾保存 clear_count=20新硬核固定 21 种物品
// 运行态也升到 21 组三消,避免出现 20 组却要求 21 种素材的不可达状态
// 中文注释:旧硬核草稿曾保存 clear_count=20运行态保留硬核 21 组三消节奏
// 但本局物品类型池仍由难度映射到最多 20 种,避免超过 10*10 Sprite 解析素材上限
if clear_count == 20 && difficulty >= 7 {
21
} else {
@@ -885,7 +885,7 @@ mod tests {
}
#[test]
fn legacy_hardcore_clear_count_runs_as_twenty_one_groups() {
fn legacy_hardcore_clear_count_runs_with_twenty_item_types() {
let run = start_run_with_seed_at(
"run-types-legacy-hardcore".to_string(),
"user-1".to_string(),
@@ -903,8 +903,8 @@ mod tests {
assert_eq!(run.clear_count, 21);
assert_eq!(run.total_item_count, 63);
assert_eq!(counts.len(), 21);
assert!(counts.values().all(|count| *count == 3));
assert_eq!(counts.len(), 20);
assert_eq!(counts.values().sum::<u32>(), 63);
}
#[test]
@@ -931,8 +931,8 @@ mod tests {
}
#[test]
fn size_tier_plan_follows_ratio_for_twenty_five_types() {
let plan = resolve_size_tier_plan(25);
fn size_tier_plan_follows_ratio_for_twenty_types() {
let plan = resolve_size_tier_plan(20);
let mut counts = BTreeMap::<&str, usize>::new();
for rule in plan {
*counts.entry(rule.tier).or_default() += 1;
@@ -946,10 +946,10 @@ mod tests {
}
}
assert_eq!(counts.get("XL"), Some(&5));
assert_eq!(counts.get("L"), Some(&8));
assert_eq!(counts.get("M"), Some(&7));
assert_eq!(counts.get("XS"), Some(&4));
assert_eq!(counts.get("XL"), Some(&4));
assert_eq!(counts.get("L"), Some(&6));
assert_eq!(counts.get("M"), Some(&6));
assert_eq!(counts.get("XS"), Some(&3));
assert_eq!(counts.get("S"), Some(&1));
}
@@ -962,7 +962,7 @@ mod tests {
&test_config(30),
42,
1_000,
Some(25),
Some(20),
)
.expect("run should start");
@@ -974,7 +974,7 @@ mod tests {
.push((item.radius * 10_000.0).round() as u32);
}
assert_eq!(radii_by_visual_key.len(), 25);
assert_eq!(radii_by_visual_key.len(), 20);
assert!(
radii_by_visual_key
.values()
@@ -1052,7 +1052,7 @@ mod tests {
.filter(|item| {
let dx = item.x - MATCH3D_BOARD_CENTER;
let dy = item.y - MATCH3D_BOARD_CENTER;
(dx * dx + dy * dy).sqrt() > 0.32
(dx * dx + dy * dy).sqrt() > 0.26
})
.count();
let mut quadrants = BTreeMap::<String, u32>::new();
@@ -1081,15 +1081,15 @@ mod tests {
}
#[test]
fn twenty_five_or_less_does_not_repeat_visual_keys() {
fn twenty_or_less_does_not_repeat_visual_keys() {
let run = start_run_with_seed_at_and_item_type_count(
"run-block-unique".to_string(),
"user-1".to_string(),
"profile-1".to_string(),
&test_config(25),
&test_config(20),
27,
1_000,
Some(25),
Some(20),
)
.expect("run should start");
@@ -1098,7 +1098,7 @@ mod tests {
*counts.entry(item.visual_key.clone()).or_default() += 1;
}
assert_eq!(counts.len(), 25);
assert_eq!(counts.len(), 20);
assert!(counts.values().all(|count| *count == 3));
}

View File

@@ -9,8 +9,8 @@ pub const MATCH3D_WORK_ID_PREFIX: &str = "match3d-work-";
pub const MATCH3D_RUN_ID_PREFIX: &str = "match3d-run-";
pub const MATCH3D_TRAY_SLOT_COUNT: u32 = 7;
pub const MATCH3D_ITEMS_PER_CLEAR: u32 = 3;
pub const MATCH3D_MAX_ITEM_TYPE_COUNT: u32 = 25;
pub(crate) const MATCH3D_MAX_ITEM_TYPE_COUNT_USIZE: usize = 25;
pub const MATCH3D_MAX_ITEM_TYPE_COUNT: u32 = 20;
pub(crate) const MATCH3D_MAX_ITEM_TYPE_COUNT_USIZE: usize = 20;
pub const MATCH3D_MIN_DIFFICULTY: u32 = 1;
pub const MATCH3D_MAX_DIFFICULTY: u32 = 10;
pub const MATCH3D_DEFAULT_DURATION_LIMIT_MS: u64 = 10 * 60 * 1000;
@@ -18,8 +18,7 @@ pub const MATCH3D_BOARD_CENTER: f32 = 0.5;
pub const MATCH3D_BOARD_RADIUS: f32 = 0.5;
pub const MATCH3D_BOARD_SAFE_MARGIN: f32 = 0.035;
// 中文注释:首版 demo 不接真实图片生成,当前先用程序化积木件作为稳定可辨认的默认素材
// 中文注释:当前 demo 使用 25 个积木件作为默认可消除物资源池,前端据 visual_key 程序化生成 3D 模型。
// 中文注释:默认资源池对齐抓大鹅 10*10 物品 Sprite 的 20 种物品上限
pub(crate) const MATCH3D_BLOCK_VISUAL_KEYS: [&str; MATCH3D_MAX_ITEM_TYPE_COUNT_USIZE] = [
"block-red-2x4",
"block-blue-1x2",
@@ -29,19 +28,14 @@ pub(crate) const MATCH3D_BLOCK_VISUAL_KEYS: [&str; MATCH3D_MAX_ITEM_TYPE_COUNT_U
"block-white-1x1",
"block-black-1x8",
"block-tan-2x3",
"block-lime-1x2",
"block-darkred-2x2",
"block-blue-1x4",
"block-pink-2x4",
"block-gray-1x6",
"block-lavender-tile-2x2",
"block-teal-tile-1x3",
"block-mint-tile-1x4",
"block-magenta-tile-2x2",
"block-orange-tile-2x2-stud",
"block-purple-slope-1x2",
"block-brown-slope-1x2",
"block-sky-slope-2x2",
"block-green-cylinder",
"block-clear-ring",
"block-mint-arch",