统一 UI Editor 请求错误日志与推理参数
为 binding、merge、recognition 和语义建议补齐配置加载与客户端构建阶段日志。 让 Agent Runtime UI Editor 请求应用全局 reasoning_effort,并纳入请求快照与重试指纹。 保留现有未暂存的环境与 npm 文件改动。
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user