mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-10-24 01:39:17 +08:00
Merge branch 'feat/optional-backend' of https://github.com/AstrBotDevs/AstrBot into feat/optional-backend
This commit is contained in:
@@ -52,8 +52,10 @@ def run(reload: bool, host: str, port: str, backend_only: bool) -> None:
|
||||
os.environ["ASTRBOT_ROOT"] = str(astrbot_root)
|
||||
sys.path.insert(0, str(astrbot_root))
|
||||
|
||||
os.environ["DASHBOARD_PORT"] = port or "6185"
|
||||
os.environ["DASHBOARD_HOST"] = host or "::"
|
||||
if port is not None:
|
||||
os.environ["DASHBOARD_PORT"] = port
|
||||
if host is not None:
|
||||
os.environ["DASHBOARD_HOST"] = host
|
||||
os.environ["DASHBOARD_ENABLE"] = str(not backend_only)
|
||||
|
||||
if reload:
|
||||
|
||||
@@ -254,8 +254,10 @@ async def get_public_ip_address() -> list[IPv4Address | IPv6Address]:
|
||||
ip = ip_address(raw_ip)
|
||||
if ip.version not in found_ips:
|
||||
found_ips[ip.version] = ip
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
# Ignore errors from individual services so that a single failing
|
||||
# endpoint does not prevent discovering the public IP from others.
|
||||
logger.debug("Failed to fetch public IP from %s: %s", url, e)
|
||||
|
||||
async with aiohttp.ClientSession() as session:
|
||||
tasks = [fetch(session, url) for url in urls]
|
||||
|
||||
@@ -59,4 +59,5 @@ class Response:
|
||||
return self
|
||||
|
||||
def to_json(self):
|
||||
return jsonify(asdict(self))
|
||||
# Return a plain dict so callers can safely wrap with jsonify()
|
||||
return asdict(self)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import asyncio
|
||||
import ipaddress
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
@@ -33,6 +32,11 @@ from .routes.session_management import SessionManagementRoute
|
||||
from .routes.subagent import SubAgentRoute
|
||||
from .routes.t2i import T2iRoute
|
||||
|
||||
|
||||
class _AddrWithPort(Protocol):
|
||||
port: int
|
||||
|
||||
|
||||
APP: Quart
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user