Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -97,11 +97,13 @@ class LoadCsvTool(Tool):
|
|
| 97 |
|
| 98 |
class WebhookPostTool(Tool):
|
| 99 |
name = "webhook_post"
|
| 100 |
-
description =
|
|
|
|
| 101 |
inputs = {
|
| 102 |
"webhook_url": {
|
| 103 |
"type": "string",
|
| 104 |
-
"description": "The
|
|
|
|
| 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 |
-
|
|
|
|
|
|
|
| 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:
|