auto-sync: 2026-05-17 07:29:23
This commit is contained in:
+2
-21
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user