mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix startup on safari / ios
This commit is contained in:
@ -130,7 +130,7 @@ async function generatePoe(type, finalPrompt) {
|
|||||||
// If prompt overflows the max context, reduce it (or the generation would fail)
|
// If prompt overflows the max context, reduce it (or the generation would fail)
|
||||||
// Split by sentence boundary and remove sentence-by-sentence from the beginning
|
// Split by sentence boundary and remove sentence-by-sentence from the beginning
|
||||||
while (getTokenCount(finalPrompt) > max_context) {
|
while (getTokenCount(finalPrompt) > max_context) {
|
||||||
const sentences = finalPrompt.split(/(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s/);
|
const sentences = finalPrompt.split(/([.?!])\s+/);
|
||||||
const removed = sentences.shift();
|
const removed = sentences.shift();
|
||||||
console.log(`Reducing Poe context due to overflow. Sentence dropped from prompt: "${removed}"`);
|
console.log(`Reducing Poe context due to overflow. Sentence dropped from prompt: "${removed}"`);
|
||||||
finalPrompt = sentences.join('');
|
finalPrompt = sentences.join('');
|
||||||
|
Reference in New Issue
Block a user