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 { extension_settings, getContext } from '../../extensions.js';
|
||||||
import { findSecret, secret_state, writeSecret } from '../../secrets.js';
|
import { findSecret, secret_state, writeSecret } from '../../secrets.js';
|
||||||
import { splitRecursive } from '../../utils.js';
|
import { splitRecursive } from '../../utils.js';
|
||||||
|
|
||||||
export {translate};
|
|
||||||
|
|
||||||
export const autoModeOptions = {
|
export const autoModeOptions = {
|
||||||
NONE: 'none',
|
NONE: 'none',
|
||||||
RESPONSES: 'responses',
|
RESPONSES: 'responses',
|
||||||
@ -157,14 +166,11 @@ function loadSettings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(`#translation_provider option[value="${
|
$(`#translation_provider option[value="${extension_settings.translate.provider}"]`)
|
||||||
extension_settings.translate.provider}"]`)
|
|
||||||
.attr('selected', true);
|
.attr('selected', true);
|
||||||
$(`#translation_target_language option[value="${
|
$(`#translation_target_language option[value="${extension_settings.translate.target_language}"]`)
|
||||||
extension_settings.translate.target_language}"]`)
|
|
||||||
.attr('selected', true);
|
.attr('selected', true);
|
||||||
$(`#translation_auto_mode option[value="${
|
$(`#translation_auto_mode option[value="${extension_settings.translate.auto_mode}"]`)
|
||||||
extension_settings.translate.auto_mode}"]`)
|
|
||||||
.attr('selected', true);
|
.attr('selected', true);
|
||||||
showKeysButton();
|
showKeysButton();
|
||||||
}
|
}
|
||||||
@ -442,7 +448,7 @@ function createEventHandler(translateFunction, shouldTranslateFunction) {
|
|||||||
|
|
||||||
async function onTranslateInputMessageClick() {
|
async function onTranslateInputMessageClick() {
|
||||||
const ta = document.querySelector('#send_textarea');
|
const ta = document.querySelector('#send_textarea');
|
||||||
toastr.info(`Input Message is translating`, 'Please wait...');
|
toastr.info('Input Message is translating', 'Please wait...');
|
||||||
const translatedText =
|
const translatedText =
|
||||||
await translate(ta.value, extension_settings.translate.internal_language);
|
await translate(ta.value, extension_settings.translate.internal_language);
|
||||||
$('#send_textarea').val(translatedText);
|
$('#send_textarea').val(translatedText);
|
||||||
@ -637,8 +643,7 @@ jQuery(() => {
|
|||||||
'oneringtranslator': 'http://127.0.0.1:4990/translate',
|
'oneringtranslator': 'http://127.0.0.1:4990/translate',
|
||||||
'deeplx': 'http://127.0.0.1:1188/translate',
|
'deeplx': 'http://127.0.0.1:1188/translate',
|
||||||
};
|
};
|
||||||
const popupText = `<h3>${optionText} API URL</h3><i>Example: <tt>${
|
const popupText = `<h3>${optionText} API URL</h3><i>Example: <tt>${String(exampleURLs[extension_settings.translate.provider])}</tt></i>`;
|
||||||
String(exampleURLs[extension_settings.translate.provider])}</tt></i>`;
|
|
||||||
|
|
||||||
const secretKey = extension_settings.translate.provider + '_url';
|
const secretKey = extension_settings.translate.provider + '_url';
|
||||||
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
const savedUrl = secret_state[secretKey] ? await findSecret(secretKey) : '';
|
||||||
|
Reference in New Issue
Block a user