From 1517730c8b05130ca12ccb584b1426ab98ed31c9 Mon Sep 17 00:00:00 2001 From: GinHa <15201596918@163.com> Date: Mon, 6 Jul 2026 15:47:44 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=9F=E4=BA=BA=E7=B4=A0=E6=9D=90=E5=BA=93?= =?UTF-8?q?=E6=8E=88=E6=9D=83BUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/private_portrait/ark_client.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/video-gen-api/app/services/private_portrait/ark_client.py b/video-gen-api/app/services/private_portrait/ark_client.py index fe59f17e..e5ce0463 100644 --- a/video-gen-api/app/services/private_portrait/ark_client.py +++ b/video-gen-api/app/services/private_portrait/ark_client.py @@ -136,12 +136,20 @@ class ArkPrivateAssetClient: 10, 60, ) - api_info = {action.value: ApiInfo("POST", "/", f"Action={action.value}&Version={ARK_PRIVATE_PORTRAIT_VERSION}", {}, {})} + # volcengine SDK 的 ApiInfo.query 必须是 dict,不能传 "Action=xxx&Version=xxx" 字符串。 + # 否则 Service.merge() 会按 dict 下标读取字符串,触发: + # TypeError: string indices must be integers, not 'str'。 + api_info = { + action.value: ApiInfo( + "POST", + "/", + {"Action": action.value, "Version": ARK_PRIVATE_PORTRAIT_VERSION}, + {}, + {}, + ) + } service = Service(service_info, api_info) - try: - raw = service.json(action.value, {}, json.dumps(payload, ensure_ascii=False, separators=(",", ":"))) - except TypeError: - raw = service.json(action.value, {}, payload) + raw = service.json(action.value, {}, payload) resp = self._normalize_response(raw) metadata = resp.get("ResponseMetadata") if isinstance(resp, dict) else None