30 lines
746 B
Python
30 lines
746 B
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.api.routes import router
|
|
from app.api.settings import router as settings_router
|
|
from app.config import get_settings
|
|
|
|
settings = get_settings()
|
|
|
|
app = FastAPI(
|
|
title="AI 空间风格工作台 API",
|
|
version="0.1.0",
|
|
description="户型清洗、3D 白模、Style DNA 与多轮编辑的工作流调度接口。",
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origin_list,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
app.include_router(router)
|
|
app.include_router(settings_router)
|
|
|
|
|
|
@app.get("/")
|
|
def root() -> dict[str, str]:
|
|
return {"service": settings.app_name, "docs": "/docs"}
|