mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into smol-tag-improvements
This commit is contained in:
@ -491,6 +491,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;
|
||||
|
||||
@ -520,6 +524,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