refactor: AI 서비스 조립컴 Ollama 단독 운영으로 전환

- Ollama 메인 → MLX fallback 순서로 변경 (기존 MLX 우선 제거)
- OLLAMA_BASE_URL을 gpu.hyungi.net으로 변경 (Docker 네트워크 호환)
- OLLAMA_TEXT_MODEL을 qwen3:8b → qwen3.5:9b-q8_0으로 업데이트
- health 엔드포인트: model 필드 직접 반환, 이중 중첩 해소
- health 체크 타임아웃 120초 → 5초로 단축
- Ollama API 호출에 think: false 추가 (thinking 토큰 방지)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-07 12:51:53 +09:00
parent 59cbcebb94
commit e9d73ee30e
4 changed files with 38 additions and 23 deletions

View File

@@ -7,12 +7,24 @@ router = APIRouter(tags=["health"])
@router.get("/health")
async def health_check():
ollama_status = await ollama_client.check_health()
backends = await ollama_client.check_health()
stats = vector_store.stats()
# 메인 텍스트 모델명 결정 (Ollama 메인, MLX fallback)
model_name = None
ollama_models = backends.get("ollama", {}).get("models", [])
if ollama_models:
model_name = ollama_models[0]
if not model_name and backends.get("mlx", {}).get("status") == "connected":
model_name = backends["mlx"].get("model")
return {
"status": "ok",
"service": "tk-ai-service",
"ollama": ollama_status,
"embeddings": vector_store.stats(),
"model": model_name,
"ollama": backends.get("ollama", {}),
"mlx": backends.get("mlx", {}),
"embeddings": stats,
}