From 62bc591f80ad7f753812f129f2b8a37089369860 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 6 Sep 2026 15:22:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(platform):=20r2v=E7=A4=BA=E4=BE=8B=E6=97=A0?= =?UTF-8?q?=E5=8F=82=E8=80=83=E5=AA=92=E4=BD=93=E6=97=B6=E6=8C=89DashScope?= =?UTF-8?q?=E5=AE=B6=E6=97=8F=E5=A5=91=E7=BA=A6=E5=90=88=E6=88=90input.med?= =?UTF-8?q?ia=E4=B8=89=E6=95=B0=E7=BB=84(reference=5Fimage/video/audio?= =?UTF-8?q?=E8=87=AA=E7=94=B1=E7=BB=84=E5=90=88,=E5=AE=98=E6=96=B9API?= =?UTF-8?q?=E5=8F=82=E8=80=83=E7=A1=AE=E8=AF=81)=E2=80=94=E2=80=94?= =?UTF-8?q?=E7=BA=AF=E6=96=87=E6=9C=AC=E7=A4=BA=E4=BE=8B=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E5=8F=AA=E6=8A=A5=E8=AD=A6,=E7=94=A8=E6=88=B7=E5=A1=AB?= =?UTF-8?q?=E5=8F=82=E8=80=83=E5=AA=92=E4=BD=93=E5=8D=B3=E5=8F=AF=E5=8F=91?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_platform/platform_ability.py | 32 +++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/pipeline_platform/platform_ability.py b/pipeline_platform/platform_ability.py index dbba64e..bef389f 100644 --- a/pipeline_platform/platform_ability.py +++ b/pipeline_platform/platform_ability.py @@ -1226,8 +1226,36 @@ def _gen_templates(protocol: str, capability: str, spec: dict) -> dict: if rnote: notes.append(rnote) if not media_params and capability in _MEDIA_INPUT_CAPS: - notes.append("能力 %s 通常需要输入媒体,但文档示例未见上传字段——" - "模板未生成媒体参数,请核对文档" % capability) + if capability == 'r2v' and (example or {}).get('input') is not None: + # 页面示例是纯文本最简形态(SPA 懒加载抓不到完整示例,wan3.0-video-prime + # 实测:概述明写"四模态全能参考"、示例只有 input.prompt)——r2v 必有 + # 参考媒体,DashScope 家族契约是 input.media 数组 [{type,url}], + # 类型集 image→reference_image / video→reference_video / audio→reference_audio。 + # 复用 _media_array_expr(e2e 验证过的 namespace 混合类型写法)按契约 + # 合成三数组,比只报警更有用:用户填了参考媒体就能发出去。 + # 如实注明合成来源,不假装是文档确证。 + try: + import re as _re + synth = [{'type': 'reference_image', 'url': 'https://synth.invalid/ref.jpg'}, + {'type': 'reference_video', 'url': 'https://synth.invalid/ref.mp4'}, + {'type': 'reference_audio', 'url': 'https://synth.invalid/ref.mp3'}] + expr, mps = _media_array_expr(synth) + m = _re.search(r'("input"\s*:\s*\{)', req) + if expr and m: + pos = m.end() + req = req[:pos] + '"media": %s, ' % expr + req[pos:] + for mp in mps: + if mp not in media_params: + media_params.append(mp) + notes.append("示例未见参考媒体(页面示例为纯文本最简形态)," + "r2v 契约合成 input.media 数组(reference_image/" + "video/audio 三类,DashScope 家族契约)——" + "建议对照供应商 API 参考页人工核对") + except Exception as _e: + notes.append("r2v 媒体合成失败(%s),示例未见上传字段,请人工核对" % str(_e)[:80]) + else: + notes.append("能力 %s 通常需要输入媒体,但文档示例未见上传字段——" + "模板未生成媒体参数,请核对文档" % capability) else: resp = json.dumps({"content": "{{ text }}"}, ensure_ascii=False) # field_enums:文档参数说明表里的可选值(提取层逐字照抄),驱动 code 下拉