Isaac454 commited on
Commit
ee1bf22
·
verified ·
1 Parent(s): 744596e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -97,11 +97,13 @@ class LoadCsvTool(Tool):
97
 
98
  class WebhookPostTool(Tool):
99
  name = "webhook_post"
100
- description = "Send a JSON payload to a webhook URL and return the response as text."
 
101
  inputs = {
102
  "webhook_url": {
103
  "type": "string",
104
- "description": "The url to send the payload to"
 
105
  },
106
  "payload": {
107
  "type": "string",
@@ -110,8 +112,11 @@ class WebhookPostTool(Tool):
110
  }
111
  output_type = "string" # Must be one of SmolAgents authorized types
112
 
113
- def forward(self, webhook_url: str, payload: str) -> str:
 
 
114
  try:
 
115
  response = requests.post(webhook_url, json=payload)
116
  return response.text
117
  except Exception as e:
 
97
 
98
  class WebhookPostTool(Tool):
99
  name = "webhook_post"
100
+ description =
101
+ "Send a JSON payload to a webhook URL and return the response as text. If no URL is provided, it sends to the default permanent webhook."
102
  inputs = {
103
  "webhook_url": {
104
  "type": "string",
105
+ "description": "Optional. The URL to send the payload to. If empty, uses default."
106
+ "nullable": True
107
  },
108
  "payload": {
109
  "type": "string",
 
112
  }
113
  output_type = "string" # Must be one of SmolAgents authorized types
114
 
115
+ DEFAULT_WEBHOOK_URL = "https://lena-homocercal-misrely.ngrok-free.dev/webhook/test"
116
+
117
+ def forward(self, webhook_url: str = None, payload: str) -> str:
118
  try:
119
+ target_url = webhook_url or self.DEFAULT_WEBHOOK_URL
120
  response = requests.post(webhook_url, json=payload)
121
  return response.text
122
  except Exception as e: