From 8e20a7e035191279810af736e2169b5bbf04428f Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 17 Mar 2026 01:47:35 -0700 Subject: [PATCH] fix(gateway): strip MEDIA: and [[audio_as_voice]] tags from message body * fix(gateway): strip MEDIA: and [[audio_as_voice]] tags from message body Closes #1561 * fix: remove redundant re import, use existing import --------- Co-authored-by: mettin4 --- gateway/platforms/base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gateway/platforms/base.py b/gateway/platforms/base.py index 2e34242e..a262d900 100644 --- a/gateway/platforms/base.py +++ b/gateway/platforms/base.py @@ -908,6 +908,9 @@ class BasePlatformAdapter(ABC): # Extract image URLs and send them as native platform attachments images, text_content = self.extract_images(response) + # Strip any remaining internal directives from message body (fixes #1561) + text_content = text_content.replace("[[audio_as_voice]]", "").strip() + text_content = re.sub(r"MEDIA:\s*\S+", "", text_content).strip() if images: logger.info("[%s] extract_images found %d image(s) in response (%d chars)", self.name, len(images), len(response))