hgzero/ai-python/app/config.py
Minseo-Jo 9bf3597cec AI 서비스 Python 마이그레이션 및 프론트엔드 연동 문서 추가
주요 변경사항:
- AI 서비스 Java → Python (FastAPI) 완전 마이그레이션
- 포트 변경: 8083 → 8086
- SSE 스트리밍 기능 구현 및 테스트 완료
- Claude API 연동 (claude-3-5-sonnet-20241022)
- Redis 슬라이딩 윈도우 방식 텍스트 축적
- Azure Event Hub 연동 준비 (STT 텍스트 수신)

프론트엔드 연동 지원:
- API 연동 가이드 업데이트 (Python 버전 반영)
- Mock 데이터 개발 가이드 신규 작성
- STT 개발 완료 전까지 Mock 데이터로 UI 개발 가능

기술 스택:
- Python 3.13
- FastAPI 0.104.1
- Anthropic Claude API 0.42.0
- Redis (asyncio) 5.0.1
- Azure Event Hub 5.11.4
- Pydantic 2.10.5

테스트 결과:
-  서비스 시작 정상
-  헬스 체크 성공
-  SSE 스트리밍 동작 확인
-  Redis 연결 정상

다음 단계:
- STT (Azure Speech) 서비스 연동 개발
- Event Hub를 통한 실시간 텍스트 수신
- E2E 통합 테스트 (STT → AI → Frontend)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 11:52:30 +09:00

56 lines
1.3 KiB
Python

"""환경 설정"""
from pydantic_settings import BaseSettings
from functools import lru_cache
from typing import List
class Settings(BaseSettings):
"""환경 설정 클래스"""
# 서버 설정
app_name: str = "AI Service (Python)"
host: str = "0.0.0.0"
port: int = 8086 # STT(8084)와 충돌 방지
# Claude API
claude_api_key: str = ""
claude_model: str = "claude-3-5-sonnet-20241022"
claude_max_tokens: int = 250000
claude_temperature: float = 0.7
# Redis
redis_host: str = "20.249.177.114"
redis_port: int = 6379
redis_password: str = ""
redis_db: int = 4
# Azure Event Hub
eventhub_connection_string: str = ""
eventhub_name: str = "hgzero-eventhub-name"
eventhub_consumer_group: str = "ai-transcript-group"
# CORS
cors_origins: List[str] = [
"http://localhost:*",
"http://127.0.0.1:*",
"http://localhost:8080",
"http://localhost:3000"
]
# 로깅
log_level: str = "INFO"
# 분석 임계값
min_segments_for_analysis: int = 10
text_retention_seconds: int = 300 # 5분
class Config:
env_file = ".env"
case_sensitive = False
@lru_cache()
def get_settings() -> Settings:
"""싱글톤 설정 인스턴스"""
return Settings()