From 7a8a798e713e0544e9194603b3b4dc38a7a3dc66 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 6 Sep 2026 21:23:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(platform):=20=E6=96=87=E6=A1=A3=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=B8=BAint/float=E7=9A=84=E5=8F=82=E6=95=B0=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E5=8A=A0|int/|float=E5=BC=BA=E8=BD=AC=E2=80=94?= =?UTF-8?q?=E2=80=94=E8=A1=A8=E5=8D=95/agent=E4=BC=A0=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E6=95=B0=E5=AD=97(=E5=A6=82duration=3D'5')tojson?= =?UTF-8?q?=E5=87=BA=E5=B8=A6=E5=BC=95=E5=8F=B7=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E8=A2=ABDashScope=E6=8B=92InvalidParameter(2026-09-06=E7=9C=9F?= =?UTF-8?q?=E5=AE=9E=E8=B0=83=E7=94=A8=E5=AE=9E=E6=8A=93);bool=E6=98=AFint?= =?UTF-8?q?=E5=AD=90=E7=B1=BB=E9=A1=BB=E5=85=88=E6=8E=92=E9=99=A4=E9=81=BF?= =?UTF-8?q?=E5=85=8DUI=E7=9C=9F=E5=80=BC=E8=AF=AD=E4=B9=89=E8=A2=AB?= =?UTF-8?q?=E6=94=B9=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_platform/platform_ability.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pipeline_platform/platform_ability.py b/pipeline_platform/platform_ability.py index 850797a..3ce7ef7 100644 --- a/pipeline_platform/platform_ability.py +++ b/pipeline_platform/platform_ability.py @@ -1165,8 +1165,21 @@ def _tpl_from_example(example, capability): if v == '' or v is None: out[k] = _put('{{ params.%s|tojson }}' % k) # 无示例值:调用必传 else: - out[k] = _put('{{ params.%s|default(%s)|tojson }}' - % (k, json.dumps(v, ensure_ascii=False))) + # 数值强转(2026-09-06 真实调用实抓):wan3.0 零媒体 t2v 提交 + # 报 InvalidParameter "Input should be a valid integer: + # parameters.duration"——params 来自表单/agent 时常为字符串 "5", + # 直接 tojson 出 "5"(带引号)被 API 拒。文档示例是 int/float 的 + # 参数按示例类型强转,字符串数字也能落到正确 JSON 类型。 + # bool 是 int 子类须先排除(bool 不加 |int,避免 UI 真值语义被改写)。 + coerce = '' + if isinstance(v, bool): + pass + elif isinstance(v, int): + coerce = '|int' + elif isinstance(v, float): + coerce = '|float' + out[k] = _put('{{ (params.%s|default(%s))%s|tojson }}' + % (k, json.dumps(v, ensure_ascii=False), coerce)) return out body = walk(tree)