mirror of
https://github.com/RockChinQ/QChatGPT.git
synced 2024-11-16 03:32:33 +08: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
|