mirror of
https://github.com/hwanny1128/HGZero.git
synced 2025-12-06 10:16:24 +00:00
- AI 텍스트 요약 API 추가 (POST /api/v1/ai/summary/generate) - 불릿 포인트 및 단락형 스타일 지원 - 포트 8087로 통일 - 압축률, 핵심 포인트 추출 기능 포함 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
1.6 KiB
Python
69 lines
1.6 KiB
Python
"""AI Service FastAPI Application"""
|
|
import uvicorn
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from app.config import get_settings
|
|
from app.api.v1 import router as api_v1_router
|
|
from app.services.eventhub_service import start_eventhub_listener
|
|
import logging
|
|
import asyncio
|
|
|
|
# 로깅 설정
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
# Settings
|
|
settings = get_settings()
|
|
|
|
# FastAPI 앱 생성
|
|
app = FastAPI(
|
|
title=settings.app_name,
|
|
description="AI-powered meeting minutes analysis service",
|
|
version="1.0.0",
|
|
docs_url="/api/docs",
|
|
redoc_url="/api/redoc",
|
|
openapi_url="/api/openapi.json"
|
|
)
|
|
|
|
# CORS 미들웨어 설정
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.cors_origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# API 라우터 등록
|
|
app.include_router(api_v1_router, prefix="/api/v1")
|
|
|
|
|
|
# Event Hub 리스너 백그라운드 태스크
|
|
@app.on_event("startup")
|
|
async def startup_event():
|
|
"""애플리케이션 시작 시 Event Hub 리스너 시작"""
|
|
logger.info("애플리케이션 시작 - Event Hub 리스너 백그라운드 실행")
|
|
asyncio.create_task(start_eventhub_listener())
|
|
|
|
|
|
@app.get("/health")
|
|
async def health_check():
|
|
"""헬스 체크"""
|
|
return {
|
|
"status": "healthy",
|
|
"service": settings.app_name
|
|
}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run(
|
|
"main:app",
|
|
host=settings.host,
|
|
port=settings.port,
|
|
reload=True,
|
|
log_level=settings.log_level.lower()
|
|
)
|