From 84ccc9e64c0f8be1f2f5c0ad6ef3fbdfa4935fc1 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Sun, 17 Mar 2024 14:53:28 +0800 Subject: [PATCH] fix claude + oneapi error --- request_llms/bridge_chatgpt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/request_llms/bridge_chatgpt.py b/request_llms/bridge_chatgpt.py index c0e831d..3b1aec6 100644 --- a/request_llms/bridge_chatgpt.py +++ b/request_llms/bridge_chatgpt.py @@ -126,9 +126,9 @@ def predict_no_ui_long_connection(inputs, llm_kwargs, history=[], sys_prompt="", json_data = chunkjson['choices'][0] delta = json_data["delta"] if len(delta) == 0: break - if "role" in delta: continue - if "content" in delta: - if delta["content"] is None: continue + if (not has_content) and has_role: continue + if (not has_content) and (not has_role): continue # raise RuntimeError("发现不标准的第三方接口:"+delta) + if has_content: # has_role = True/False result += delta["content"] if not console_slience: print(delta["content"], end='') if observe_window is not None: