feat: Add Alateya, Clan, Eonarch agents + fix gateway-router connection
## Agents Added - Alateya: R&D, biotech, innovations - Clan (Spirit): Community spirit agent - Eonarch: Consciousness evolution agent ## Changes - docker-compose.node1.yml: Added tokens for all 3 new agents - gateway-bot/http_api.py: Added configs and webhook endpoints - gateway-bot/clan_prompt.txt: New prompt file - gateway-bot/eonarch_prompt.txt: New prompt file ## Fixes - Fixed ROUTER_URL from :9102 to :8000 (internal container port) - All 9 Telegram agents now working ## Documentation - Created PROJECT-MASTER-INDEX.md - single entry point - Added various status documents and scripts Tokens configured: - Helion, NUTRA, Agromatrix (existing) - Alateya, Clan, Eonarch (new) - Druid, GreenFood, DAARWIZZ (configured)
This commit is contained in:
@@ -11,7 +11,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Router configuration from environment
|
||||
ROUTER_BASE_URL = os.getenv("ROUTER_URL", "http://127.0.0.1:9102")
|
||||
ROUTER_TIMEOUT = 60.0 # Increased for cloud API calls
|
||||
# Increased timeout for image generation + LLM calls (FLUX takes ~17s, LLM can take 30-60s)
|
||||
ROUTER_TIMEOUT = float(os.getenv("ROUTER_TIMEOUT", "180.0"))
|
||||
|
||||
|
||||
async def send_to_router(body: Dict[str, Any]) -> Dict[str, Any]:
|
||||
@@ -29,23 +30,38 @@ async def send_to_router(body: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""
|
||||
agent_id = body.get("agent", "devtools")
|
||||
message = body.get("message", "")
|
||||
system_prompt = body.get("system_prompt")
|
||||
metadata = body.get("metadata", {})
|
||||
context = body.get("context", {})
|
||||
|
||||
# Get system_prompt - check both body level and context level
|
||||
system_prompt = body.get("system_prompt") or context.get("system_prompt")
|
||||
|
||||
if system_prompt:
|
||||
logger.info(f"Using system prompt ({len(system_prompt)} chars) for agent {agent_id}")
|
||||
|
||||
# Build infer request
|
||||
infer_url = f"{ROUTER_BASE_URL}/v1/agents/{agent_id}/infer"
|
||||
|
||||
# Ensure agent_id is in metadata for memory storage
|
||||
metadata["agent_id"] = agent_id
|
||||
|
||||
infer_body = {
|
||||
"prompt": message,
|
||||
"system_prompt": system_prompt,
|
||||
"metadata": metadata
|
||||
}
|
||||
|
||||
# Pass images if present in context
|
||||
images = context.get("images", [])
|
||||
if images:
|
||||
infer_body["images"] = images
|
||||
logger.info(f"Including {len(images)} image(s) in request")
|
||||
|
||||
# Pass provider override if specified
|
||||
if metadata.get("provider"):
|
||||
infer_body["provider_override"] = metadata["provider"]
|
||||
|
||||
logger.info(f"Sending to Router ({infer_url}): agent={agent_id}, provider={metadata.get('provider', 'default')}")
|
||||
logger.info(f"Sending to Router ({infer_url}): agent={agent_id}, provider={metadata.get('provider', 'default')}, has_images={bool(images)}")
|
||||
|
||||
try:
|
||||
async with httpx.AsyncClient(timeout=ROUTER_TIMEOUT) as client:
|
||||
@@ -58,11 +74,13 @@ async def send_to_router(body: Dict[str, Any]) -> Dict[str, Any]:
|
||||
return {
|
||||
"ok": True,
|
||||
"data": {
|
||||
"text": result.get("response", result.get("text", ""))
|
||||
"text": result.get("response", result.get("text", "")),
|
||||
"image_base64": result.get("image_base64") # Generated image
|
||||
},
|
||||
"response": result.get("response", result.get("text", "")),
|
||||
"model": result.get("model"),
|
||||
"backend": result.get("backend")
|
||||
"backend": result.get("backend"),
|
||||
"image_base64": result.get("image_base64") # For easy access
|
||||
}
|
||||
|
||||
except httpx.HTTPError as e:
|
||||
|
||||
Reference in New Issue
Block a user