mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-28 04:59:52 +01:00
从智控台读配置时,config/config_loader.py 把整个 server 段换成本地配置,
本地没写端口(或写成空串)时用 "" 兜底,把智控台下发的端口覆盖成空字符串;
随后 app.py 的 int(config["server"].get("http_port", 8003)) 抛 ValueError,
服务在启动阶段就崩掉:
ValueError: invalid literal for int() with base 10: ''
改动:
- config_loader:端口按「本地非空 → 智控台下发的值 → 默认 8000/8003」取值;
本地没配的 server 字段继续沿用智控台下发的值,不再整块替换
- core/utils/util:新增 safe_int,空串/None/非数字统一回落到默认值
- 7 处 int(server_config.get("port"/"http_port", ...)) 改用 safe_int,
端口为空时退到默认值而不是抛异常
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_config_loader.py | ||
| test_provider_endpoints.py | ||
| test_server_port_fallback.py | ||