feat: додано Node Registry, GreenFood, Monitoring та Utils

This commit is contained in:
Apple
2025-11-21 00:35:41 -08:00
parent 31f3602047
commit e018b9ab68
74 changed files with 13948 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
from fastapi import APIRouter
from .bots_registry import bots_registry
from .telegram_listener import telegram_listener
router = APIRouter(prefix="/debug", tags=["debug"])
@router.get("/bots")
async def list_bots():
"""Список зареєстрованих ботів"""
return {
"registered_bots": len(telegram_listener._bots),
"bot_tokens": [token[:16] + "..." for token in telegram_listener._bots.keys()],
"registry_mappings": len(bots_registry._agent_to_token),
"active_tasks": len(telegram_listener._tasks)
}
@router.get("/bots/tasks")
async def list_tasks():
"""Статус polling tasks"""
tasks_status = {}
for token, task in telegram_listener._tasks.items():
tasks_status[token[:16] + "..."] = {
"done": task.done(),
"cancelled": task.cancelled(),
}
if task.done() and not task.cancelled():
try:
task.result()
except Exception as e:
tasks_status[token[:16] + "..."]["error"] = str(e)
return tasks_status