Add {{mesExamplesRaw}} macro for story string
This commit is contained in:
parent
4aa59033ca
commit
3f6f32edad
|
@ -3151,13 +3151,24 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||||
if (mesExamples.replace(/<START>/gi, '').trim().length === 0) {
|
if (mesExamples.replace(/<START>/gi, '').trim().length === 0) {
|
||||||
mesExamples = '';
|
mesExamples = '';
|
||||||
}
|
}
|
||||||
|
const mesExamplesRaw = mesExamples;
|
||||||
if (mesExamples && isInstruct) {
|
if (mesExamples && isInstruct) {
|
||||||
mesExamples = formatInstructModeExamples(mesExamples, name1, name2);
|
mesExamples = formatInstructModeExamples(mesExamples, name1, name2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const exampleSeparator = power_user.context.example_separator ? `${substituteParams(power_user.context.example_separator)}\n` : '';
|
/**
|
||||||
const blockHeading = main_api === 'openai' ? '<START>\n' : exampleSeparator;
|
* Adds a block heading to the examples string.
|
||||||
let mesExamplesArray = mesExamples.split(/<START>/gi).slice(1).map(block => `${blockHeading}${block.trim()}\n`);
|
* @param {string} examplesStr
|
||||||
|
* @returns {string[]} Examples array with block heading
|
||||||
|
*/
|
||||||
|
function addBlockHeading(examplesStr) {
|
||||||
|
const exampleSeparator = power_user.context.example_separator ? `${substituteParams(power_user.context.example_separator)}\n` : '';
|
||||||
|
const blockHeading = main_api === 'openai' ? '<START>\n' : exampleSeparator;
|
||||||
|
return examplesStr.split(/<START>/gi).slice(1).map(block => `${blockHeading}${block.trim()}\n`);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mesExamplesArray = addBlockHeading(mesExamples);
|
||||||
|
let mesExamplesRawArray = addBlockHeading(mesExamplesRaw);
|
||||||
|
|
||||||
// First message in fresh 1-on-1 chat reacts to user/character settings changes
|
// First message in fresh 1-on-1 chat reacts to user/character settings changes
|
||||||
if (chat.length) {
|
if (chat.length) {
|
||||||
|
@ -3299,6 +3310,7 @@ async function Generate(type, { automatic_trigger, force_name2, quiet_prompt, qu
|
||||||
loreBefore: worldInfoBefore,
|
loreBefore: worldInfoBefore,
|
||||||
loreAfter: worldInfoAfter,
|
loreAfter: worldInfoAfter,
|
||||||
mesExamples: mesExamplesArray.join(''),
|
mesExamples: mesExamplesArray.join(''),
|
||||||
|
mesExamplesRaw: mesExamplesRawArray.join(''),
|
||||||
};
|
};
|
||||||
|
|
||||||
const storyString = renderStoryString(storyStringParams);
|
const storyString = renderStoryString(storyStringParams);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<li><tt>{{scenario}}</tt> – the Character's Scenario</li>
|
<li><tt>{{scenario}}</tt> – the Character's Scenario</li>
|
||||||
<li><tt>{{persona}}</tt> – your current Persona Description</li>
|
<li><tt>{{persona}}</tt> – your current Persona Description</li>
|
||||||
<li><tt>{{mesExamples}}</tt> – the Character's Dialogue Examples</li>
|
<li><tt>{{mesExamples}}</tt> – the Character's Dialogue Examples</li>
|
||||||
|
<li><tt>{{mesExamplesRaw}}</tt> – unformatted Dialogue Examples <b>(only for Story String)</b></li>
|
||||||
<li><tt>{{user}}</tt> – your current Persona username</li>
|
<li><tt>{{user}}</tt> – your current Persona username</li>
|
||||||
<li><tt>{{char}}</tt> – the Character's name</li>
|
<li><tt>{{char}}</tt> – the Character's name</li>
|
||||||
<li><tt>{{lastMessage}}</tt> - the text of the latest chat message.</li>
|
<li><tt>{{lastMessage}}</tt> - the text of the latest chat message.</li>
|
||||||
|
|
Loading…
Reference in New Issue