Reformat new code

This commit is contained in:
Cohee
2023-07-31 20:56:05 +03:00
parent 435d319090
commit 16b45f1ea9
2 changed files with 130 additions and 131 deletions

View File

@ -882,9 +882,10 @@ async function setExpression(character, expression, force) {
if (imgElement) { if (imgElement) {
console.log("setting value"); console.log("setting value");
imgElement.src = getApiUrl() + '/api/live2d/result_feed'; imgElement.src = getApiUrl() + '/api/live2d/result_feed';
}}
} }
} }
}
}
function onClickExpressionImage() { function onClickExpressionImage() {
// online mode doesn't need force set // online mode doesn't need force set
@ -1194,7 +1195,7 @@ function setExpressionOverrideHtml(forceClear = false) {
$('.expression_settings').hide(); $('.expression_settings').hide();
$('#image_type_toggle').on('change', function() { $('#image_type_toggle').on('change', function () {
const isChecked = this.checked; const isChecked = this.checked;
const inputElement = document.querySelector('input[name="avatar_url"]'); const inputElement = document.querySelector('input[name="avatar_url"]');
const value_name = inputElement ? inputElement.value : ''; const value_name = inputElement ? inputElement.value : '';
@ -1205,7 +1206,6 @@ function setExpressionOverrideHtml(forceClear = false) {
}); });
} }
addExpressionImage(); addExpressionImage();
addVisualNovelMode(); addVisualNovelMode();
addSettings(); addSettings();

View File

@ -1,5 +1,5 @@
import { callPopup, cancelTtsPlay, eventSource, event_types, isMultigenEnabled, is_send_press, saveSettingsDebounced } from '../../../script.js' import { callPopup, cancelTtsPlay, eventSource, event_types, isMultigenEnabled, is_send_press, saveSettingsDebounced } from '../../../script.js'
import { ModuleWorkerWrapper, extension_settings, getContext } from '../../extensions.js' import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext } from '../../extensions.js'
import { escapeRegex, getStringHash } from '../../utils.js' import { escapeRegex, getStringHash } from '../../utils.js'
import { EdgeTtsProvider } from './edge.js' import { EdgeTtsProvider } from './edge.js'
import { ElevenLabsTtsProvider } from './elevenlabs.js' import { ElevenLabsTtsProvider } from './elevenlabs.js'
@ -7,7 +7,6 @@ import { SileroTtsProvider } from './silerotts.js'
import { CoquiTtsProvider } from './coquitts.js' import { CoquiTtsProvider } from './coquitts.js'
import { SystemTtsProvider } from './system.js' import { SystemTtsProvider } from './system.js'
import { NovelTtsProvider } from './novel.js' import { NovelTtsProvider } from './novel.js'
import { isMobile } from '../../RossAscends-mods.js'
import { power_user } from '../../power-user.js' import { power_user } from '../../power-user.js'
const UPDATE_INTERVAL = 1000 const UPDATE_INTERVAL = 1000
@ -165,13 +164,13 @@ async function moduleWorker() {
} }
function talkingAnimation(switchValue) { function talkingAnimation(switchValue) {
const apiKeyValue = document.getElementById("extensions_url").value; const apiUrl = getApiUrl();
const animationType = switchValue ? "start" : "stop"; const animationType = switchValue ? "start" : "stop";
if (switchValue !== storedvalue) { if (switchValue !== storedvalue) {
try { try {
console.log(animationType + " Talking Animation"); console.log(animationType + " Talking Animation");
fetch(`${apiKeyValue}/api/live2d/${animationType}_talking`); doExtrasFetch(`${apiUrl}/api/live2d/${animationType}_talking`);
storedvalue = switchValue; // Update the storedvalue to the current switchValue storedvalue = switchValue; // Update the storedvalue to the current switchValue
} catch (error) { } catch (error) {
// Handle the error here or simply ignore it to prevent logging // Handle the error here or simply ignore it to prevent logging