diff --git a/request_llm/bridge_all.py b/request_llm/bridge_all.py index 4c7f19d..abec167 100644 --- a/request_llm/bridge_all.py +++ b/request_llm/bridge_all.py @@ -361,7 +361,7 @@ if "chatgpt_website" in AVAIL_LLM_MODELS: # 接入一些逆向工程https://gi "chatgpt_website": { "fn_with_ui": chatgpt_website_ui, "fn_without_ui": chatgpt_website_noui, - "endpoint": None, + "endpoint": openai_endpoint, "max_token": 4096, "tokenizer": tokenizer_gpt35, "token_cnt": get_token_num_gpt35, diff --git a/request_llm/bridge_chatgpt_website.py b/request_llm/bridge_chatgpt_website.py index 96af833..7f3147b 100644 --- a/request_llm/bridge_chatgpt_website.py +++ b/request_llm/bridge_chatgpt_website.py @@ -118,16 +118,6 @@ def predict(inputs, llm_kwargs, plugin_kwargs, chatbot, history=[], system_promp chatbot 为WebUI中显示的对话列表,修改它,然后yeild出去,可以直接修改对话界面内容 additional_fn代表点击的哪个按钮,按钮见functional.py """ - if is_any_api_key(inputs): - chatbot._cookies['api_key'] = inputs - chatbot.append(("输入已识别为openai的api_key", what_keys(inputs))) - yield from update_ui(chatbot=chatbot, history=history, msg="api_key已导入") # 刷新界面 - return - elif not is_any_api_key(chatbot._cookies['api_key']): - chatbot.append((inputs, "缺少api_key。\n\n1. 临时解决方案:直接在输入区键入api_key,然后回车提交。\n\n2. 长效解决方案:在config.py中配置。")) - yield from update_ui(chatbot=chatbot, history=history, msg="缺少api_key") # 刷新界面 - return - if additional_fn is not None: from core_functional import handle_core_functionality inputs, history = handle_core_functionality(additional_fn, inputs, history, chatbot) @@ -245,14 +235,9 @@ def generate_payload(inputs, llm_kwargs, history, system_prompt, stream): if not is_any_api_key(llm_kwargs['api_key']): raise AssertionError("你提供了错误的API_KEY。\n\n1. 临时解决方案:直接在输入区键入api_key,然后回车提交。\n\n2. 长效解决方案:在config.py中配置。") - api_key = select_api_key(llm_kwargs['api_key'], llm_kwargs['llm_model']) - headers = { "Content-Type": "application/json", - "Authorization": f"Bearer {api_key}" } - if API_ORG.startswith('org-'): headers.update({"OpenAI-Organization": API_ORG}) - if llm_kwargs['llm_model'].startswith('azure-'): headers.update({"api-key": api_key}) conversation_cnt = len(history) // 2