added endpoints and updated gitignore
Browse files- .gitignore +2 -1
- app.py +36 -1
.gitignore
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
.env
|
|
|
|
|
|
| 1 |
+
.env
|
| 2 |
+
.venv
|
app.py
CHANGED
|
@@ -384,7 +384,42 @@ Please process all {len(all_tags)} tags: {", ".join(all_tags)}
|
|
| 384 |
|
| 385 |
@app.get("/")
|
| 386 |
async def root():
|
| 387 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
|
| 389 |
@app.post("/webhook")
|
| 390 |
async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
|
|
|
|
| 384 |
|
| 385 |
@app.get("/")
|
| 386 |
async def root():
|
| 387 |
+
"""Root endpoint with basic information"""
|
| 388 |
+
return {
|
| 389 |
+
"name": "HF Tagging Bot",
|
| 390 |
+
"status": "running",
|
| 391 |
+
"description": "Webhook listener for automatic model tagging",
|
| 392 |
+
"endpoints": {
|
| 393 |
+
"webhook": "/webhook",
|
| 394 |
+
"health": "/health",
|
| 395 |
+
"operations": "/operations"
|
| 396 |
+
}
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
@app.get("/health")
|
| 400 |
+
async def health_check():
|
| 401 |
+
"""Health check endpoint for monitoring"""
|
| 402 |
+
agent = await get_agent()
|
| 403 |
+
|
| 404 |
+
return {
|
| 405 |
+
"status": "healthy",
|
| 406 |
+
"timestamp": datetime.now().isoformat(),
|
| 407 |
+
"components": {
|
| 408 |
+
"webhook_secret": "configured" if WEBHOOK_SECRET else "missing",
|
| 409 |
+
"hf_token": "configured" if HF_TOKEN else "missing",
|
| 410 |
+
"mcp_agent": "ready" if agent else "not_ready"
|
| 411 |
+
}
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
@app.get("/operations")
|
| 415 |
+
async def get_operations():
|
| 416 |
+
"""Get recent tag operations for monitoring"""
|
| 417 |
+
# Return last 50 operations
|
| 418 |
+
recent_ops = tag_operations_store[-50:] if tag_operations_store else []
|
| 419 |
+
return {
|
| 420 |
+
"total_operations": len(tag_operations_store),
|
| 421 |
+
"recent_operations": recent_ops
|
| 422 |
+
}
|
| 423 |
|
| 424 |
@app.post("/webhook")
|
| 425 |
async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
|