Merge pull request #1641 from xinnan-tech/py_tts_listen

update:修复部分doubaoasr出现400错误的问题
This commit is contained in:
欣南科技
2025-06-20 17:20:51 +08:00
committed by GitHub
@@ -254,7 +254,6 @@ class ASRProvider(ASRProviderBase):
"X-Api-Access-Key": self.access_token,
"X-Api-Resource-Id": "volc.bigasr.sauc.duration",
"X-Api-Connect-Id": str(uuid.uuid4()),
"Host": "openspeech.bytedance.com",
}
def generate_header(
@@ -310,7 +309,11 @@ class ASRProvider(ASRProviderBase):
code = int.from_bytes(res[4:8], "big", signed=False)
msg_length = int.from_bytes(res[8:12], "big", signed=False)
error_msg = json.loads(res[12:].decode("utf-8"))
return {"code": code, "msg_length": msg_length, "payload_msg": error_msg}
return {
"code": code,
"msg_length": msg_length,
"payload_msg": error_msg,
}
# 获取JSON数据(跳过12字节头部)
try: