Spaces:
Running
Running
Update app/app.py
Browse files- app/app.py +17 -19
app/app.py
CHANGED
|
@@ -30,17 +30,17 @@ import asyncio
|
|
| 30 |
from typing import Dict, Any, Optional
|
| 31 |
|
| 32 |
# =============================================================================
|
| 33 |
-
# Import app/* modules
|
| 34 |
# Each module reads its own config from app/.pyfun independently.
|
| 35 |
# NO fundaments passed into these modules!
|
| 36 |
# =============================================================================
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
#from . import
|
| 40 |
-
#from . import
|
| 41 |
-
#from . import
|
| 42 |
-
|
| 43 |
-
#
|
| 44 |
|
| 45 |
# Future modules (uncomment when ready):
|
| 46 |
# from . import discord_api # Discord bot integration
|
|
@@ -51,13 +51,13 @@ from typing import Dict, Any, Optional
|
|
| 51 |
# =============================================================================
|
| 52 |
# Loggers β one per module for clean log filtering
|
| 53 |
# =============================================================================
|
| 54 |
-
logger
|
| 55 |
-
|
|
|
|
| 56 |
# logger_tools = logging.getLogger('tools')
|
| 57 |
# logger_providers = logging.getLogger('providers')
|
| 58 |
# logger_models = logging.getLogger('models')
|
| 59 |
# logger_db_sync = logging.getLogger('db_sync')
|
| 60 |
-
#logger_config = logging.getLogger('config')
|
| 61 |
|
| 62 |
# =============================================================================
|
| 63 |
# Quart app instance
|
|
@@ -112,7 +112,6 @@ async def health_check():
|
|
| 112 |
"status": "running",
|
| 113 |
"service": "Universal MCP Hub",
|
| 114 |
"uptime_seconds": int(uptime.total_seconds()),
|
| 115 |
-
"active_providers": providers.get_active_names(),
|
| 116 |
})
|
| 117 |
|
| 118 |
|
|
@@ -199,14 +198,13 @@ async def start_application(fundaments: Dict[str, Any]) -> None:
|
|
| 199 |
logger.info("Database-free mode active (e.g. Discord bot, API client).")
|
| 200 |
|
| 201 |
# =========================================================================
|
| 202 |
-
# Initialize app/* internal services
|
| 203 |
-
#
|
| 204 |
-
# NO fundaments passed in here!
|
| 205 |
# =========================================================================
|
| 206 |
-
db_sync.initialize() # SQLite IPC store for app/* β unrelated to postgresql.py
|
| 207 |
-
providers.initialize() # reads app/.pyfun [LLM_PROVIDERS] [SEARCH_PROVIDERS]
|
| 208 |
-
models.initialize() # reads app/.pyfun [MODELS]
|
| 209 |
-
tools.initialize() # reads app/.pyfun [TOOLS]
|
| 210 |
|
| 211 |
# --- Read PORT from app/.pyfun [HUB] ---
|
| 212 |
port = int(app_config.get_hub().get("HUB_PORT", "7860"))
|
|
|
|
| 30 |
from typing import Dict, Any, Optional
|
| 31 |
|
| 32 |
# =============================================================================
|
| 33 |
+
# Import app/* modules β MINIMAL BUILD (uncomment when module is ready)
|
| 34 |
# Each module reads its own config from app/.pyfun independently.
|
| 35 |
# NO fundaments passed into these modules!
|
| 36 |
# =============================================================================
|
| 37 |
+
from . import mcp # MCP transport layer (stdio / SSE)
|
| 38 |
+
from . import config as app_config # app/.pyfun parser β used only in app/*
|
| 39 |
+
# from . import providers # API provider registry β reads app/.pyfun
|
| 40 |
+
# from . import models # Model config + token/rate limits β reads app/.pyfun
|
| 41 |
+
# from . import tools # MCP tool definitions + provider mapping β reads app/.pyfun
|
| 42 |
+
# from . import db_sync # Internal SQLite IPC β app/* state & communication
|
| 43 |
+
# # db_sync β postgresql.py! Cloud DB is Guardian-only.
|
| 44 |
|
| 45 |
# Future modules (uncomment when ready):
|
| 46 |
# from . import discord_api # Discord bot integration
|
|
|
|
| 51 |
# =============================================================================
|
| 52 |
# Loggers β one per module for clean log filtering
|
| 53 |
# =============================================================================
|
| 54 |
+
logger = logging.getLogger('application')
|
| 55 |
+
logger_mcp = logging.getLogger('mcp')
|
| 56 |
+
logger_config = logging.getLogger('config')
|
| 57 |
# logger_tools = logging.getLogger('tools')
|
| 58 |
# logger_providers = logging.getLogger('providers')
|
| 59 |
# logger_models = logging.getLogger('models')
|
| 60 |
# logger_db_sync = logging.getLogger('db_sync')
|
|
|
|
| 61 |
|
| 62 |
# =============================================================================
|
| 63 |
# Quart app instance
|
|
|
|
| 112 |
"status": "running",
|
| 113 |
"service": "Universal MCP Hub",
|
| 114 |
"uptime_seconds": int(uptime.total_seconds()),
|
|
|
|
| 115 |
})
|
| 116 |
|
| 117 |
|
|
|
|
| 198 |
logger.info("Database-free mode active (e.g. Discord bot, API client).")
|
| 199 |
|
| 200 |
# =========================================================================
|
| 201 |
+
# Initialize app/* internal services β MINIMAL BUILD
|
| 202 |
+
# Uncomment each line when the module is ready!
|
|
|
|
| 203 |
# =========================================================================
|
| 204 |
+
# db_sync.initialize() # SQLite IPC store for app/* β unrelated to postgresql.py
|
| 205 |
+
# providers.initialize() # reads app/.pyfun [LLM_PROVIDERS] [SEARCH_PROVIDERS]
|
| 206 |
+
# models.initialize() # reads app/.pyfun [MODELS]
|
| 207 |
+
# tools.initialize() # reads app/.pyfun [TOOLS]
|
| 208 |
|
| 209 |
# --- Read PORT from app/.pyfun [HUB] ---
|
| 210 |
port = int(app_config.get_hub().get("HUB_PORT", "7860"))
|