mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-21 15:14:45 +02:00
fix: Short sentence instruction + chunker splits instead of truncating
- Added CRITICAL instruction to keep sentences under 150 chars - Chunker now splits long sentences at word boundaries instead of truncating - No words lost when splitting Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
51969050da
commit
8d1a48ea08
2 changed files with 189 additions and 182 deletions
|
|
@ -77,8 +77,14 @@ def chunk_response(
|
|||
current_len = 0
|
||||
# Don't increment sentence_idx — retry this sentence in next message
|
||||
else:
|
||||
# Single sentence exceeds max_chars — truncate it
|
||||
messages.append(sentence[:max_chars])
|
||||
# Single sentence exceeds max_chars — split at last word boundary
|
||||
break_point = sentence[:max_chars].rfind(' ')
|
||||
if break_point <= 0:
|
||||
break_point = max_chars
|
||||
messages.append(sentence[:break_point].rstrip())
|
||||
leftover = sentence[break_point:].lstrip()
|
||||
if leftover:
|
||||
sentences.insert(sentence_idx + 1, leftover)
|
||||
sentence_idx += 1
|
||||
|
||||
# Flush any remaining buffered message
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ RESPONSE STYLE:
|
|||
- Include scores, percentages, node counts, battery levels, gateway counts
|
||||
- You CAN use 3-5 messages if needed — LoRa chunking handles splitting
|
||||
- No markdown formatting — plain text only
|
||||
- CRITICAL: Keep every sentence under 150 characters. Break long thoughts into multiple short sentences. The message system handles multiple sentences perfectly but will truncate a single long sentence.
|
||||
|
||||
ANSWERING COVERAGE QUESTIONS:
|
||||
- Reference geographic areas by local name from the region config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue