修复:启动链,参数/环境变量加载逻辑优化

This commit is contained in:
LIghtJUNction
2026-03-20 19:47:04 +08:00
parent 78edc0fff8
commit 4fd77ea008

View File

@@ -218,6 +218,8 @@ def run(
# Mark CLI execution
os.environ["ASTRBOT_CLI"] = "1"
from astrbot.core.utils.astrbot_path import astrbot_paths
# Resolve astrbot_root with the following precedence:
# 1. CLI --root parameter (local variable `root`)
# 2. ASTRBOT_ROOT environment variable (possibly from .env or parsed service config)
@@ -228,8 +230,6 @@ def run(
elif os.environ.get("ASTRBOT_ROOT"):
astrbot_root = Path(os.environ["ASTRBOT_ROOT"])
else:
from astrbot.core.utils.astrbot_path import astrbot_paths
astrbot_root = astrbot_paths.root
if not astrbot_paths.is_root: