Features: - Modern web interface with table view of all artifacts - Display all metadata: filename, type, size, test info, tags - Upload form with full metadata support - Query/filter interface - Detail modal for viewing full artifact information - Download and delete actions - Integrated seed data generation via UI - Responsive design with gradient theme Technical: - Pure HTML/CSS/JavaScript (no frameworks) - FastAPI serves static files - Seed data API endpoint for easy testing - Pagination support - Real-time deployment mode display The UI is now accessible at http://localhost:8000/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
from fastapi import APIRouter, HTTPException
|
|
from app.database import SessionLocal
|
|
import asyncio
|
|
import sys
|
|
import os
|
|
|
|
# Add parent directory to path
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
|
|
|
|
from utils.seed_data import generate_seed_data as generate_data, clear_all_data
|
|
|
|
router = APIRouter(prefix="/api/v1/seed", tags=["seed"])
|
|
|
|
|
|
@router.post("/generate/{count}")
|
|
async def generate_seed_data(count: int = 10):
|
|
"""Generate seed data"""
|
|
if count < 1 or count > 100:
|
|
raise HTTPException(status_code=400, detail="Count must be between 1 and 100")
|
|
|
|
try:
|
|
artifact_ids = await generate_data(count)
|
|
return {
|
|
"message": f"Successfully generated {len(artifact_ids)} artifacts",
|
|
"artifact_ids": artifact_ids
|
|
}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=f"Seed generation failed: {str(e)}")
|
|
|
|
|
|
@router.delete("/clear")
|
|
async def clear_data():
|
|
"""Clear all data"""
|
|
try:
|
|
await clear_all_data()
|
|
return {"message": "All data cleared successfully"}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=500, detail=f"Clear failed: {str(e)}")
|