mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-22 07:34:47 +02:00
fix: !health packs into 2-3 messages with newlines inside
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
7670b7c0b9
commit
6bf0e3427e
1 changed files with 22 additions and 1 deletions
|
|
@ -1596,7 +1596,28 @@ class MeshReporter:
|
||||||
if region_parts:
|
if region_parts:
|
||||||
lines.append(" | ".join(region_parts))
|
lines.append(" | ".join(region_parts))
|
||||||
|
|
||||||
return lines
|
# Pack lines into 2-3 messages under 220 bytes each
|
||||||
|
MAX_BYTES = 220
|
||||||
|
messages = []
|
||||||
|
current_lines = []
|
||||||
|
current_bytes = 0
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
line_bytes = len(line.encode('utf-8'))
|
||||||
|
separator_bytes = 1 if current_lines else 0
|
||||||
|
|
||||||
|
if current_bytes + separator_bytes + line_bytes > MAX_BYTES and current_lines:
|
||||||
|
messages.append("\n".join(current_lines))
|
||||||
|
current_lines = [line]
|
||||||
|
current_bytes = line_bytes
|
||||||
|
else:
|
||||||
|
current_lines.append(line)
|
||||||
|
current_bytes += separator_bytes + line_bytes
|
||||||
|
|
||||||
|
if current_lines:
|
||||||
|
messages.append("\n".join(current_lines))
|
||||||
|
|
||||||
|
return messages
|
||||||
|
|
||||||
def _region_lora_compact(self, region) -> list[str]:
|
def _region_lora_compact(self, region) -> list[str]:
|
||||||
"""Compact region display. Returns list of messages."""
|
"""Compact region display. Returns list of messages."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue