From 60531889d56a9a9d2b3f0b9ee04aea4145ede392 Mon Sep 17 00:00:00 2001 From: 0xchainer <109617724+0xchainer@users.noreply.github.com> Date: Sun, 17 May 2026 00:35:05 +0300 Subject: [PATCH] fix: remove unused import and hoist module-level constant - Remove unused from tools/tts_tool.py (dead code) - Move _BUILTIN_DELIVER_PLATFORMS set from send() method to module scope in gateway/platforms/webhook.py to avoid reallocation on every call --- gateway/platforms/webhook.py | 13 +++++++------ tools/tts_tool.py | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gateway/platforms/webhook.py b/gateway/platforms/webhook.py index 83aa93e94cb..d7714ff5652 100644 --- a/gateway/platforms/webhook.py +++ b/gateway/platforms/webhook.py @@ -54,6 +54,13 @@ from gateway.platforms.base import ( logger = logging.getLogger(__name__) +_BUILTIN_DELIVER_PLATFORMS = { + "telegram", "discord", "slack", "signal", "sms", "whatsapp", + "matrix", "mattermost", "homeassistant", "email", "dingtalk", + "feishu", "wecom", "wecom_callback", "weixin", "bluebubbles", + "qqbot", "yuanbao", +} + DEFAULT_HOST = "0.0.0.0" DEFAULT_PORT = 8644 _INSECURE_NO_AUTH = "INSECURE_NO_AUTH" @@ -238,12 +245,6 @@ class WebhookAdapter(BasePlatformAdapter): # Cross-platform delivery — any platform with a gateway adapter. # Check both built-in names and plugin-registered platforms. - _BUILTIN_DELIVER_PLATFORMS = { - "telegram", "discord", "slack", "signal", "sms", "whatsapp", - "matrix", "mattermost", "homeassistant", "email", "dingtalk", - "feishu", "wecom", "wecom_callback", "weixin", "bluebubbles", - "qqbot", "yuanbao", - } _is_known_platform = deliver_type in _BUILTIN_DELIVER_PLATFORMS if not _is_known_platform: try: diff --git a/tools/tts_tool.py b/tools/tts_tool.py index 57907f76833..9e46fa6a7ef 100644 --- a/tools/tts_tool.py +++ b/tools/tts_tool.py @@ -44,7 +44,6 @@ import queue import re import shlex import shutil -import signal import subprocess import tempfile import threading