refactor(tool): flatten request body parameters for model exposure

- Refactor the extraction logic in tool service to flatten request body parameters into independent arguments exposed to the model.
This commit is contained in:
wxy
2026-04-24 18:49:55 +08:00
parent 21eb500680
commit f63bcd6321
2 changed files with 22 additions and 3 deletions

View File

@@ -815,11 +815,12 @@ class ToolService:
"default": param_info.get("default")
})
# 请求体参数
# 请求体参数 — _extract_request_body 返回 {"schema": {...}, "required": bool, ...}
request_body = operation.get("request_body")
if request_body:
schema_props = request_body.get("schema", {}).get("properties", {})
required_props = request_body.get("schema", {}).get("required", [])
body_schema = request_body.get("schema", {})
schema_props = body_schema.get("properties", {})
required_props = body_schema.get("required", [])
for prop_name, prop_schema in schema_props.items():
parameters.append({