fix: restore merge-dropped port/ip_addr variable definitions and payload type ignore

This commit is contained in:
LIghtJUNction
2026-04-29 03:06:56 +08:00
parent 7c4a061578
commit d57582e599
2 changed files with 17 additions and 7 deletions

View File

@@ -801,7 +801,7 @@ class BaiduWebSearchTool(FunctionTool[AstrAgentContext]):
if site:
sites = [s.strip() for s in site.replace("|", ",").split(",") if s.strip()]
if sites:
payload["search_filter"] = {"match": {"site": sites[:100]}}
payload["search_filter"] = {"match": {"site": sites[:100]}} # type: ignore
results = await _baidu_search(provider_settings, payload)
if not results:

View File

@@ -668,21 +668,31 @@ class AstrBotDashboard:
ssl_config,
)
if not enable:
if not self.enable_webui:
logger.info("WebUI disabled.")
return None
port_value = (
os.environ.get("DASHBOARD_PORT")
or os.environ.get("ASTRBOT_DASHBOARD_PORT")
or dashboard_config.get("port", 6185)
)
port = _resolve_dashboard_value(port_value, field_name="port")
if not isinstance(port, int) or port < 1 or port > 65535:
raise ValueError("Dashboard port must be an integer between 1 and 65535")
scheme = "https" if ssl_enable else "http"
ip_addr: list[IPv4Address | IPv6Address] = get_local_ip_addresses()
binds: list[str] = [self._build_bind(host, port)]
if host == "::" and platform.system() in ("Windows", "Darwin"):
binds.append(self._build_bind("0.0.0.0", port))
logger.info("Starting WebUI at %s://%s:%s", scheme, host, port)
if host == "0.0.0.0":
logger.info(
"WebUI listens on all interfaces. Check security. Set dashboard.host in data/cmd_config.json to change it.",
)
scheme = "https" if ssl_enable else "http"
binds: list[str] = [self._build_bind(host, port)]
if host == "::" and platform.system() in ("Windows", "Darwin"):
binds.append(self._build_bind("0.0.0.0", port))
if self.enable_webui:
logger.info(
"正在启动 WebUI + API, 监听: %s",