Skip to content

Commit

Permalink
Merge pull request #608 from RockChinQ/fix/reverse-proxy-invalid
Browse files Browse the repository at this point in the history
Fix: 反向代理设置无效
  • Loading branch information
RockChinQ authored Nov 21, 2023
2 parents eebd6a6 + e15f359 commit 7890eac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def start(first_time_init=False):

# 配置openai api_base
if "reverse_proxy" in config.openai_config and config.openai_config["reverse_proxy"] is not None:
logging.debug("设置反向代理: "+config.openai_config['reverse_proxy'])
openai.base_url = config.openai_config["reverse_proxy"]

# 主启动流程
Expand Down
3 changes: 2 additions & 1 deletion pkg/openai/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def __init__(self, api_key: str):
# logging.info("文字总使用量:%d", self.audit_mgr.get_total_text_length())

self.client = openai.Client(
api_key=self.key_mgr.get_using_key()
api_key=self.key_mgr.get_using_key(),
base_url=openai.base_url
)

context.set_openai_manager(self)
Expand Down

0 comments on commit 7890eac

Please sign in to comment.