Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -573,6 +573,19 @@ async def health_check():
|
|
| 573 |
"token_configured": bool(HF_TOKEN)
|
| 574 |
}
|
| 575 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 576 |
@app.post("/chat", response_model=ChatResponse)
|
| 577 |
async def chat_endpoint(request: ChatRequest, background_tasks: BackgroundTasks):
|
| 578 |
"""Main chat endpoint with enhanced response structure"""
|
|
|
|
| 573 |
"token_configured": bool(HF_TOKEN)
|
| 574 |
}
|
| 575 |
|
| 576 |
+
@app.get("/db-test")
|
| 577 |
+
async def db_test():
|
| 578 |
+
try:
|
| 579 |
+
# Simple read test
|
| 580 |
+
result = db.client.table("users").select("count(*)", count="exact").execute()
|
| 581 |
+
return {
|
| 582 |
+
"status": "connected",
|
| 583 |
+
"users_count": result.count,
|
| 584 |
+
"supabase_url": db.client.options.url
|
| 585 |
+
}
|
| 586 |
+
except Exception as e:
|
| 587 |
+
return {"status": "error", "detail": str(e)}
|
| 588 |
+
|
| 589 |
@app.post("/chat", response_model=ChatResponse)
|
| 590 |
async def chat_endpoint(request: ChatRequest, background_tasks: BackgroundTasks):
|
| 591 |
"""Main chat endpoint with enhanced response structure"""
|