43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
from fastapi import FastAPI
|
|
|
|
from app.analyzer import analyze
|
|
from app.config import settings
|
|
from app.schemas import AnalyzeRequest, AnalyzeResponse
|
|
from app.webhooks_chatwoot import router as chatwoot_router
|
|
from app.db import init_db
|
|
from app.admin_ui.router import router as admin_dashboard_router
|
|
from app.api.internal import router as internal_api_router
|
|
|
|
|
|
app = FastAPI(
|
|
title="ClientFlow MVP",
|
|
description="Motor de contexto comercial com Qwen3 30B + regras ClientFlow.",
|
|
version="0.1.0",
|
|
)
|
|
|
|
|
|
app.include_router(chatwoot_router)
|
|
app.include_router(internal_api_router)
|
|
|
|
|
|
@app.on_event("startup")
|
|
async def startup_event() -> None:
|
|
init_db()
|
|
|
|
|
|
@app.get("/health")
|
|
async def health() -> dict:
|
|
return {
|
|
"status": "ok",
|
|
"app": settings.app_name,
|
|
"env": settings.env,
|
|
"model": settings.openrouter_model,
|
|
}
|
|
|
|
|
|
@app.post("/analyze", response_model=AnalyzeResponse)
|
|
async def analyze_endpoint(request: AnalyzeRequest) -> AnalyzeResponse:
|
|
return await analyze(request)
|
|
|
|
app.include_router(admin_dashboard_router)
|