From 19a0dea943372cbcb224ec2237f2638991867227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 1 Sep 2026 10:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=20UI=20Editor=20=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E4=B8=8E=E6=8E=A8?= =?UTF-8?q?=E7=90=86=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为 binding、merge、recognition 和语义建议补齐配置加载与客户端构建阶段日志。 让 Agent Runtime UI Editor 请求应用全局 reasoning_effort,并纳入请求快照与重试指纹。 保留现有未暂存的环境与 npm 文件改动。 --- .../src-tauri/src/agent.rs | 1 + .../src/ui_editor/commands/binding.rs | 17 ++++++++++++---- .../src-tauri/src/ui_editor/commands/merge.rs | 16 ++++++++++----- .../src/ui_editor/commands/recognition.rs | 20 ++++++++++++------- .../commands/ui_design_suggestion.rs | 7 ++++++- .../src-tauri/src/ui_editor/commands/utils.rs | 4 ++-- 6 files changed, 46 insertions(+), 19 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent.rs b/apps/ai-game-creator-shell/src-tauri/src/agent.rs index bc2bedb87..bb0f70aee 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent.rs @@ -73,6 +73,7 @@ pub(crate) async fn request_game_creator_ui_editor_llm_at( .with_api_kind(api_kind) .with_model(config.llm.model.clone()) .with_request_timeout_ms(config.llm.request_timeout_ms); + let request = apply_game_creator_llm_reasoning_effort(request, &config.llm)?; let snapshot = { let _lock = acquire_game_creator_agent_runtime_project_write_lock_with_wait( root, diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/binding.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/binding.rs index 0b4ae9764..8ede8b652 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/binding.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/binding.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::{ - parse_limited_llm_tool_arguments, read_ui_reference_image_data_url, - request_ui_editor_llm, strict_json_schema, + parse_limited_llm_tool_arguments, read_ui_reference_image_data_url, request_ui_editor_llm, + strict_json_schema, }; use crate::ui_editor::component::text::FontSource; use crate::ui_editor::component::Component; @@ -346,8 +346,17 @@ pub(crate) async fn bind_components_impl_with_provider( parts.push(LlmMessageContentPart::InputImage { image_url }); } let (llm, client) = if provider_identity.is_none() { - let llm = load_game_creator_app_config()?.llm; - let client = build_game_creator_llm_client_from_llm_config(&llm, "llm")?; + let llm = load_game_creator_app_config() + .map_err(|error| { + eprintln!("ui_binding.error stage=build_client error={error}"); + error + })? + .llm; + let client = + build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { + eprintln!("ui_binding.error stage=build_client error={error}"); + error + })?; (Some(llm), Some(client)) } else { (None, None) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/merge.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/merge.rs index 66074cd69..4b9852063 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/merge.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/merge.rs @@ -430,11 +430,17 @@ pub(crate) async fn merge_ui_impl_with_provider( return Err(format!("UI 合并输入超过 {MAX_MERGE_INPUT_BYTES} 字节上限")); } let (llm, client) = if provider_identity.is_none() { - let llm = load_game_creator_app_config()?.llm; - let client = build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { - eprintln!("ui_merge.error stage=build_client error={error}"); - error - })?; + let llm = load_game_creator_app_config() + .map_err(|error| { + eprintln!("ui_merge.error stage=build_client error={error}"); + error + })? + .llm; + let client = + build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { + eprintln!("ui_merge.error stage=build_client error={error}"); + error + })?; (Some(llm), Some(client)) } else { (None, None) 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 e3138d43b..408b95e4e 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::{ - parse_limited_llm_tool_arguments, read_ui_reference_image_data_url, - request_ui_editor_llm, strict_json_schema, + parse_limited_llm_tool_arguments, read_ui_reference_image_data_url, request_ui_editor_llm, + strict_json_schema, }; use crate::ui_editor::layout::children_display_mode::ChildrenDisplayMode; use crate::ui_editor::layout::control_layout::ControlLayout; @@ -611,11 +611,17 @@ pub(crate) async fn recognize_ui_impl_with_provider( return Err("至少需要一张可作为识别上下文根的界面图".to_string()); } let (llm, client) = if provider_identity.is_none() { - let llm = load_game_creator_app_config()?.llm; - let client = build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { - eprintln!("ui_recognition.error stage=build_client error={error}"); - error - })?; + let llm = load_game_creator_app_config() + .map_err(|error| { + eprintln!("ui_recognition.error stage=build_client error={error}"); + error + })? + .llm; + let client = + build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { + eprintln!("ui_recognition.error stage=build_client error={error}"); + error + })?; (Some(llm), Some(client)) } else { (None, None) 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 7e22a61b1..2bb51d67b 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 @@ -174,7 +174,12 @@ pub(crate) async fn suggest_ui_design_semantic_impl( }); parts.push(LlmMessageContentPart::InputImage { image_url }); } - let llm = load_game_creator_app_config()?.llm; + let llm = load_game_creator_app_config() + .map_err(|error| { + eprintln!("ui_design_suggestion.error stage=build_client error={error}"); + error + })? + .llm; let client = build_game_creator_llm_client_from_llm_config(&llm, "llm").map_err(|error| { eprintln!("ui_design_suggestion.error stage=build_client error={error}"); error diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/utils.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/utils.rs index b706b7288..4faa40579 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/utils.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/utils.rs @@ -20,8 +20,8 @@ pub(crate) async fn request_ui_editor_llm( let request = request.with_api_kind( parse_game_creator_llm_api_kind(&llm.api_kind).map_err(LlmError::InvalidConfig)?, ); - let request = apply_game_creator_llm_reasoning_effort(request, llm) - .map_err(LlmError::InvalidConfig)?; + let request = + apply_game_creator_llm_reasoning_effort(request, llm).map_err(LlmError::InvalidConfig)?; request_game_creator_llm_text(client, llm, request).await }