Skip to main content

continuation_overlap

Function continuation_overlap 

Source
pub fn continuation_overlap(prev: &str, continuation: &str) -> usize
Expand description

Length in bytes of the longest exact overlap between the tail of prev and the head of continuation — the “resume echo” a model sometimes emits when continuing a reply that was cut by a per-response output cap.

Deliberately conservative: exact match only, bounded search window, minimum overlap threshold. Used for DISPLAY/output joining only — the canonical conversation history is never trimmed — so a false negative costs a few repeated words on screen, while a false positive would delete real content. Returns a char-boundary-safe byte offset into continuation.