54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""
|
|
ACI AI Fixer - FastAPI Backend
|
|
"""
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from contextlib import asynccontextmanager
|
|
import logging
|
|
|
|
from routers import webhook, issues, config
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
"""Startup and shutdown events."""
|
|
logger.info("🚀 ACI AI Fixer starting up...")
|
|
# Initialize database, connections, etc.
|
|
yield
|
|
logger.info("👋 ACI AI Fixer shutting down...")
|
|
|
|
|
|
app = FastAPI(
|
|
title="ACI AI Fixer",
|
|
description="AI system for automated JIRA Support Case analysis",
|
|
version="0.1.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
# CORS for portal
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"], # Configure properly in production
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(webhook.router, prefix="/api/webhook", tags=["webhook"])
|
|
app.include_router(issues.router, prefix="/api/issues", tags=["issues"])
|
|
app.include_router(config.router, prefix="/api/config", tags=["config"])
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"status": "ok", "service": "ACI AI Fixer", "version": "0.1.0"}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "healthy"}
|