mirror of
https://github.com/hwanny1128/HGZero.git
synced 2025-12-06 12:36:23 +00:00
주요 변경사항:
- Event Hub 리스너를 Python AI Service에 통합하여 STT 텍스트 실시간 수신
- LocalDateTime 배열 형식을 Unix timestamp로 변환하는 로직 추가
- SSE 응답에 CORS 헤더 명시적 추가 (localhost:8888 허용)
- SSE Keep-alive를 위한 ping 이벤트 추가 (5초 주기)
- Redis 데이터 정리 스크립트 추가
- 분석 임계값을 MVP 수준으로 조정 (3개 세그먼트 = 약 15-30초)
- 프론트엔드 SSE 연동 가이드 문서 작성
- 프론트엔드에 ping 이벤트 핸들러 추가 및 에러 핸들링 개선
기술적 개선사항:
- EventSourceResponse에 Access-Control-Allow-Origin 헤더 추가
- timestamp 변환 로직으로 Java-Python 호환성 해결
- Redis 저장 오류 로깅 강화
- SSE generator에 주기적 heartbeat 전송으로 연결 유지
문서:
- develop/dev/ai-frontend-integration-guide.md: 프론트엔드 개발자를 위한 상세 연동 가이드
🤖 Generated with 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")
|
|
|
|
|
|
# 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()
|
|
)
|