From 0e15d76046387923859da65b901de628e848b711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 24 Sep 2026 15:58:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=20ui-design-doc=20=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AF=B4=E6=98=8E=E7=9C=9F=E6=AD=A3=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=20schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit agent_native_tools.rs 给 from-images 的 images 属性挂上 texts/ui-design-doc.json 里已写好的说明,run-workflow 与 into-js 改用带 description 的单字符串 schema 生成器 one_string_input_schema_with_description,原先这三条文案没有任何引用点,模型看不到 --- .../src-tauri/src/agent_native_tools.rs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/ai-game-creator-shell/src-tauri/src/agent_native_tools.rs b/apps/ai-game-creator-shell/src-tauri/src/agent_native_tools.rs index 3dc11e007..8b24b0cfc 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/agent_native_tools.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/agent_native_tools.rs @@ -1172,6 +1172,7 @@ fn runtime_tool_input_schema(tool: &str) -> Value { "type": "array", "minItems": 1, "maxItems": 4, + "description": prompt_text!("uiDesignDoc.from_images.parameters.images"), "items": { "type": "object", "required": ["assetId", "path"], @@ -1184,8 +1185,14 @@ fn runtime_tool_input_schema(tool: &str) -> Value { } } }), - "ui-design-doc.run-workflow" => one_string_input_schema("designDocAssetId"), - "ui-design-doc.into-js" => one_string_input_schema("designDocAssetId"), + "ui-design-doc.run-workflow" => one_string_input_schema_with_description( + "designDocAssetId", + prompt_text!("uiDesignDoc.run_workflow.parameters.designDocAssetId"), + ), + "ui-design-doc.into-js" => one_string_input_schema_with_description( + "designDocAssetId", + prompt_text!("uiDesignDoc.into_js.parameters.designDocAssetId"), + ), "project.search" => json!({ "type": "object", "required": ["query", "path", "maxResults", "caseSensitive"], "additionalProperties": false, "properties": { @@ -1505,6 +1512,16 @@ fn one_string_input_schema(field: &str) -> Value { }) } +/// 与 `one_string_input_schema` 同形,但把文案里的参数说明挂到字段上。 +fn one_string_input_schema_with_description(field: &str, description: &str) -> Value { + json!({ + "type": "object", + "required": [field], + "additionalProperties": false, + "properties": { (field): { "type": "string", "description": description } } + }) +} + fn two_string_input_schema(first: &str, second: &str) -> Value { json!({ "type": "object",