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