From d81fbcac1f9d1b5b7ae092a56451f24e499b3b96 Mon Sep 17 00:00:00 2001 From: Ekaropolus Date: Thu, 18 Sep 2025 15:28:11 -0600 Subject: [PATCH] Agents with text fiedl --- pxy_agents_coral/views.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/pxy_agents_coral/views.py b/pxy_agents_coral/views.py index 935d978..8bc8f31 100644 --- a/pxy_agents_coral/views.py +++ b/pxy_agents_coral/views.py @@ -22,13 +22,9 @@ AGENTS_INTERNAL_BASE = getattr(settings, "AGENTS_INTERNAL_BASE", "") @csrf_exempt -@require_http_methods(["GET", "POST"]) # accept both because the bot posts by default +@require_http_methods(["GET", "POST"]) def agents_list(request): - """ - List available agents (SAMI, Sites) with their contracts & execute endpoints. - Accepts GET and POST (POST to support simple bot routers that only POST). - """ - base = request.build_absolute_uri("/")[:-1] # absolute base, no trailing slash + base = request.build_absolute_uri("/")[:-1] agents = [ { "agent": "sami", @@ -49,7 +45,18 @@ def agents_list(request): "description": "Site scoring (access, demand, competition) with maps", }, ] - return JsonResponse({"agents": agents}) + + # 👇 add a simple text summary the bot can send + lines = ["Available agents:"] + for a in agents: + lines.append(f"- {a['agent']}: {a['description']}") + lines.append("") + lines.append("Try:") + lines.append('/sami {"indicator":"imss_wages_2023","cities":["CDMX","GDL","MTY"]}') + lines.append('/sites {"city":"CDMX","business":"cafe","time_bands":[10,20]}') + + return JsonResponse({"agents": agents, "text": "\n".join(lines)}) + @csrf_exempt