mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-11 17:07:07 +01:00
Merge branch 'staging' into char-find-and-sendas-extended
This commit is contained in:
commit
0d83480e90
@ -3248,25 +3248,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
<div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||||
|
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
||||||
|
<div class="flex-container">
|
||||||
|
<span data-i18n="Instruct Template">Instruct Template</span>
|
||||||
|
<a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
|
||||||
|
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="flex-container">
|
||||||
|
<label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
|
||||||
|
<input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
|
||||||
|
<small><i class="fa-solid fa-link menu_button margin0"></i></small>
|
||||||
|
</label>
|
||||||
|
<label id="instruct_enabled_label"for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
|
||||||
|
<input id="instruct_enabled" type="checkbox" style="display:none;" />
|
||||||
|
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</h4>
|
||||||
<div id="instructSettingsBlock">
|
<div id="instructSettingsBlock">
|
||||||
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
|
||||||
<div class="flex-container">
|
|
||||||
<span data-i18n="Instruct Template">Instruct Template</span>
|
|
||||||
<a href="https://docs.sillytavern.app/usage/core-concepts/instructmode/" class="notes-link" target="_blank">
|
|
||||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="flex-container">
|
|
||||||
<label for="instruct_bind_to_context" class="checkbox_label flex1" title="Bind to Context
If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
|
|
||||||
<input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
|
|
||||||
<small><i class="fa-solid fa-link menu_button margin0"></i></small>
|
|
||||||
</label>
|
|
||||||
<label for="instruct_enabled" class="checkbox_label flex1" title="Enable Instruct Mode" data-i18n="[title]instruct_enabled">
|
|
||||||
<input id="instruct_enabled" type="checkbox" style="display:none;" />
|
|
||||||
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
<div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
|
<div class="flex-container" title="Select your current Instruct Template" data-i18n="[title]Select your current Instruct Template">
|
||||||
<select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
|
<select id="instruct_presets" data-preset-manager-for="instruct" class="flex1 text_pole"></select>
|
||||||
@ -3431,21 +3432,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
<div id="SystemPromptColumn" class="flex-container flexNoGap flexFlowColumn flex1">
|
||||||
|
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
||||||
|
<div class="flex-container">
|
||||||
|
<span data-i18n="System Prompt">System Prompt</span>
|
||||||
|
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#system-prompt" class="notes-link" target="_blank">
|
||||||
|
<span class="fa-solid fa-circle-question note-link-span"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="flex-container">
|
||||||
|
<label id="sysprompt_enabled_label" for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
|
||||||
|
<input id="sysprompt_enabled" type="checkbox" style="display:none;" />
|
||||||
|
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</h4>
|
||||||
<div id="SystemPromptBlock">
|
<div id="SystemPromptBlock">
|
||||||
<h4 class="standoutHeader title_restorable justifySpaceBetween">
|
|
||||||
<div class="flex-container">
|
|
||||||
<span data-i18n="System Prompt">System Prompt</span>
|
|
||||||
<a href="https://docs.sillytavern.app/usage/core-concepts/advancedformatting/#system-prompt" class="notes-link" target="_blank">
|
|
||||||
<span class="fa-solid fa-circle-question note-link-span"></span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="flex-container">
|
|
||||||
<label for="sysprompt_enabled" class="checkbox_label flex1" title="Enable System Prompt" data-i18n="[title]sysprompt_enabled">
|
|
||||||
<input id="sysprompt_enabled" type="checkbox" style="display:none;" />
|
|
||||||
<small><i class="fa-solid fa-power-off menu_button margin0"></i></small>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</h4>
|
|
||||||
|
|
||||||
<div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
|
<div class="flex-container" title="Select your current System Prompt" data-i18n="[title]Select your current System Prompt">
|
||||||
<select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
|
<select id="sysprompt_select" data-preset-manager-for="sysprompt" class="flex1 text_pole"></select>
|
||||||
@ -5939,9 +5941,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mes_bias"></div>
|
<div class="mes_bias"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="swipe_right fa-solid fa-chevron-right" style="display: none;">
|
<div class="swipe_right fa-solid fa-chevron-right" style="display: none;">
|
||||||
<div class="swipes-counter"></div>
|
<div class="swipes-counter"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="group_avatars_template" class="template_element">
|
<div id="group_avatars_template" class="template_element">
|
||||||
|
@ -5428,6 +5428,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
|
|||||||
getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
|
getMessage = getMessage.substring(0, getMessage.indexOf('<|endoftext|>'));
|
||||||
}
|
}
|
||||||
const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
|
const isInstruct = power_user.instruct.enabled && main_api !== 'openai';
|
||||||
|
const isNotEmpty = (str) => str && str.trim() !== '';
|
||||||
if (isInstruct && power_user.instruct.stop_sequence) {
|
if (isInstruct && power_user.instruct.stop_sequence) {
|
||||||
if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
|
if (getMessage.indexOf(power_user.instruct.stop_sequence) != -1) {
|
||||||
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
|
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.stop_sequence));
|
||||||
@ -5435,7 +5436,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
|
|||||||
}
|
}
|
||||||
// Hana: Only use the first sequence (should be <|model|>)
|
// Hana: Only use the first sequence (should be <|model|>)
|
||||||
// of the prompt before <|user|> (as KoboldAI Lite does it).
|
// of the prompt before <|user|> (as KoboldAI Lite does it).
|
||||||
if (isInstruct && power_user.instruct.input_sequence) {
|
if (isInstruct && isNotEmpty(power_user.instruct.input_sequence)) {
|
||||||
if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
|
if (getMessage.indexOf(power_user.instruct.input_sequence) != -1) {
|
||||||
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
|
getMessage = getMessage.substring(0, getMessage.indexOf(power_user.instruct.input_sequence));
|
||||||
}
|
}
|
||||||
@ -8477,12 +8478,22 @@ const CONNECT_API_MAP = {
|
|||||||
selected: 'novel',
|
selected: 'novel',
|
||||||
button: '#api_button_novel',
|
button: '#api_button_novel',
|
||||||
},
|
},
|
||||||
|
'koboldcpp': {
|
||||||
|
selected: 'textgenerationwebui',
|
||||||
|
button: '#api_button_textgenerationwebui',
|
||||||
|
type: textgen_types.KOBOLDCPP,
|
||||||
|
},
|
||||||
// KoboldCpp alias
|
// KoboldCpp alias
|
||||||
'kcpp': {
|
'kcpp': {
|
||||||
selected: 'textgenerationwebui',
|
selected: 'textgenerationwebui',
|
||||||
button: '#api_button_textgenerationwebui',
|
button: '#api_button_textgenerationwebui',
|
||||||
type: textgen_types.KOBOLDCPP,
|
type: textgen_types.KOBOLDCPP,
|
||||||
},
|
},
|
||||||
|
'openai': {
|
||||||
|
selected: 'openai',
|
||||||
|
button: '#api_button_openai',
|
||||||
|
source: chat_completion_sources.OPENAI,
|
||||||
|
},
|
||||||
// OpenAI alias
|
// OpenAI alias
|
||||||
'oai': {
|
'oai': {
|
||||||
selected: 'openai',
|
selected: 'openai',
|
||||||
|
@ -56,22 +56,25 @@ let counterNonce = Date.now();
|
|||||||
|
|
||||||
const observerConfig = { childList: true, subtree: true };
|
const observerConfig = { childList: true, subtree: true };
|
||||||
const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed);
|
const countTokensDebounced = debounce(RA_CountCharTokens, debounce_timeout.relaxed);
|
||||||
|
const countTokensShortDebounced = debounce(RA_CountCharTokens, debounce_timeout.short);
|
||||||
|
const checkStatusDebounced = debounce(RA_checkOnlineStatus, debounce_timeout.short);
|
||||||
|
|
||||||
const observer = new MutationObserver(function (mutations) {
|
const observer = new MutationObserver(function (mutations) {
|
||||||
mutations.forEach(function (mutation) {
|
mutations.forEach(function (mutation) {
|
||||||
|
if (!(mutation.target instanceof HTMLElement)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mutation.target.classList.contains('online_status_text')) {
|
if (mutation.target.classList.contains('online_status_text')) {
|
||||||
RA_checkOnlineStatus();
|
checkStatusDebounced();
|
||||||
} else if (mutation.target.parentNode === SelectedCharacterTab) {
|
} else if (mutation.target.parentNode === SelectedCharacterTab) {
|
||||||
setTimeout(RA_CountCharTokens, 200);
|
countTokensShortDebounced();
|
||||||
} else if (mutation.target.classList.contains('mes_text')) {
|
} else if (mutation.target.classList.contains('mes_text')) {
|
||||||
if (mutation.target instanceof HTMLElement) {
|
for (const element of mutation.target.getElementsByTagName('math')) {
|
||||||
for (const element of mutation.target.getElementsByTagName('math')) {
|
element.childNodes.forEach(function (child) {
|
||||||
element.childNodes.forEach(function (child) {
|
if (child.nodeType === Node.TEXT_NODE) {
|
||||||
if (child.nodeType === Node.TEXT_NODE) {
|
child.textContent = '';
|
||||||
child.textContent = '';
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -159,8 +162,8 @@ export function shouldSendOnEnter() {
|
|||||||
export function humanizedDateTime() {
|
export function humanizedDateTime() {
|
||||||
const now = new Date(Date.now());
|
const now = new Date(Date.now());
|
||||||
const dt = {
|
const dt = {
|
||||||
year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(),
|
year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(),
|
||||||
hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(),
|
hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(),
|
||||||
};
|
};
|
||||||
for (const key in dt) {
|
for (const key in dt) {
|
||||||
dt[key] = dt[key].toString().padStart(2, '0');
|
dt[key] = dt[key].toString().padStart(2, '0');
|
||||||
@ -725,9 +728,7 @@ export function addSafariPatch() {
|
|||||||
|
|
||||||
export function initRossMods() {
|
export function initRossMods() {
|
||||||
// initial status check
|
// initial status check
|
||||||
setTimeout(() => {
|
checkStatusDebounced();
|
||||||
RA_checkOnlineStatus();
|
|
||||||
}, 100);
|
|
||||||
|
|
||||||
if (power_user.auto_load_chat) {
|
if (power_user.auto_load_chat) {
|
||||||
RA_autoloadchat();
|
RA_autoloadchat();
|
||||||
@ -752,7 +753,7 @@ export function initRossMods() {
|
|||||||
setTimeout(() => RA_autoconnect(PrevAPI), 100);
|
setTimeout(() => RA_autoconnect(PrevAPI), 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#api_button').click(function () { setTimeout(RA_checkOnlineStatus, 100); });
|
$('#api_button').on('click', () => checkStatusDebounced());
|
||||||
|
|
||||||
//toggle pin class when lock toggle clicked
|
//toggle pin class when lock toggle clicked
|
||||||
$(RPanelPin).on('click', function () {
|
$(RPanelPin).on('click', function () {
|
||||||
|
@ -2598,8 +2598,13 @@ async function askCharacter(args, text) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCharacterId(prevChId);
|
if (prevChId !== undefined) {
|
||||||
setCharacterName(characters[prevChId].name);
|
setCharacterId(prevChId);
|
||||||
|
setCharacterName(characters[prevChId].name);
|
||||||
|
} else {
|
||||||
|
setCharacterId(undefined);
|
||||||
|
setCharacterName(neutralCharacterName);
|
||||||
|
}
|
||||||
|
|
||||||
// Only force the new avatar if the character name is the same
|
// Only force the new avatar if the character name is the same
|
||||||
// This skips if an error was fired
|
// This skips if an error was fired
|
||||||
|
@ -978,15 +978,15 @@ body .panelControlBar {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
grid-row-start: 2;
|
grid-row-start: 2;
|
||||||
grid-column-start: 4;
|
|
||||||
flex-flow: column;
|
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 15px;
|
bottom: 15px;
|
||||||
|
flex-flow: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.swipes-counter {
|
.swipes-counter {
|
||||||
color: var(--SmartThemeBodyColor);
|
color: var(--SmartThemeBodyColor);
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@ -994,6 +994,9 @@ body .panelControlBar {
|
|||||||
font-family: var(--mainFontFamily);
|
font-family: var(--mainFontFamily);
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
min-width: 40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.swipe_left {
|
.swipe_left {
|
||||||
@ -1003,6 +1006,7 @@ body .panelControlBar {
|
|||||||
|
|
||||||
.swipe_right {
|
.swipe_right {
|
||||||
right: 5px;
|
right: 5px;
|
||||||
|
align-self:end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-settings {
|
.ui-settings {
|
||||||
@ -2634,6 +2638,11 @@ select option:not(:checked) {
|
|||||||
color: var(--active) !important;
|
color: var(--active) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#instruct_enabled_label .menu_button:not(.toggleEnabled),
|
||||||
|
#sysprompt_enabled_label .menu_button:not(.toggleEnabled) {
|
||||||
|
color: Red;
|
||||||
|
}
|
||||||
|
|
||||||
.displayBlock {
|
.displayBlock {
|
||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user