auto-sync: 2026-05-17 07:28:45

This commit is contained in:
cfdaily
2026-05-17 07:28:45 +08:00
parent 09060c25cb
commit 54c0c1089d
2 changed files with 53 additions and 2 deletions
+16 -2
View File
@@ -15,12 +15,26 @@ from src.blackboard.registry import ProjectRegistry
def _find_project_root() -> Path:
"""从环境变量或默认路径找项目根目录"""
"""从环境变量、配置文件或默认路径找项目根目录"""
import os
# 1. 环境变量最高优先级
root = os.environ.get("BLACKBOARD_ROOT")
if root:
return Path(root)
return Path.home() / ".sanguo_projects" / "sanguo_moziplus_v2" / "projects"
# 2. 从 config/default.yaml 读取
try:
import yaml
config_path = Path(__file__).parent.parent / "config" / "default.yaml"
if config_path.exists():
with open(config_path) as f:
cfg = yaml.safe_load(f) or {}
data_root = cfg.get("data_root")
if data_root:
return Path(data_root).expanduser()
except Exception:
pass
# 3. 相对于源码目录的 data/
return Path(__file__).parent.parent / "data"
def _get_bb(project_id: str) -> Blackboard: