mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-27 04:49:47 +01:00
update:修复部分doubaoasr出现400错误的问题
This commit is contained in:
parent
09f6605cfe
commit
879c1267b6
1 changed files with 5 additions and 2 deletions
|
|
@ -254,7 +254,6 @@ class ASRProvider(ASRProviderBase):
|
||||||
"X-Api-Access-Key": self.access_token,
|
"X-Api-Access-Key": self.access_token,
|
||||||
"X-Api-Resource-Id": "volc.bigasr.sauc.duration",
|
"X-Api-Resource-Id": "volc.bigasr.sauc.duration",
|
||||||
"X-Api-Connect-Id": str(uuid.uuid4()),
|
"X-Api-Connect-Id": str(uuid.uuid4()),
|
||||||
"Host": "openspeech.bytedance.com",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def generate_header(
|
def generate_header(
|
||||||
|
|
@ -310,7 +309,11 @@ class ASRProvider(ASRProviderBase):
|
||||||
code = int.from_bytes(res[4:8], "big", signed=False)
|
code = int.from_bytes(res[4:8], "big", signed=False)
|
||||||
msg_length = int.from_bytes(res[8:12], "big", signed=False)
|
msg_length = int.from_bytes(res[8:12], "big", signed=False)
|
||||||
error_msg = json.loads(res[12:].decode("utf-8"))
|
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字节头部)
|
# 获取JSON数据(跳过12字节头部)
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue