Skip to content

Commit 074b3c9

Browse files
committed
explicitly declare default value
1 parent b8e8457 commit 074b3c9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

request_llms/bridge_chatgpt.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,13 @@ def predict_no_ui_long_connection(inputs:str, llm_kwargs:dict, history:list=[],
202202
if (time.time()-observe_window[1]) > watch_dog_patience:
203203
raise RuntimeError("用户取消了程序。")
204204
else: raise RuntimeError("意外Json结构:"+delta)
205-
finish_reason = json_data.get('finish_reason') if json_data else None
205+
206+
finish_reason = json_data.get('finish_reason', None) if json_data else None
206207
if finish_reason == 'content_filter':
207208
raise RuntimeError("由于提问含不合规内容被过滤。")
208209
if finish_reason == 'length':
209210
raise ConnectionAbortedError("正常结束,但显示Token不足,导致输出不完整,请削减单次输入的文本量。")
211+
210212
return result
211213

212214

0 commit comments

Comments
 (0)