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))