Spaces:
Runtime error
Runtime error
添加结束的情况
Browse files
request_llm/bridge_chatgpt.py
CHANGED
@@ -85,6 +85,7 @@ def predict_no_ui_long_connection(inputs, llm_kwargs, history=[], sys_prompt="",
|
|
85 |
raise ConnectionAbortedError("OpenAI拒绝了请求:" + error_msg)
|
86 |
else:
|
87 |
raise RuntimeError("OpenAI拒绝了请求:" + error_msg)
|
|
|
88 |
json_data = json.loads(chunk.lstrip('data:'))['choices'][0]
|
89 |
delta = json_data["delta"]
|
90 |
if len(delta) == 0: break
|
|
|
85 |
raise ConnectionAbortedError("OpenAI拒绝了请求:" + error_msg)
|
86 |
else:
|
87 |
raise RuntimeError("OpenAI拒绝了请求:" + error_msg)
|
88 |
+
if ('data: [DONE]' in chunk): break # api2d 正常完成
|
89 |
json_data = json.loads(chunk.lstrip('data:'))['choices'][0]
|
90 |
delta = json_data["delta"]
|
91 |
if len(delta) == 0: break
|