Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8397,6 +8397,8 @@ def _voice_speak_response(self, text: str):
tts_text = re.sub(r'^\s*[-*]\s+', '', tts_text, flags=re.MULTILINE) # list items
tts_text = re.sub(r'---+', '', tts_text) # horizontal rules
tts_text = re.sub(r'\n{3,}', '\n\n', tts_text) # excessive newlines
# Strip emojis so TTS doesn't read out emoji descriptions
tts_text = re.sub(r'[\U0001F600-\U0001F64F\U0001F300-\U0001F5FF\U0001F680-\U0001F6FF\U0001F1E0-\U0001F1FF\U00002702-\U000027B0\U0000FE00-\U0000FE0F\U0001F900-\U0001F9FF\U0001FA00-\U0001FA6F\U0001FA70-\U0001FAFF\U00002600-\U000026FF\U0000200D]+', '', tts_text)
tts_text = tts_text.strip()
if not tts_text:
return
Expand Down
2 changes: 2 additions & 0 deletions hermes_cli/voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ def speak_text(text: str) -> None:
tts_text = re.sub(r'^\s*[-*]\s+', '', tts_text, flags=re.MULTILINE) # list bullets
tts_text = re.sub(r'---+', '', tts_text) # horizontal rules
tts_text = re.sub(r'\n{3,}', '\n\n', tts_text) # excess newlines
# Strip emojis so TTS doesn't read out emoji descriptions
tts_text = re.sub(r'[\U0001F600-\U0001F64F\U0001F300-\U0001F5FF\U0001F680-\U0001F6FF\U0001F1E0-\U0001F1FF\U00002702-\U000027B0\U0000FE00-\U0000FE0F\U0001F900-\U0001F9FF\U0001FA00-\U0001FA6F\U0001FA70-\U0001FAFF\U00002600-\U000026FF\U0000200D]+', '', tts_text)
tts_text = tts_text.strip()
if not tts_text:
return
Expand Down
13 changes: 13 additions & 0 deletions tools/tts_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,19 @@ def _strip_markdown_for_tts(text: str) -> str:
text = _MD_LIST_ITEM.sub('', text)
text = _MD_HR.sub('', text)
text = _MD_EXCESS_NL.sub('\n\n', text)
# Strip emojis so TTS doesn't read out emoji descriptions
text = re.sub(r'[\U0001F600-\U0001F64F' # emoticons

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This helper is not called by text_to_speech_tool(): current main dispatches its raw text argument directly to every provider. Please extract a shared normalizer and invoke it at the tool boundary as well, so agent-issued text_to_speech calls receive the same cleanup.

r'\U0001F300-\U0001F5FF' # symbols & pictographs
r'\U0001F680-\U0001F6FF' # transport & map
r'\U0001F1E0-\U0001F1FF' # flags
r'\U00002702-\U000027B0' # dingbats
r'\U0000FE00-\U0000FE0F' # variation selectors
r'\U0001F900-\U0001F9FF' # supplemental symbols
r'\U0001FA00-\U0001FA6F' # chess symbols
r'\U0001FA70-\U0001FAFF' # symbols extended-A
r'\U00002600-\U000026FF' # misc symbols
r'\U0000200D' # zero-width joiner
r']+', '', text)
return text.strip()


Expand Down