Merge branch 'staging' of https://github.com/Cohee1207/SillyTavern into staging
This commit is contained in:
commit
da161b9628
|
@ -8476,12 +8476,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,15 +56,19 @@ 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) {
|
||||||
|
@ -73,7 +77,6 @@ const observer = new MutationObserver(function (mutations) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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 () {
|
||||||
|
|
|
@ -2530,8 +2530,13 @@ async function askCharacter(args, text) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevChId !== undefined) {
|
||||||
setCharacterId(prevChId);
|
setCharacterId(prevChId);
|
||||||
setCharacterName(characters[prevChId].name);
|
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
|
||||||
|
|
Loading…
Reference in New Issue