Bug Description
Description
When Hermes streams a response to Feishu, the message gains extra leading blank lines during streaming. The initial message appears correctly, but as soon as the first streaming edit is applied, 1–2 blank lines appear above the text content. The issue persists for the rest of the stream and the message is marked "(已编辑)" in the Feishu client.
Steps to Reproduce
- Configure Hermes with a Feishu bot (WebSocket or Webhook mode)
- Better switch to claude-haiku-4.5, coz he'd like to send lot's of "Perfect! ....." new message.
- Send a prompt that triggers a long/streamed response (e.g. one requiring tool use or search)
- Observe the message in the Feishu client while it is being streamed
Expected Behavior
The message text begins at the top of the bubble with no leading blank lines, both on initial send and during streaming edits.
(message is marked 已编辑)
Actual Behavior
After the first streaming edit, the message displays as:
(blank line)
(blank line)
Let me check the actual JIRA address...
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp), Other
Messaging Platform (if gateway-related)
N/A (CLI only)
Operating System
Ubuntu 22.04
Python Version
3.11.15
Hermes Version
v0.8.0
Relevant Logs / Traceback
Root Cause Analysis (optional)
send() calls format_message() which strips leading/trailing whitespace before building the outbound payload. edit_message() did not call format_message(), so it passed the raw LLM output (which commonly begins with \n\n) directly to _build_outbound_payload(). Feishu renders the leading \n\n as blank lines.
Additionally, _clean_for_display() in stream_consumer.py uses .rstrip() only, so leading newlines from the LLM stream are not removed before being passed to edit_message().
Proposed Fix (optional)
Add content = self.format_message(content) in edit_message() before the payload is built, matching the existing behavior in send().
Are you willing to submit a PR for this?
Bug Description
Description
When Hermes streams a response to Feishu, the message gains extra leading blank lines during streaming. The initial message appears correctly, but as soon as the first streaming edit is applied, 1–2 blank lines appear above the text content. The issue persists for the rest of the stream and the message is marked "(已编辑)" in the Feishu client.
Steps to Reproduce
Expected Behavior
The message text begins at the top of the bubble with no leading blank lines, both on initial send and during streaming edits.
(message is marked 已编辑)
Actual Behavior
After the first streaming edit, the message displays as:
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp), Other
Messaging Platform (if gateway-related)
N/A (CLI only)
Operating System
Ubuntu 22.04
Python Version
3.11.15
Hermes Version
v0.8.0
Relevant Logs / Traceback
Root Cause Analysis (optional)
send()callsformat_message()which strips leading/trailing whitespace before building the outbound payload.edit_message()did not callformat_message(), so it passed the raw LLM output (which commonly begins with\n\n) directly to_build_outbound_payload(). Feishu renders the leading\n\nas blank lines.Additionally,
_clean_for_display()instream_consumer.pyuses.rstrip()only, so leading newlines from the LLM stream are not removed before being passed toedit_message().Proposed Fix (optional)
Add
content = self.format_message(content)inedit_message()before the payload is built, matching the existing behavior insend().Are you willing to submit a PR for this?