anderson-ufrj
commited on
Commit
·
4db0138
1
Parent(s):
c159ec7
fix: add test endpoints to verify Portal da Transparência integration
Browse files- Add last_update timestamp to root endpoint
- Add /test-portal endpoint to check integration status
- Show available Portal endpoints for easier debugging
- src/api/app.py +18 -1
src/api/app.py
CHANGED
|
@@ -675,10 +675,27 @@ async def root():
|
|
| 675 |
"description": "API para investigação inteligente de dados públicos brasileiros",
|
| 676 |
"documentation": "/docs",
|
| 677 |
"health": "/health",
|
| 678 |
-
"status": "operational"
|
|
|
|
|
|
|
| 679 |
}
|
| 680 |
|
| 681 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
# API info endpoint
|
| 683 |
@app.get("/api/v1/info", tags=["General"])
|
| 684 |
async def api_info():
|
|
|
|
| 675 |
"description": "API para investigação inteligente de dados públicos brasileiros",
|
| 676 |
"documentation": "/docs",
|
| 677 |
"health": "/health",
|
| 678 |
+
"status": "operational",
|
| 679 |
+
"portal_integration": "active",
|
| 680 |
+
"last_update": "2025-01-25 15:00:00 UTC"
|
| 681 |
}
|
| 682 |
|
| 683 |
|
| 684 |
+
# Test Portal endpoint
|
| 685 |
+
@app.get("/test-portal", include_in_schema=False)
|
| 686 |
+
async def test_portal():
|
| 687 |
+
"""Test Portal da Transparência integration status."""
|
| 688 |
+
import os
|
| 689 |
+
return {
|
| 690 |
+
"portal_integration": "enabled",
|
| 691 |
+
"api_key_configured": bool(os.getenv("TRANSPARENCY_API_KEY")),
|
| 692 |
+
"endpoints": {
|
| 693 |
+
"chat_stable": "/api/v1/chat/stable",
|
| 694 |
+
"test_portal": "/api/v1/chat/test-portal/{query}",
|
| 695 |
+
"debug_status": "/api/v1/chat/debug/portal-status"
|
| 696 |
+
}
|
| 697 |
+
}
|
| 698 |
+
|
| 699 |
# API info endpoint
|
| 700 |
@app.get("/api/v1/info", tags=["General"])
|
| 701 |
async def api_info():
|