From 0988c4907a72e4a4fad903a65af6bfab2880872b 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:20:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BA=E5=88=86=E8=AF=86=E5=88=AB=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E8=B0=83=E7=94=A8=E7=BC=BA=E5=A4=B1=E9=94=99=E8=AF=AF?= =?UTF-8?q?=20=E6=81=A2=E5=A4=8D=E8=AF=86=E5=88=AB=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=9A=84=E7=8B=AC=E7=AB=8B=E6=97=A5=E5=BF=97?= =?UTF-8?q?=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 --- .../src/ui_editor/commands/recognition.rs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition.rs index 039679e31..c2f21bfe1 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/recognition.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::component::{Component, NodeComponent}; use crate::ui_editor::layout::children_display_mode::ChildrenDisplayMode; @@ -770,14 +770,24 @@ pub(crate) async fn recognize_ui_impl_with_provider( !response.text.trim().is_empty(), response.tool_calls.len() ); - let arguments = - required_tool_arguments(&response, "recognize_ui_structure").map_err(|error| { + let arguments = required_tool_call_arguments(&response, "recognize_ui_structure") + .map_err(|error| { app_log!( - "ui_recognition.error stage=parse_arguments root={} error={error}", + "ui_recognition.error stage=parse_tool_call reason=missing_tool_call root={} error={error}", root_id.as_str() ); - format!("根界面图 {} 的识别工具参数无效:{error}", root_id.as_str()) + format!( + "LLM 未返回 recognize_ui_structure 工具调用(根界面图 {})", + root_id.as_str() + ) })?; + let arguments = parse_limited_llm_tool_arguments(arguments).map_err(|error| { + app_log!( + "ui_recognition.error stage=parse_arguments root={} error={error}", + root_id.as_str() + ); + format!("根界面图 {} 的识别工具参数无效:{error}", root_id.as_str()) + })?; validate_recognition_response_shape(&arguments).map_err(|error| { app_log!( "ui_recognition.error stage=validate_arguments root={} error={error}",