diff --git a/configs/model_config.py.example b/configs/model_config.py.example index 728cddd..e377d9d 100644 --- a/configs/model_config.py.example +++ b/configs/model_config.py.example @@ -80,6 +80,7 @@ ONLINE_LLM_MODEL = { # 需要添加代理访问(正常开的代理软件可能会拦截不上)需要设置配置openai_proxy 或者 使用环境遍历OPENAI_PROXY 进行设置 # 比如: "openai_proxy": 'http://127.0.0.1:4780' "gpt-3.5-turbo": { + "api_base_url": "https://api.openai.com/v1", "api_key": "your OPENAI_API_KEY", "openai_proxy": "your OPENAI_PROXY", }, diff --git a/server/chat/openai_chat.py b/server/chat/openai_chat.py index a7d14c9..4a46ddd 100644 --- a/server/chat/openai_chat.py +++ b/server/chat/openai_chat.py @@ -27,7 +27,7 @@ async def openai_chat(msg: OpenAiChatMsgIn): config = get_model_worker_config(msg.model) openai.api_key = config.get("api_key", "EMPTY") print(f"{openai.api_key=}") - openai.api_base = fschat_openai_api_address() + openai.api_base = config.get("api_base_url", fschat_openai_api_address()) print(f"{openai.api_base=}") print(msg) diff --git a/server/chat/utils.py b/server/chat/utils.py index 0d2e877..0c32969 100644 --- a/server/chat/utils.py +++ b/server/chat/utils.py @@ -18,7 +18,7 @@ def get_ChatOpenAI( verbose=True, callbacks=callbacks, openai_api_key=config.get("api_key", "EMPTY"), - openai_api_base=fschat_openai_api_address(), + openai_api_base=config.get("api_base_url", fschat_openai_api_address()), model_name=model_name, temperature=temperature, openai_proxy=config.get("openai_proxy")