新增谷歌学术统合小助手

This commit is contained in:
Your Name
2023-04-07 23:54:24 +08:00
parent 7f1c7ebd68
commit 6b5c2538cf
3 changed files with 116 additions and 1 deletions

View File

@@ -104,7 +104,10 @@ def predict_no_ui_long_connection(inputs, top_p, temperature, history=[], sys_pr
result = ''
while True:
try: chunk = next(stream_response).decode()
except StopIteration: break
except StopIteration:
break
except requests.exceptions.ConnectionError:
chunk = next(stream_response).decode() # 失败了,重试一次?再失败就没办法了。
if len(chunk)==0: continue
if not chunk.startswith('data:'):
error_msg = get_full_error(chunk.encode('utf8'), stream_response).decode()