auto-sync: 2026-05-17 07:29:23

This commit is contained in:
cfdaily
2026-05-17 07:29:23 +08:00
parent 58aa74f898
commit f09ab87cf9
2 changed files with 4 additions and 22 deletions
+2 -21
View File
@@ -9,32 +9,13 @@ from pathlib import Path
from typing import List, Optional
from src.blackboard.operations import Blackboard
from src.blackboard.models import Task, Comment, Output, Decision, Observation, Review, Experience
from src.utils import get_data_root, Comment, Output, Decision, Observation, Review, Experience
from src.blackboard.queries import Queries
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)
# 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"
return get_data_root()
def _get_bb(project_id: str) -> Blackboard:
+2 -1
View File
@@ -14,6 +14,7 @@ from fastapi.staticfiles import StaticFiles
from src.blackboard.registry import ProjectRegistry
from src.daemon.ticker import Ticker
from src.utils import get_data_root
logger = logging.getLogger("moziplus-v2")
@@ -38,7 +39,7 @@ config = load_config()
# 全局组件
# ---------------------------------------------------------------------------
DATA_ROOT = Path(config.get("data_root", Path(__file__).parent.parent / "data"))
DATA_ROOT = get_data_root()
ticker: Optional[Ticker] = None