Implements the complete AI flow builder feature using a guided 4-stage wizard (Foundation → Scaffold → Branch Detail → Review & Assemble). AI assists at bounded points using Claude Haiku for cost-efficient structured JSON generation (~$0.01-0.03/flow). Backend: new models (ai_conversations, ai_usage), Alembic migration, quota enforcement with billing anchor, Anthropic API integration with prompt caching, tree validation, conversation CRUD with 24h TTL, APScheduler cleanup job, 5 API endpoints, Pydantic schemas. Frontend: TypeScript types, API client, Zustand store for wizard state, 7 components (modal, step indicator, foundation form, branch selector, branch detail view, tree preview, quota display), MyTreesPage integration with "Build with AI" button (hidden when AI not configured). Tests: 14 validator unit tests + 11 endpoint integration tests with mocked Anthropic (zero real API spend). All 25 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.8 KiB
Python
39 lines
1.8 KiB
Python
from fastapi import APIRouter
|
|
from app.api.endpoints import auth, trees, sessions, invite, categories, tags, folders, step_categories, steps, admin, accounts, webhooks, shares, shared, tree_markdown
|
|
from app.api.endpoints import admin_dashboard, admin_audit, admin_plan_limits, admin_feature_flags, admin_settings, admin_categories
|
|
from app.api.endpoints import ratings, analytics
|
|
from app.api.endpoints import target_lists
|
|
from app.api.endpoints import maintenance_schedules
|
|
from app.api.endpoints import feedback
|
|
from app.api.endpoints import ai_builder
|
|
|
|
api_router = APIRouter()
|
|
|
|
api_router.include_router(auth.router)
|
|
api_router.include_router(trees.router)
|
|
api_router.include_router(sessions.router)
|
|
api_router.include_router(invite.router)
|
|
api_router.include_router(categories.router)
|
|
api_router.include_router(tags.router)
|
|
api_router.include_router(folders.router)
|
|
api_router.include_router(step_categories.router)
|
|
api_router.include_router(steps.router)
|
|
api_router.include_router(admin.router)
|
|
api_router.include_router(admin_dashboard.router)
|
|
api_router.include_router(admin_audit.router)
|
|
api_router.include_router(admin_plan_limits.router)
|
|
api_router.include_router(admin_feature_flags.router)
|
|
api_router.include_router(admin_settings.router)
|
|
api_router.include_router(admin_categories.router)
|
|
api_router.include_router(accounts.router)
|
|
api_router.include_router(webhooks.router)
|
|
api_router.include_router(shares.router)
|
|
api_router.include_router(shared.router) # Public endpoints (no auth)
|
|
api_router.include_router(tree_markdown.router)
|
|
api_router.include_router(ratings.router)
|
|
api_router.include_router(analytics.router)
|
|
api_router.include_router(target_lists.router)
|
|
api_router.include_router(maintenance_schedules.router)
|
|
api_router.include_router(feedback.router)
|
|
api_router.include_router(ai_builder.router)
|