Files
Admin 3e15f643d6 fix: deployment — resolve dependency conflicts, add initial migration, CI/CD webhook
- Fix httpx/pydantic/redis version conflicts for litellm/aiogram/celery compatibility
- Add PYTHONPATH=/app to Dockerfile for alembic module resolution
- Skip Telegram webhook setup when URL is not HTTPS
- Fix FileUpload prop type mismatch in RecordingsPage
- Add alembic script.py.mako template and initial migration
- Configure docker-compose: port 8081, built frontend, no exposed internal ports
- Add deploy.sh and webhook-server.js for Gitea CI/CD auto-deploy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:49:12 +05:00

62 lines
1.9 KiB
Python

from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from sqlalchemy import select
from app.api.auth import router as auth_router
from app.api.exports import router as exports_router
from app.api.protocols import router as protocols_router
from app.api.recordings import router as recordings_router
from app.api.settings import router as settings_router
from app.api.templates import router as templates_router
from app.config import settings
from app.database import async_session
from app.messengers.telegram.bot import api_router as telegram_router, telegram_service
from app.models.prompt_template import PromptTemplate
from app.prompts.defaults import DEFAULT_TEMPLATES
async def seed_default_templates():
async with async_session() as db:
result = await db.execute(select(PromptTemplate))
if result.scalars().first() is not None:
return
for tpl in DEFAULT_TEMPLATES:
db.add(PromptTemplate(**tpl))
await db.commit()
@asynccontextmanager
async def lifespan(app: FastAPI):
await seed_default_templates()
if settings.telegram_bot_token and settings.telegram_webhook_url.startswith("https"):
await telegram_service.setup()
yield
if settings.telegram_bot_token and settings.telegram_webhook_url.startswith("https"):
await telegram_service.shutdown()
app = FastAPI(title="Meeting Protocol Service", lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth_router)
app.include_router(recordings_router)
app.include_router(protocols_router)
app.include_router(templates_router)
app.include_router(exports_router)
app.include_router(settings_router)
app.include_router(telegram_router)
@app.get("/api/health")
async def health():
return {"status": "ok"}