Implement Phase 22: REST API (FastAPI + SSE streaming)

- api.py: FastAPI 앱 신규 생성
  - GET /health, POST /chat (SSE), POST /reset, POST /ingest, GET/DELETE /documents
  - SSE 포맷: data: <JSON 토큰>\n\n / data: [DONE]\n\n
  - Bearer Token 인증 (API_TOKEN 미설정 시 개발 모드)
  - user_id 파라미터로 멀티유저 지원 (기존 AgentService·DB 구조 재사용)
- config.py: api_token 필드 추가
- app.py: _get_agent에 query_rewrite_enabled 누락 수정
- requirements.txt: fastapi, uvicorn[standard], python-multipart 추가
- ROADMAP: Phase 22 , Telegram Bot 클라이언트 예시 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sal
2026-05-29 20:11:49 +09:00
parent 432cc9565c
commit 2e9e8a33fe
6 changed files with 176 additions and 33 deletions
+1
View File
@@ -71,6 +71,7 @@ def _get_agent(user_id: str) -> AgentService:
rag_show_sources=_cfg.rag_show_sources,
langgraph_verbose=_cfg.langgraph_verbose,
think_verbose=_cfg.think_verbose,
query_rewrite_enabled=_cfg.query_rewrite_enabled,
user_profile_repository=container.user_profile_repository(),
conversation_repository=container.conversation_repository(),
user_id=user_id,