Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
.env
# Python 기본 캐시 및 빌드 파일
__pycache__/
*.py[cod]
*.pyo
*.pyd

# 가상환경 디렉토리 (venv, env 등)
venv/
env/

# 에디터/IDE 관련 파일
.vscode/
.idea/

# 환경 설정 파일
.env

# macOS 시스템 파일
.DS_Store

# pytest / mypy 캐시
.mypy_cache/
.pytest_cache/

# Jupyter Notebook 체크포인트
.ipynb_checkpoints/

# 파이썬 빌드 결과물
build/
dist/
*.egg-info/

# FastAPI 자동 문서 캐시 (거의 없지만 혹시 대비)
openapi.json
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/silverbridgeX_ai.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

Empty file added api/__init__.py
Empty file.
19 changes: 19 additions & 0 deletions api/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from fastapi import APIRouter
from service.health import check_user_server_health, check_chat_server_health

router = APIRouter(tags=["Health Check"])


@router.get("/health")
async def healthcheck():
return {"message": "AI server is healthy"}


@router.get("/check/user-server")
async def check_user_server():
return check_user_server_health()


@router.get("/check/chat-server")
async def check_chat_server():
return check_chat_server_health()
17 changes: 2 additions & 15 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
from fastapi import FastAPI
from service import *
from api import health

app = FastAPI(root_path="/ai")


@app.get("/health")
async def healthcheck():
return {"message": "AI server is healthy"}

@app.get("/check/user-server")
async def check_user_server():
data = check_user_server_health()
return data

@app.get("/check/chat-server")
async def check_chat_server():
data = check_chat_server_health()
return data
app.include_router(health.router)
Empty file added service/__init__.py
Empty file.
4 changes: 3 additions & 1 deletion service.py → service/health.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import requests
from config import settings


def check_user_server_health():
url = f"{settings.USER_SERVER_URL}/health"
response = requests.get(url)
return response.json()


def check_chat_server_health():
url = f"{settings.CHAT_SERVER_URL}/health"
response = requests.get(url)
return response.json()
return response.json()