소스 검색

refac: discord webhook

Timothy Jaeryang Baek 4 달 전
부모
커밋
423fee347a
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      backend/open_webui/utils/webhook.py

+ 5 - 1
backend/open_webui/utils/webhook.py

@@ -19,7 +19,11 @@ def post_webhook(url: str, message: str, event_data: dict) -> bool:
             payload["text"] = message
         # Discord Webhooks
         elif "https://discord.com/api/webhooks" in url:
-            payload["content"] = message
+            payload["content"] = (
+                message
+                if len(message) > 2000
+                else f"{message[: 2000 - 14]}... (truncated)"
+            )
         # Microsoft Teams Webhooks
         elif "webhook.office.com" in url:
             action = event_data.get("action", "undefined")