From 899a591cda4203a891a5483775180be6f5e60f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Fri, 18 Sep 2026 16:23:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E8=AF=AD=E4=B9=89=E5=BB=BA?= =?UTF-8?q?=E8=AE=AE=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20=E6=81=A2=E5=A4=8D=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=9A=84=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E9=98=B6=E6=AE=B5=E5=92=8C=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui_editor/commands/ui_design_suggestion.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/ui_design_suggestion.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/ui_design_suggestion.rs index 749c12f0f..b32c6f448 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/ui_design_suggestion.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/ui_design_suggestion.rs @@ -1,8 +1,8 @@ use crate::config::build_game_creator_llm_client_from_llm_config; use crate::config::load_game_creator_app_config; use crate::ui_editor::commands::utils::{ - read_ui_reference_image_data_url, request_ui_editor_llm, required_tool_arguments, - strict_json_schema, + parse_limited_llm_tool_arguments, read_ui_reference_image_data_url, request_ui_editor_llm, + required_tool_call_arguments, strict_json_schema, }; use crate::ui_editor::resource::ui_design_image::UIDesignImageRole; use crate::ui_editor::state::State; @@ -214,11 +214,17 @@ pub(crate) async fn suggest_ui_design_semantic_impl( !response.text.trim().is_empty(), response.tool_calls.len() ); - let arguments = - required_tool_arguments(&response, "suggest_ui_design_semantics").map_err(|error| { - app_log!("ui_design_suggestion.error stage=parse_arguments error={error}"); - format!("LLM 响应无效(详情:UI 语义建议工具参数无效:{error})") + let arguments = required_tool_call_arguments(&response, "suggest_ui_design_semantics") + .map_err(|error| { + app_log!( + "ui_design_suggestion.error stage=parse_tool_call reason=missing_tool_call error={error}" + ); + "LLM 响应无效(详情:未返回 suggest_ui_design_semantics 工具调用)".to_string() })?; + let arguments = parse_limited_llm_tool_arguments(arguments).map_err(|error| { + app_log!("ui_design_suggestion.error stage=parse_arguments error={error}"); + format!("LLM 响应无效(详情:UI 语义建议工具参数无效:{error})") + })?; validate_suggestion_response_shape(&arguments).map_err(|error| { app_log!("ui_design_suggestion.error stage=validate_arguments error={error}"); format!("LLM 响应无效(详情:{error})")