Agents with text fiedl
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
b87d97e773
commit
d81fbcac1f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user