From c17d825bbac86365488b586b2c05660e74a9276e Mon Sep 17 00:00:00 2001 From: gravelBridge Date: Wed, 14 Jun 2023 03:43:06 -0700 Subject: [PATCH] Remove urls tts macos (#4260) Co-authored-by: k-boikov <64261260+k-boikov@users.noreply.github.com> Co-authored-by: Nicholas Tindle Co-authored-by: Luke K (pr-0f3t) <2609441+lc0rp@users.noreply.github.com> --- autogpt/speech/base.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autogpt/speech/base.py b/autogpt/speech/base.py index a7570d94..07c8d9fe 100644 --- a/autogpt/speech/base.py +++ b/autogpt/speech/base.py @@ -1,5 +1,6 @@ """Base class for all voice classes.""" import abc +import re from threading import Lock from autogpt.singleton import AbstractSingleton @@ -29,6 +30,11 @@ class VoiceBase(AbstractSingleton): text (str): The text to say. voice_index (int): The index of the voice to use. """ + text = re.sub( + r"\b(?:https?://[-\w_.]+/?\w[-\w_.]*\.(?:[-\w_.]+/?\w[-\w_.]*\.)?[a-z]+(?:/[-\w_.%]+)*\b(?!\.))", + "", + text, + ) with self._mutex: return self._speech(text, voice_index)