Files
tk-factory-services/ai-service/routers/health.py
Hyungi Ahn 85f674c9cb feat: ai-service를 ds923에서 맥미니로 이전
- ChromaDB → Qdrant 전환 (맥미니 기존 인스턴스, tk_qc_issues 컬렉션)
- Ollama 임베딩/텍스트 생성 URL 분리 (임베딩: 맥미니, 텍스트: GPU서버)
- MLX fallback 제거, Ollama 단일 경로로 단순화
- ds923 docker-compose에서 ai-service 제거
- gateway/system3-web nginx: ai-service 프록시를 ai.hyungi.net 경유로 변경
- resolver + 변수 기반 proxy_pass로 런타임 DNS 해석 (컨테이너 시작 실패 방지)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:36:42 +09:00

32 lines
826 B
Python

from fastapi import APIRouter
from services.ollama_client import ollama_client
from db.vector_store import vector_store
router = APIRouter(tags=["health"])
@router.get("/health")
async def health_check():
backends = await ollama_client.check_health()
stats = vector_store.stats()
# 메인 텍스트 모델명 결정
model_name = None
text_models = backends.get("ollama_text", {}).get("models", [])
if text_models:
model_name = text_models[0]
return {
"status": "ok",
"service": "tk-ai-service",
"model": model_name,
"ollama_text": backends.get("ollama_text", {}),
"ollama_embed": backends.get("ollama_embed", {}),
"embeddings": stats,
}
@router.get("/models")
async def list_models():
return await ollama_client.check_health()