历史上的今天,带图片

This commit is contained in:
Your Name
2023-03-29 12:21:47 +08:00
parent 6d852d76b0
commit 881132557e
2 changed files with 5 additions and 4 deletions

View File

@@ -83,7 +83,8 @@ def predict_no_ui_long_connection(inputs, top_p, temperature, history=[], sys_pr
except StopIteration: break
if len(chunk)==0: continue
if not chunk.startswith('data:'):
raise ConnectionAbortedError("OpenAI返回了错误:" + chunk)
chunk = get_full_error(chunk.encode('utf8'), stream_response)
raise ConnectionAbortedError("OpenAI拒绝了请求:" + chunk.decode())
delta = json.loads(chunk.lstrip('data:'))['choices'][0]["delta"]
if len(delta) == 0: break
if "role" in delta: continue