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()