mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
refactor: 重构插件系统
This commit is contained in:
30
pkg/utils/proxy.py
Normal file
30
pkg/utils/proxy.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ..core import app
|
||||
|
||||
|
||||
class ProxyManager:
|
||||
ap: app.Application
|
||||
|
||||
forward_proxies: dict[str, str]
|
||||
|
||||
def __init__(self, ap: app.Application):
|
||||
self.ap = ap
|
||||
|
||||
self.forward_proxies = {}
|
||||
|
||||
async def initialize(self):
|
||||
config = self.ap.cfg_mgr.data
|
||||
|
||||
return (
|
||||
{
|
||||
"http": config["openai_config"]["proxy"],
|
||||
"https": config["openai_config"]["proxy"],
|
||||
}
|
||||
if "proxy" in config["openai_config"]
|
||||
and (config["openai_config"]["proxy"] is not None)
|
||||
else None
|
||||
)
|
||||
|
||||
def get_forward_proxies(self) -> str:
|
||||
return self.forward_proxies
|
||||
Reference in New Issue
Block a user