fix: remove dead code config.get experience
CI / lint (push) Successful in 6s
CI / test (push) Successful in 14s
CI / notify-on-failure (push) Successful in 1s
CI / lint (pull_request) Failing after 13m39s
CI / test (pull_request) Has been skipped
CI / notify-on-failure (pull_request) Failing after 14m58s
CI / lint (push) Successful in 6s
CI / test (push) Successful in 14s
CI / notify-on-failure (push) Successful in 1s
CI / lint (pull_request) Failing after 13m39s
CI / test (pull_request) Has been skipped
CI / notify-on-failure (pull_request) Failing after 14m58s
This commit is contained in:
@@ -15,7 +15,7 @@ from src.blackboard.queries import Queries
|
||||
from src.blackboard.db import VALID_STATUSES, OUTPUT_TYPES
|
||||
from src.blackboard.registry import ProjectRegistry
|
||||
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
router = APIRouter(prefix="/api/projects/{project_id}", tags=["blackboard"])
|
||||
|
||||
@@ -27,7 +27,7 @@ def _validate_project(project_id: str) -> str:
|
||||
"""校验 project_id,已知项目/虚拟项目放行,未知项目返回 400"""
|
||||
if project_id in _VIRTUAL_PROJECTS:
|
||||
return project_id
|
||||
reg = ProjectRegistry(get_data_root())
|
||||
reg = ProjectRegistry(_utils.get_data_root())
|
||||
if reg.get_project(project_id):
|
||||
return project_id
|
||||
raise HTTPException(400, {
|
||||
@@ -43,12 +43,12 @@ def _validate_project(project_id: str) -> str:
|
||||
|
||||
def _bb(project_id: str) -> Blackboard:
|
||||
_validate_project(project_id)
|
||||
return Blackboard(get_data_root() / project_id / "blackboard.db")
|
||||
return Blackboard(_utils.get_data_root() / project_id / "blackboard.db")
|
||||
|
||||
|
||||
def _q(project_id: str) -> Queries:
|
||||
_validate_project(project_id)
|
||||
return Queries(get_data_root() / project_id / "blackboard.db")
|
||||
return Queries(_utils.get_data_root() / project_id / "blackboard.db")
|
||||
|
||||
|
||||
# --- Tasks ---
|
||||
@@ -100,7 +100,7 @@ async def create_task(project_id: str, body: Dict[str, Any]):
|
||||
date_str = datetime.now().strftime('%Y%m%d')
|
||||
# seq: 查当前项目最大 seq
|
||||
import sqlite3
|
||||
db_path = get_data_root() / project_id / "blackboard.db"
|
||||
db_path = _utils.get_data_root() / project_id / "blackboard.db"
|
||||
try:
|
||||
conn = sqlite3.connect(str(db_path), timeout=5)
|
||||
max_id_row = conn.execute(
|
||||
|
||||
@@ -10,7 +10,7 @@ from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
from src.blackboard.operations import Blackboard
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
router = APIRouter(prefix="/api/projects/{project_id}/tasks/{task_id}/checkpoints", tags=["checkpoints"])
|
||||
|
||||
@@ -33,7 +33,7 @@ class ResolveCheckpointRequest(BaseModel):
|
||||
# ── 工具 ──
|
||||
|
||||
def _bb(project_id: str) -> Blackboard:
|
||||
db_path = get_data_root() / project_id / "blackboard.db"
|
||||
db_path = _utils.get_data_root() / project_id / "blackboard.db"
|
||||
if not db_path.exists():
|
||||
raise HTTPException(status_code=404, detail="Project not found")
|
||||
return Blackboard(db_path)
|
||||
|
||||
@@ -17,7 +17,7 @@ from src.blackboard.db import init_db
|
||||
from src.blackboard.models import Task
|
||||
from src.blackboard.operations import Blackboard
|
||||
from src.blackboard.queries import Queries
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
|
||||
def _get_valid_agents() -> set:
|
||||
@@ -43,7 +43,7 @@ MAIL_PROJECT_ID = "_mail"
|
||||
|
||||
|
||||
def _db_path() -> Path:
|
||||
root = get_data_root()
|
||||
root = _utils.get_data_root()
|
||||
db = root / MAIL_PROJECT_ID / "blackboard.db"
|
||||
db.parent.mkdir(parents=True, exist_ok=True)
|
||||
init_db(db)
|
||||
|
||||
@@ -8,13 +8,13 @@ from typing import Any, Dict
|
||||
from fastapi import APIRouter, HTTPException, Query
|
||||
|
||||
from src.blackboard.registry import ProjectRegistry
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
router = APIRouter(prefix="/api/projects", tags=["projects"])
|
||||
|
||||
|
||||
def _registry() -> ProjectRegistry:
|
||||
return ProjectRegistry(get_data_root())
|
||||
return ProjectRegistry(_utils.get_data_root())
|
||||
|
||||
|
||||
@router.get("")
|
||||
|
||||
@@ -28,7 +28,7 @@ from src.blackboard.models import Task
|
||||
from src.blackboard.operations import Blackboard
|
||||
from src.config.agents import AGENT_IDS
|
||||
from src.daemon.toolchain_templates import render_template
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -146,7 +146,7 @@ MAIL_PROJECT_ID = "_mail"
|
||||
|
||||
def _mail_db_path() -> Path:
|
||||
"""获取 Mail 数据库路径,确保目录存在。"""
|
||||
root = get_data_root()
|
||||
root = _utils.get_data_root()
|
||||
db = root / MAIL_PROJECT_ID / "blackboard.db"
|
||||
db.parent.mkdir(parents=True, exist_ok=True)
|
||||
init_db(db)
|
||||
|
||||
@@ -9,14 +9,14 @@ from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from src.blackboard.operations import Blackboard
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
from src.blackboard.models import Task, Review
|
||||
from src.blackboard.queries import Queries
|
||||
from src.blackboard.registry import ProjectRegistry
|
||||
|
||||
|
||||
def _find_project_root() -> Path:
|
||||
return get_data_root()
|
||||
return _utils.get_data_root()
|
||||
|
||||
|
||||
def _get_bb(project_id: str) -> Blackboard:
|
||||
|
||||
@@ -664,8 +664,8 @@ Parent Task ID: {parent_task.id}
|
||||
|
||||
def _resolve_db_path(self, project_id: str) -> Path:
|
||||
"""解析项目 DB 路径"""
|
||||
from src.utils import get_data_root
|
||||
return get_data_root() / project_id / "blackboard.db"
|
||||
import src.utils as _utils
|
||||
return _utils.get_data_root() / project_id / "blackboard.db"
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# @mention 通知处理 (v2.9 #01)
|
||||
|
||||
+2
-3
@@ -23,7 +23,7 @@ from src.daemon.health import HealthChecker
|
||||
from src.daemon.experience import ExperienceDistiller, ExperienceStore
|
||||
from src.daemon.inbox import InboxWatcher
|
||||
from src.daemon.guardrails import GuardrailEngine
|
||||
from src.utils import get_data_root
|
||||
import src.utils as _utils
|
||||
|
||||
from src.api.blackboard_routes import router as blackboard_router
|
||||
from src.api.checkpoint_routes import router as checkpoint_router
|
||||
@@ -86,7 +86,7 @@ config = load_config()
|
||||
# 全局组件
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
DATA_ROOT = get_data_root()
|
||||
DATA_ROOT = _utils.get_data_root()
|
||||
|
||||
ticker: Optional[Ticker] = None
|
||||
|
||||
@@ -199,7 +199,6 @@ async def lifespan(app: FastAPI):
|
||||
)
|
||||
|
||||
# ExperienceDistiller(经验自动蒸馏)
|
||||
config.get("experience", {})
|
||||
experience_distiller = ExperienceDistiller(
|
||||
store=ExperienceStore(store_path=DATA_ROOT / "experiences.jsonl"),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user