from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from app.api.router import api_router from app.core.config import get_settings from app.core.scheduler import attach_scheduler def create_app() -> FastAPI: """Create and configure the FastAPI application.""" settings = get_settings() app = FastAPI( title=settings.app_name, debug=settings.debug, version="0.1.0", description=( "AI integration layer for company lifecycle management, existing MySQL " "project systems, Feishu, OpenClaw, Hermes, and model providers." ), ) app.add_middleware( CORSMiddleware, allow_origins=settings.cors_origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) app.include_router(api_router, prefix=settings.api_prefix) attach_scheduler(app) return app app = create_app()