fix: error raise status code not exist (#888)

This commit is contained in:
takatost 2023-08-17 15:33:35 +08:00 committed by GitHub
parent cd78adb0ab
commit 0cc0b6e052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,10 @@ class SparkLLMClient:
data = json.loads(message)
code = data['header']['code']
if code != 0:
self.queue.put({'error': f"Code: {code}, Error: {data['header']['message']}"})
self.queue.put({
'status_code': 400,
'error': f"Code: {code}, Error: {data['header']['message']}"
})
ws.close()
else:
choices = data["payload"]["choices"]