mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-05-21 23:24:44 +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
|
current_len = 0
|
||||||
# Don't increment sentence_idx — retry this sentence in next message
|
# Don't increment sentence_idx — retry this sentence in next message
|
||||||
else:
|
else:
|
||||||
# Single sentence exceeds max_chars — truncate it
|
# Single sentence exceeds max_chars — split at last word boundary
|
||||||
messages.append(sentence[:max_chars])
|
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
|
sentence_idx += 1
|
||||||
|
|
||||||
# Flush any remaining buffered message
|
# Flush any remaining buffered message
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ RESPONSE STYLE:
|
||||||
- Include scores, percentages, node counts, battery levels, gateway counts
|
- Include scores, percentages, node counts, battery levels, gateway counts
|
||||||
- You CAN use 3-5 messages if needed — LoRa chunking handles splitting
|
- You CAN use 3-5 messages if needed — LoRa chunking handles splitting
|
||||||
- No markdown formatting — plain text only
|
- 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:
|
ANSWERING COVERAGE QUESTIONS:
|
||||||
- Reference geographic areas by local name from the region config
|
- Reference geographic areas by local name from the region config
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue