zenaight commited on
Commit ·
ba3605b
1
Parent(s): 6364981
Add root endpoint for health check and update server port
Browse files- Introduced a new root endpoint (`/`) that provides a health check response, including application status and available endpoints.
- Updated the server to run on port 8080 instead of the previous port 7860, aligning with the latest configuration standards.
- These changes enhance the application's monitoring capabilities and improve accessibility for health checks.
main.py
CHANGED
|
@@ -14,6 +14,20 @@ app = FastAPI(title="PropAgent", description="WhatsApp AI Agent with Supabase in
|
|
| 14 |
# Include all API routes
|
| 15 |
app.include_router(router)
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# --- WhatsApp Webhook Handler ---
|
| 18 |
@app.post("/webhook")
|
| 19 |
async def receive_message(req: Request):
|
|
@@ -113,4 +127,4 @@ async def startup_event():
|
|
| 113 |
|
| 114 |
if __name__ == "__main__":
|
| 115 |
import uvicorn
|
| 116 |
-
uvicorn.run(app, host="0.0.0.0", port=
|
|
|
|
| 14 |
# Include all API routes
|
| 15 |
app.include_router(router)
|
| 16 |
|
| 17 |
+
# --- Root Endpoint ---
|
| 18 |
+
@app.get("/")
|
| 19 |
+
async def root():
|
| 20 |
+
"""Root endpoint for health check"""
|
| 21 |
+
return {
|
| 22 |
+
"message": "PropAgent WhatsApp AI Agent is running!",
|
| 23 |
+
"status": "healthy",
|
| 24 |
+
"endpoints": {
|
| 25 |
+
"webhook": "/webhook",
|
| 26 |
+
"health": "/health",
|
| 27 |
+
"ping": "/ping"
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
# --- WhatsApp Webhook Handler ---
|
| 32 |
@app.post("/webhook")
|
| 33 |
async def receive_message(req: Request):
|
|
|
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
import uvicorn
|
| 130 |
+
uvicorn.run(app, host="0.0.0.0", port=8080)
|