mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 02:47:52 +01:00
Split overlap size in two
This commit is contained in:
parent
39721b6a8f
commit
bcfc4d5c64
@ -603,11 +603,12 @@ function getPromptText(queriedMessages) {
|
||||
* @returns {string} Overlapped chunks, with overlap trimmed to sentence boundaries
|
||||
*/
|
||||
function overlapChunks(chunk, index, chunks, overlapSize) {
|
||||
const halfOverlap = Math.floor(overlapSize / 2);
|
||||
const nextChunk = chunks[index + 1];
|
||||
const prevChunk = chunks[index - 1];
|
||||
|
||||
const nextOverlap = trimToEndSentence(nextChunk?.substring(0, overlapSize)) || '';
|
||||
const prevOverlap = trimToStartSentence(prevChunk?.substring(prevChunk.length - overlapSize)) || '';
|
||||
const nextOverlap = trimToEndSentence(nextChunk?.substring(0, halfOverlap)) || '';
|
||||
const prevOverlap = trimToStartSentence(prevChunk?.substring(prevChunk.length - halfOverlap)) || '';
|
||||
const overlappedChunk = [prevOverlap, chunk, nextOverlap].filter(x => x).join(' ');
|
||||
|
||||
return overlappedChunk;
|
||||
|
Loading…
x
Reference in New Issue
Block a user