Lint and clean-up

This commit is contained in:
Cohee 2024-04-15 00:39:15 +03:00
parent 0263be8c1f
commit 022c180b62
14 changed files with 22 additions and 31 deletions

View File

@ -42,6 +42,8 @@ module.exports = {
showdownKatex: 'readonly',
SVGInject: 'readonly',
toastr: 'readonly',
Readability: 'readonly',
isProbablyReaderable: 'readonly',
},
},
],

View File

@ -202,7 +202,7 @@ import {
instruct_presets,
selectContextPreset,
} from './scripts/instruct-mode.js';
import { applyLocale, initLocales } from './scripts/i18n.js';
import { initLocales } from './scripts/i18n.js';
import { getFriendlyTokenizerName, getTokenCount, getTokenCountAsync, getTokenizerModel, initTokenizers, saveTokenCache } from './scripts/tokenizers.js';
import { createPersona, initPersonas, selectCurrentPersona, setPersonaDescription, updatePersonaNameIfExists } from './scripts/personas.js';
import { getBackgrounds, initBackgrounds, loadBackgroundSettings, background_settings } from './scripts/backgrounds.js';

View File

@ -32,7 +32,7 @@ import {
SECRET_KEYS,
secret_state,
} from './secrets.js';
import { debounce, delay, getStringHash, isValidUrl } from './utils.js';
import { debounce, getStringHash, isValidUrl } from './utils.js';
import { chat_completion_sources, oai_settings } from './openai.js';
import { getTokenCountAsync } from './tokenizers.js';
import { textgen_types, textgenerationwebui_settings as textgen_settings, getTextGenServer } from './textgen-settings.js';

View File

@ -1,4 +1,4 @@
import { characters, getCharacters, handleDeleteCharacter, callPopup, characterGroupOverlay } from '../script.js';
import { characterGroupOverlay } from '../script.js';
import { BulkEditOverlay, BulkEditOverlayState } from './BulkEditOverlay.js';
@ -69,15 +69,6 @@ function onSelectAllButtonClick() {
}
}
/**
* Deletes the character with the given chid.
*
* @param {string} this_chid - The chid of the character to delete.
*/
async function deleteCharacter(this_chid) {
await handleDeleteCharacter('del_ch', this_chid, false);
}
/**
* Deletes all characters that have been selected via the bulk checkboxes.
*/

View File

@ -507,6 +507,10 @@ async function loadTalkingHead() {
},
body: JSON.stringify(emotionsSettings),
});
if (!apiResult.ok) {
throw new Error(apiResult.statusText);
}
}
catch (error) {
// it's ok if not supported
@ -539,6 +543,10 @@ async function loadTalkingHead() {
},
body: JSON.stringify(animatorSettings),
});
if (!apiResult.ok) {
throw new Error(apiResult.statusText);
}
}
catch (error) {
// it's ok if not supported

View File

@ -1,4 +1,4 @@
import { getStringHash, debounce, waitUntilCondition, extractAllWords, delay } from '../../utils.js';
import { getStringHash, debounce, waitUntilCondition, extractAllWords } from '../../utils.js';
import { getContext, getApiUrl, extension_settings, doExtrasFetch, modules, renderExtensionTemplateAsync } from '../../extensions.js';
import {
activateSendButtons,

View File

@ -23,7 +23,6 @@ export async function getMultimodalCaption(base64Img, prompt) {
// OpenRouter has a payload limit of ~2MB. Google is 4MB, but we love democracy.
// Ooba requires all images to be JPEGs. Koboldcpp just asked nicely.
const isGoogle = extension_settings.caption.multimodal_api === 'google';
const isClaude = extension_settings.caption.multimodal_api === 'anthropic';
const isOllama = extension_settings.caption.multimodal_api === 'ollama';
const isLlamaCpp = extension_settings.caption.multimodal_api === 'llamacpp';
const isCustom = extension_settings.caption.multimodal_api === 'custom';

View File

@ -433,8 +433,8 @@ class AllTalkTtsProvider {
updateLanguageDropdown() {
const languageSelect = document.getElementById('language_options');
if (languageSelect) {
// Ensure default language is set
this.settings.language = this.settings.language;
// Ensure default language is set (??? whatever that means)
// this.settings.language = this.settings.language;
languageSelect.innerHTML = '';
for (let language in this.languageLabels) {

View File

@ -10,26 +10,16 @@ export function showLoader() {
export async function hideLoader() {
//Sets up a 2-step animation. Spinner blurs/fades out, and then the loader shadow does the same.
$('#load-spinner').on('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function () {
//uncomment this as part of user selection enabling
//$('#loader-spinner')
//comment this instead
$(`#${ELEMENT_ID}`)
//only fade out the spinner and replace with login screen
.animate({ opacity: 0 }, 300, function () {
//when enabling user select, dont remove the loader container just yet
//comment this out
$(`#${ELEMENT_ID}`).remove();
});
});
//console.log('BLURRING SPINNER')
$('#load-spinner')
.css({
'filter': 'blur(15px)',
'opacity': '0',
});
//uncomment to make user selection live
//await populateUserList()
}

View File

@ -129,8 +129,8 @@ function addKeyboardProps(element) {
* selected token highlighted. If no token is selected, the subview is hidden.
*/
function renderTopLogprobs() {
$('#logprobs_top_logprobs_hint').hide();
const view = $('.logprobs_candidate_list');
const hint = $('#logprobs_top_logprobs_hint').hide();
view.empty();
if (!state.selectedTokenLogprobs) {

View File

@ -31,7 +31,7 @@ import {
system_message_types,
this_chid,
} from '../script.js';
import { groups, selected_group } from './group-chats.js';
import { selected_group } from './group-chats.js';
import { registerSlashCommand } from './slash-commands.js';
import {

View File

@ -818,7 +818,7 @@ async function CreateZenSliders(elmnt) {
isManualInput = true;
//allow enter to trigger slider update
if (e.key === 'Enter') {
e.preventDefault;
e.preventDefault();
handle.trigger('blur');
}
})

View File

@ -1083,7 +1083,8 @@ export function getTextGenGenerationData(finalPrompt, maxTokens, isImpersonate,
params.dynatemp_mode = params.dynamic_temperature ? 1 : 0;
params.dynatemp_min = params.dynatemp_low;
params.dynatemp_max = params.dynatemp_high;
delete params.dynatemp_low, params.dynatemp_high;
delete params.dynatemp_low;
delete params.dynatemp_high;
}
if (settings.type === APHRODITE) {

View File

@ -64,7 +64,7 @@ const saveSettingsDebounced = debounce(() => {
saveSettings();
}, 1000);
const sortFn = (a, b) => b.order - a.order;
let updateEditor = (navigation) => { navigation; };
let updateEditor = (navigation) => { console.debug('Triggered WI navigation', navigation); };
// Do not optimize. updateEditor is a function that is updated by the displayWorldEntries with new data.
const worldInfoFilter = new FilterHelper(() => updateEditor());