Backend: - New models: MatchFeedback, EfficiencyProfile, EfficiencyRate, ToolEfficiency, ToolEfficiencyRate - 3 preset profiles seeded: Conservative, Moderate, Aggressive with per-discipline rates - 6 BTG tools seeded: Pencil, OMG, Creative X, Cortex, Semblance, Share of Model - Efficiency API: CRUD for profiles and tools at /api/efficiency/ - team_shape.py: accepts profile_rates + tool_rates (per-discipline, additive, capped at 90%) - team-shape endpoint: accepts profile_id and tool_ids query params - Programme roles always exempt regardless of method Example: Moderate profile + Creative X + Pencil → Account Mgmt 10%, Creative 70%, Production 65% Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
1.9 KiB
Python
58 lines
1.9 KiB
Python
import logging
|
|
|
|
from fastapi import FastAPI, Depends
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
# Enable app-level logging
|
|
logging.basicConfig(level=logging.INFO, format="%(levelname)s [%(name)s] %(message)s")
|
|
|
|
from app.api import gmal, ingest, projects, matching, ratecard, efficiency
|
|
from app.middleware.auth import get_current_user
|
|
|
|
app = FastAPI(title="Scope Builder", version="1.0.0")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=[
|
|
"http://localhost:3000",
|
|
"http://localhost:3001",
|
|
"http://localhost:3010",
|
|
"https://optical-dev.oliver.solutions",
|
|
],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
_auth = Depends(get_current_user)
|
|
|
|
app.include_router(gmal.router, prefix="/api/gmal", tags=["GMAL"], dependencies=[_auth])
|
|
app.include_router(ingest.router, prefix="/api/gmal", tags=["Ingest"], dependencies=[_auth])
|
|
app.include_router(projects.router, prefix="/api/projects", tags=["Projects"], dependencies=[_auth])
|
|
app.include_router(matching.router, prefix="/api/projects", tags=["Matching"], dependencies=[_auth])
|
|
app.include_router(ratecard.router, prefix="/api/projects", tags=["Ratecard"], dependencies=[_auth])
|
|
app.include_router(efficiency.router, prefix="/api/efficiency", tags=["Efficiency"], dependencies=[_auth])
|
|
|
|
|
|
@app.get("/api/health")
|
|
async def health():
|
|
return {"status": "ok"}
|
|
|
|
|
|
@app.get("/api/ai/usage", dependencies=[_auth])
|
|
async def ai_usage():
|
|
from app.utils.claude_client import get_usage_stats
|
|
return get_usage_stats()
|
|
|
|
|
|
@app.post("/api/ai/usage/reset", dependencies=[_auth])
|
|
async def ai_usage_reset():
|
|
from app.utils.claude_client import reset_usage_stats
|
|
reset_usage_stats()
|
|
return {"detail": "Usage stats reset"}
|
|
|
|
|
|
@app.get("/api/ai/debug", dependencies=[_auth])
|
|
async def ai_debug():
|
|
from app.utils.claude_client import get_debug_log
|
|
return get_debug_log()
|