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 }