INNER CODE UNIT · Python
create_app
Dong90/oh-my-taiyiforge · services/translation_api/app.py:21
def create_app() -> FastAPI:
"""Build and return a configured FastAPI application instance."""
settings = get_settings()
app = FastAPI(
title="Translation Assistant API",
description="沟通翻译助手 — backend API for role-aware LLM translation",
version="1.0.0",
)
# ── Middleware (order matters: outer = first) ────────────────────────
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)