AgentEvalTool/backend/agenteval/storage/db/__init__.py
sinohqb 3705945a7d test: 完整测试覆盖补全(+163 用例)
架构重构(候选 1-6):
- storage/repository.py 按域拆分为包(target/scenario/run/campaign/result)
- storage/db.py 按域拆分为包(eval/campaign/file/model_config/intelligent_eval)
- intelligent_eval/lifecycle.py 按状态机阶段拆分为包
- services/runs.py 编排逻辑下沉
- Campaigns.tsx 拆分为 campaigns/ 子组件

测试补全(候选 7):
前端(+125 用例,107→232):
- utils/ 纯函数:date/campaignTime/ruleLabels/fileTree/fileFormat/colors
- stores/tabStore 状态管理
- 核心组件:FormDrawer/PageWrapper/ChatBubble/GeneratedMessages/SectionHeader/StatCard/TurnList
- 业务组件:CaseBlock/CaseDetail/RuleOverview/WindowTimeline/RunList/TabBar/CampaignRunTimeline
- 文件管理:FileCategoryTree/FileTable
- hooks:sessionReducer/useFiles/useRunSession

后端(+38 用例,916→954):
- targets API CRUD + 404 路径
- WebSocket 连接管理器
- proxy 头部重写(CSP/X-Frame-Options)
- target 仓储 update 方法
- app 健康检查 + SPA 404
- scenarios 模板端点 + 404
- files API 边缘分支(404 场景 + 500 兜底)
- files service update_category
- 智能评估状态机迁移测试

门禁状态:
- 前端:tsc 干净 + 232 passed
- 后端:954 passed + ruff 全绿
2026-08-24 15:56:09 +08:00

78 lines
1.8 KiB
Python

"""Database models and session management using SQLModel.
按域分包:``core`` 持有引擎/会话/时间工具,各 ``*_tables`` 模块按领域定义
表。本 ``__init__`` 保持旧的扁平公开面,所有既有 import 不受影响。
"""
from agenteval.storage.db.campaign_tables import (
CampaignAnalysisDB,
CampaignDB,
CampaignPeriodComparisonDB,
ExplorationMessageDB,
ExplorationSessionDB,
)
from agenteval.storage.db.core import (
DATA_DIR,
DATABASE_URL,
FILES_DIR,
as_utc,
engine,
get_session,
get_session_context,
init_db,
iso_utc,
new_uuid,
utc_now,
)
from agenteval.storage.db.eval_tables import (
EvalResultDB,
EvalRunDB,
EvalTargetDB,
ScenarioDB,
TurnDB,
)
from agenteval.storage.db.file_tables import FileCategoryDB, FileRecordDB
from agenteval.storage.db.intelligent_eval_tables import (
IntelligentEvalConfigSnapshotDB,
IntelligentEvalDB,
IntelligentEvalDecisionLogDB,
IntelligentEvalMessageDB,
IntelligentEvalSessionDB,
IntelligentEvalTaskQueueDB,
)
from agenteval.storage.db.model_config_tables import ModelConfigDB, ScenarioModelBindingDB
__all__ = [
"CampaignAnalysisDB",
"CampaignDB",
"CampaignPeriodComparisonDB",
"DATA_DIR",
"DATABASE_URL",
"EvalResultDB",
"EvalRunDB",
"EvalTargetDB",
"ExplorationMessageDB",
"ExplorationSessionDB",
"FILES_DIR",
"FileCategoryDB",
"FileRecordDB",
"IntelligentEvalConfigSnapshotDB",
"IntelligentEvalDB",
"IntelligentEvalDecisionLogDB",
"IntelligentEvalMessageDB",
"IntelligentEvalSessionDB",
"IntelligentEvalTaskQueueDB",
"ModelConfigDB",
"ScenarioDB",
"ScenarioModelBindingDB",
"TurnDB",
"as_utc",
"engine",
"get_session",
"get_session_context",
"init_db",
"iso_utc",
"new_uuid",
"utc_now",
]