Spaces:
Runtime error
Runtime error
Download src/lib/server/sendSlack.ts from evijit/pluralchat: direct link, hf CLI and curl.
- Browser
- Download file 567 Bytes
-
https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/server/sendSlack.ts
- Command line
-
hf download hf://spaces/evijit/pluralchat@refs/pr/1/src/lib/server/sendSlack.ts
-
curl -L -o sendSlack.ts https://huggingface.co/spaces/evijit/pluralchat/resolve/refs%2Fpr%2F1/src/lib/server/sendSlack.ts
567 Bytes
| import { config } from "$lib/server/config"; | |
| import { logger } from "$lib/server/logger"; | |
| export async function sendSlack(text: string) { | |
| if (!config.WEBHOOK_URL_REPORT_ASSISTANT) { | |
| logger.warn("WEBHOOK_URL_REPORT_ASSISTANT is not set, tried to send a slack message."); | |
| return; | |
| } | |
| const res = await fetch(config.WEBHOOK_URL_REPORT_ASSISTANT, { | |
| method: "POST", | |
| headers: { | |
| "Content-type": "application/json", | |
| }, | |
| body: JSON.stringify({ | |
| text, | |
| }), | |
| }); | |
| if (!res.ok) { | |
| logger.error(`Webhook message failed. ${res.statusText} ${res.text}`); | |
| } | |
| } | |