Fix fetchgptresponse_stream parsing file error
Browse files- response.py +4 -4
response.py
CHANGED
@@ -72,10 +72,10 @@ async def fetch_gpt_response_stream(client, url, headers, payload):
|
|
72 |
if response.status_code != 200:
|
73 |
print("请求失败,状态码是", response.status_code)
|
74 |
error_message = await response.aread()
|
75 |
-
error_str = error_message.decode('utf-8', errors='replace')
|
76 |
-
error_json = json.loads(error_str)
|
77 |
-
print(json.dumps(error_json, indent=4, ensure_ascii=False))
|
78 |
-
yield {"error": f"HTTP Error {response.status_code}", "details":
|
79 |
buffer = ""
|
80 |
async for chunk in response.aiter_text():
|
81 |
# print(chunk)
|
|
|
72 |
if response.status_code != 200:
|
73 |
print("请求失败,状态码是", response.status_code)
|
74 |
error_message = await response.aread()
|
75 |
+
# error_str = error_message.decode('utf-8', errors='replace')
|
76 |
+
# error_json = json.loads(error_str)
|
77 |
+
# print(json.dumps(error_json, indent=4, ensure_ascii=False))
|
78 |
+
yield {"error": f"fetch_gpt_response_stream HTTP Error {response.status_code}", "details": error_message.decode('utf-8', errors='replace')}
|
79 |
buffer = ""
|
80 |
async for chunk in response.aiter_text():
|
81 |
# print(chunk)
|