From d014cb1d064077e962305ddc852d9fbb5791410f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 5 Sep 2026 13:24:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E8=81=94=E5=90=88=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=8B=AC=E7=AB=8B=E7=B4=A0=E6=9D=90=E6=80=BB=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将单次识别绑定请求的独立素材数量限制为128个 --- .../src/ui_editor/commands/recognition_and_binding.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition_and_binding.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition_and_binding.rs index 667ae50cd..9f39bb140 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition_and_binding.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition_and_binding.rs @@ -25,6 +25,7 @@ use std::path::Path; use ts_rs::TS; const MAX_REFERENCES: usize = 4; +const MAX_SPRITE_ASSETS: usize = 128; const MAX_RECOGNITION_TREE_NODES: usize = 512; const MAX_RECOGNITION_TREE_DEPTH: usize = 32; const LEGACY_RECOGNITION_SYSTEM_PROMPT: &str = r#" @@ -627,6 +628,12 @@ pub(crate) async fn recognition_and_binding_impl_with_provider( if state.ui_design_images.len() > MAX_REFERENCES { return Err("界面图最多 4 张".to_string()); } + if state.sprite_assets.len() > MAX_SPRITE_ASSETS { + return Err(format!( + "独立素材最多 {MAX_SPRITE_ASSETS} 个,当前为 {} 个", + state.sprite_assets.len() + )); + } let mut context_ids = state.ui_design_images.keys().cloned().collect::>(); context_ids.sort_by(|left, right| { let left_is_page = state