区分识别工具调用缺失错误

恢复识别工具缺失的独立日志阶段和提示
This commit is contained in:
2026-09-18 16:20:49 +08:00
parent d370648867
commit 0988c4907a
@@ -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}",