Files
konabot/konabot/common/web_render/config.py
passthem e09de9eeb6
All checks were successful
continuous-integration/drone/push Build is passing
更改使用 uv 而非 poetry 管理 Docker 内部依赖
2025-11-10 04:41:05 +08:00

21 lines
614 B
Python

import nonebot
from pydantic import BaseModel
class Config(BaseModel):
module_web_render_weburl: str = "localhost:5173"
module_web_render_instance: str = ""
module_web_render_playwright_ws: str = ""
def get_instance_baseurl(self):
if self.module_web_render_instance:
return self.module_web_render_instance.removesuffix('/')
config = nonebot.get_driver().config
ip = str(config.host)
if ip == "0.0.0.0":
ip = "127.0.0.1"
port = config.port
return f'http://{ip}:{port}'
web_render_config = nonebot.get_plugin_config(Config)