mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 19:07:40 +01:00
parent
cacd570af3
commit
82a633da57
@ -3069,7 +3069,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<label class="checkbox_label" title="Add Chat Start and Example Separator to a list of stopping strings." data-i18n="[title]Add Chat Start and Example Separator to a list of stopping strings.">
|
<label class="checkbox_label" title="Add Chat Start and Example Separator to a list of stopping strings." data-i18n="[title]Add Chat Start and Example Separator to a list of stopping strings.">
|
||||||
<input id="context_use_stop_strings" type="checkbox" />
|
<input id="context_use_stop_strings" type="checkbox" />
|
||||||
<small data-i18n="Use as Stop Strings">Use as Stop Strings</small>
|
<small data-i18n="Separators as Stop Strings">Separators as Stop Strings</small>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox_label" title="Add Character and User names to a list of stopping strings." data-i18n="[title]Add Character and User names to a list of stopping strings.">
|
||||||
|
<input id="context_names_as_stop_strings" type="checkbox" />
|
||||||
|
<small data-i18n="Names as Stop Strings">Names as Stop Strings</small>
|
||||||
</label>
|
</label>
|
||||||
<label class="checkbox_label" title="Includes Post-History Instructions at the end of the prompt, if defined in the character card AND ''Prefer Char. Instructions'' is enabled. THIS IS NOT RECOMMENDED FOR TEXT COMPLETION MODELS, CAN LEAD TO BAD OUTPUT." data-i18n="[title]context_allow_post_history_instructions">
|
<label class="checkbox_label" title="Includes Post-History Instructions at the end of the prompt, if defined in the character card AND ''Prefer Char. Instructions'' is enabled. THIS IS NOT RECOMMENDED FOR TEXT COMPLETION MODELS, CAN LEAD TO BAD OUTPUT." data-i18n="[title]context_allow_post_history_instructions">
|
||||||
<input id="context_allow_jailbreak" type="checkbox" />
|
<input id="context_allow_jailbreak" type="checkbox" />
|
||||||
|
@ -2470,26 +2470,30 @@ export function substituteParams(content, _name1, _name2, _original, _group, _re
|
|||||||
* @returns {string[]} Array of stopping strings
|
* @returns {string[]} Array of stopping strings
|
||||||
*/
|
*/
|
||||||
export function getStoppingStrings(isImpersonate, isContinue) {
|
export function getStoppingStrings(isImpersonate, isContinue) {
|
||||||
const charString = `\n${name2}:`;
|
const result = [];
|
||||||
const userString = `\n${name1}:`;
|
|
||||||
const result = isImpersonate ? [charString] : [userString];
|
|
||||||
|
|
||||||
result.push(userString);
|
if (power_user.context.names_as_stop_strings) {
|
||||||
|
const charString = `\n${name2}:`;
|
||||||
|
const userString = `\n${name1}:`;
|
||||||
|
result.push(isImpersonate ? charString : userString);
|
||||||
|
|
||||||
if (isContinue && Array.isArray(chat) && chat[chat.length - 1]?.is_user) {
|
result.push(userString);
|
||||||
result.push(charString);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add other group members as the stopping strings
|
if (isContinue && Array.isArray(chat) && chat[chat.length - 1]?.is_user) {
|
||||||
if (selected_group) {
|
result.push(charString);
|
||||||
const group = groups.find(x => x.id === selected_group);
|
}
|
||||||
|
|
||||||
if (group && Array.isArray(group.members)) {
|
// Add other group members as the stopping strings
|
||||||
const names = group.members
|
if (selected_group) {
|
||||||
.map(x => characters.find(y => y.avatar == x))
|
const group = groups.find(x => x.id === selected_group);
|
||||||
.filter(x => x && x.name && x.name !== name2)
|
|
||||||
.map(x => `\n${x.name}:`);
|
if (group && Array.isArray(group.members)) {
|
||||||
result.push(...names);
|
const names = group.members
|
||||||
|
.map(x => characters.find(y => y.avatar == x))
|
||||||
|
.filter(x => x && x.name && x.name !== name2)
|
||||||
|
.map(x => `\n${x.name}:`);
|
||||||
|
result.push(...names);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +242,7 @@ let power_user = {
|
|||||||
example_separator: defaultExampleSeparator,
|
example_separator: defaultExampleSeparator,
|
||||||
use_stop_strings: true,
|
use_stop_strings: true,
|
||||||
allow_jailbreak: false,
|
allow_jailbreak: false,
|
||||||
|
names_as_stop_strings: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
personas: {},
|
personas: {},
|
||||||
@ -347,6 +348,7 @@ const contextControls = [
|
|||||||
{ id: 'context_chat_start', property: 'chat_start', isCheckbox: false, isGlobalSetting: false },
|
{ id: 'context_chat_start', property: 'chat_start', isCheckbox: false, isGlobalSetting: false },
|
||||||
{ id: 'context_use_stop_strings', property: 'use_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
{ id: 'context_use_stop_strings', property: 'use_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||||
{ id: 'context_allow_jailbreak', property: 'allow_jailbreak', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
{ id: 'context_allow_jailbreak', property: 'allow_jailbreak', isCheckbox: true, isGlobalSetting: false, defaultValue: false },
|
||||||
|
{ id: 'context_names_as_stop_strings', property: 'names_as_stop_strings', isCheckbox: true, isGlobalSetting: false, defaultValue: true },
|
||||||
|
|
||||||
// Existing power user settings
|
// Existing power user settings
|
||||||
{ id: 'always-force-name2-checkbox', property: 'always_force_name2', isCheckbox: true, isGlobalSetting: true, defaultValue: true },
|
{ id: 'always-force-name2-checkbox', property: 'always_force_name2', isCheckbox: true, isGlobalSetting: true, defaultValue: true },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user