mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Clean-up diff
This commit is contained in:
@ -1,10 +1,19 @@
|
||||
import {callPopup, event_types, eventSource, getRequestHeaders, reloadCurrentChat, saveSettingsDebounced, substituteParams, updateMessageBlock,} from '../../../script.js';
|
||||
export { translate };
|
||||
|
||||
import {
|
||||
callPopup,
|
||||
event_types,
|
||||
eventSource,
|
||||
getRequestHeaders,
|
||||
reloadCurrentChat,
|
||||
saveSettingsDebounced,
|
||||
substituteParams,
|
||||
updateMessageBlock,
|
||||
} from '../../../script.js';
|
||||
import { extension_settings, getContext } from '../../extensions.js';
|
||||
import { findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||
import { splitRecursive } from '../../utils.js';
|
||||
|
||||
export {translate};
|
||||
|
||||
export const autoModeOptions = {
|
||||
NONE: 'none',
|
||||
RESPONSES: 'responses',
|
||||
@ -157,14 +166,11 @@ function loadSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
$(`#translation_provider option[value="${
|
||||
extension_settings.translate.provider}"]`)
|
||||
$(`#translation_provider option[value="${extension_settings.translate.provider}"]`)
|
||||
.attr('selected', true);
|
||||
$(`#translation_target_language option[value="${
|
||||
extension_settings.translate.target_language}"]`)
|
||||
$(`#translation_target_language option[value="${extension_settings.translate.target_language}"]`)
|
||||
.attr('selected', true);
|
||||
$(`#translation_auto_mode option[value="${
|
||||
extension_settings.translate.auto_mode}"]`)
|
||||
$(`#translation_auto_mode option[value="${extension_settings.translate.auto_mode}"]`)
|
||||
.attr('selected', true);
|
||||
showKeysButton();
|
||||
}
|
||||
@ -442,7 +448,7 @@ function createEventHandler(translateFunction, shouldTranslateFunction) {
|
||||
|
||||
async function onTranslateInputMessageClick() {
|
||||
const ta = document.querySelector('#send_textarea');
|
||||
toastr.info(`Input Message is translating`, 'Please wait...');
|
||||
toastr.info('Input Message is translating', 'Please wait...');
|
||||
const translatedText =
|
||||
await translate(ta.value, extension_settings.translate.internal_language);
|
||||
$('#send_textarea').val(translatedText);
|
||||
@ -637,8 +643,7 @@ jQuery(() => {
|
||||
'oneringtranslator': 'http://127.0.0.1:4990/translate',
|
||||
'deeplx': 'http://127.0.0.1:1188/translate',
|
||||
};
|
||||
const popupText = `<h3>${optionText} API URL</h3><i>Example: <tt>${
|
||||
String(exampleURLs[extension_settings.translate.provider])}</tt></i>`;
|
||||
const popupText = `<h3>${optionText} API URL</h3><i>Example: <tt>${String(exampleURLs[extension_settings.translate.provider])}</tt></i>`;
|
||||
|
||||
const secretKey = extension_settings.translate.provider + '_url';
|
||||
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
||||
|
Reference in New Issue
Block a user