Add dataset bench and validation agents

This commit is contained in:
2026-06-30 12:38:25 +08:00
parent 69f9a8e29b
commit dd7b7384ec
16 changed files with 853 additions and 24 deletions

View File

@@ -0,0 +1,61 @@
from __future__ import annotations
from pathlib import Path
from ..catalog import get_catalog
from ..config import settings
REQUIRED_TASKS = {
"dataset.upload": "covered_by_api",
"dataset.video_frames": "job",
"segmodel.train": "job",
"segmodel.predict": "job",
"yolo.heatmap": "job",
"mmseg.flops_fps": "job",
"analysis.all": "job",
}
def evaluate_project() -> dict:
"""Return product/implementation suggestions for the current web platform."""
frontend = settings.project_root / "frontend" / "src" / "main.tsx"
backend = settings.project_root / "backend" / "app" / "main.py"
readme = settings.project_root / "README.md"
catalog = get_catalog()
checks = []
suggestions = []
frontend_text = frontend.read_text(encoding="utf-8") if frontend.exists() else ""
backend_text = backend.read_text(encoding="utf-8") if backend.exists() else ""
readme_text = readme.read_text(encoding="utf-8") if readme.exists() else ""
expectations = {
"left_nav_dataset": "数据集" in frontend_text and "#datasets" in frontend_text,
"upload_ui": "uploadDatasetFiles" in frontend_text and "labels" in frontend_text and "masks" in frontend_text,
"loss_result_ui": "loss" in frontend_text.lower() and "heatmap" in frontend_text.lower(),
"dataset_api": "/api/datasets" in backend_text and "api_upload_dataset_files" in backend_text,
"no_weight_to_gitea": "Do not push" in readme_text and "check_no_weight_git" in readme_text,
"all_core_tasks": all(task in catalog["task_types"] for task in REQUIRED_TASKS if REQUIRED_TASKS[task] == "job"),
}
for name, passed in expectations.items():
checks.append({"name": name, "passed": bool(passed)})
if not passed:
suggestions.append(f"Improve missing capability: {name}")
if len(catalog["mmseg_algorithms"]) < 31:
suggestions.append("MMSeg algorithm catalog should expose all 31 algorithm generators.")
if len(catalog["segmodel_architectures"]) < 12:
suggestions.append("SegModel catalog should expose all 12 supported architectures.")
if not suggestions:
suggestions.append("Current platform covers the requested control-plane features; next focus is real dataset/training acceptance tests.")
score = sum(1 for item in checks if item["passed"]) / max(len(checks), 1)
return {
"agent": "evaluation_suggestion_agent",
"score": round(score, 3),
"checks": checks,
"suggestions": suggestions,
}