让 ui-design-doc 的参数说明真正进入工具 schema
agent_native_tools.rs 给 from-images 的 images 属性挂上 texts/ui-design-doc.json 里已写好的说明,run-workflow 与 into-js 改用带 description 的单字符串 schema 生成器 one_string_input_schema_with_description,原先这三条文案没有任何引用点,模型看不到
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user