mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
31 lines
702 B
Python
31 lines
702 B
Python
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
|