mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add file chunks overlap control
This commit is contained in:
@ -477,6 +477,10 @@ export function sortByCssOrder(a, b) {
|
||||
* trimToEndSentence('Hello, world! I am from'); // 'Hello, world!'
|
||||
*/
|
||||
export function trimToEndSentence(input, include_newline = false) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const punctuation = new Set(['.', '!', '?', '*', '"', ')', '}', '`', ']', '$', '。', '!', '?', '”', ')', '】', '’', '」', '_']); // extend this as you see fit
|
||||
let last = -1;
|
||||
|
||||
@ -506,6 +510,10 @@ export function trimToEndSentence(input, include_newline = false) {
|
||||
}
|
||||
|
||||
export function trimToStartSentence(input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let p1 = input.indexOf('.');
|
||||
let p2 = input.indexOf('!');
|
||||
let p3 = input.indexOf('?');
|
||||
|
Reference in New Issue
Block a user