mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Collapse newlines in prompt
This commit is contained in:
@ -34,6 +34,7 @@ import {
|
||||
import {
|
||||
force_pygmalion_formatting,
|
||||
collapse_newlines,
|
||||
collapseNewlines,
|
||||
} from "./scripts/power-user.js";
|
||||
|
||||
import { debounce, delay } from "./scripts/utils.js";
|
||||
@ -1336,6 +1337,10 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length
|
||||
}
|
||||
finalPromt = worldInfoBefore + storyString + worldInfoAfter + extension_prompt + mesExmString + mesSendString + generatedPromtCache + promptBias;
|
||||
finalPromt = finalPromt.replace(/\r/gm, '');
|
||||
|
||||
if (collapse_newlines) {
|
||||
finalPromt = collapseNewlines(finalPromt);
|
||||
}
|
||||
//console.log('final prompt decided');
|
||||
|
||||
//if we aren't using the kobold GUI settings...
|
||||
@ -1493,7 +1498,7 @@ async function Generate(type, automatic_trigger) {//encode("dsfs").length
|
||||
}
|
||||
|
||||
if (collapse_newlines) {
|
||||
getMessage = getMessage.replaceAll(/\n+/g, "\n");
|
||||
getMessage = collapseNewlines(getMessage);
|
||||
}
|
||||
|
||||
//Pygmalion run again // to make it continue generating so long as it's under max_amount and hasn't signaled
|
||||
|
@ -1,4 +1,5 @@
|
||||
export {
|
||||
collapseNewlines,
|
||||
collapse_newlines,
|
||||
force_pygmalion_formatting,
|
||||
};
|
||||
@ -11,6 +12,10 @@ const storage_keys = {
|
||||
force_pygmalion_formatting: "TavernAI_force_pygmalion_formatting",
|
||||
};
|
||||
|
||||
function collapseNewlines(x) {
|
||||
return x.replaceAll(/\n+/g, "\n");
|
||||
}
|
||||
|
||||
function loadPowerUserSettings() {
|
||||
collapse_newlines = localStorage.getItem(storage_keys.collapse_newlines) == "true";
|
||||
force_pygmalion_formatting = localStorage.getItem(storage_keys.force_pygmalion_formatting) == "true";
|
||||
|
@ -88,6 +88,10 @@ body {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.mes_text br {
|
||||
content: ' ';
|
||||
}
|
||||
|
||||
.mes_bias {
|
||||
display: block;
|
||||
font-size: 0.9rem;
|
||||
|
Reference in New Issue
Block a user