Implement FastAPI status endpoint and main app
Browse files- api/main.py +11 -0
- api/status.py +12 -0
api/main.py
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from api.status import router as status_router
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
# Mount status endpoint
|
| 7 |
+
app.include_router(status_router, prefix="/api")
|
| 8 |
+
|
| 9 |
+
@app.get("/")
|
| 10 |
+
async def root():
|
| 11 |
+
return {"message": "AI Life Coach API is running"}
|
api/status.py
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import APIRouter
|
| 2 |
+
from services.ollama_monitor import check_ollama_status
|
| 3 |
+
|
| 4 |
+
router = APIRouter()
|
| 5 |
+
|
| 6 |
+
@router.get("/ollama-status")
|
| 7 |
+
async def get_ollama_status():
|
| 8 |
+
"""
|
| 9 |
+
Returns the current status of the Ollama service.
|
| 10 |
+
"""
|
| 11 |
+
status = check_ollama_status()
|
| 12 |
+
return status
|