From 7f55d108cfd0e53f9176a179f2c6313f5c18435f Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 11 Sep 2023 13:01:45 +0300 Subject: [PATCH] Don't use talkinghead with local classification model --- public/scripts/extensions/expressions/index.js | 17 +++++++++++++++-- .../extensions/expressions/settings.html | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/public/scripts/extensions/expressions/index.js b/public/scripts/extensions/expressions/index.js index 5f663df42..0082637d2 100644 --- a/public/scripts/extensions/expressions/index.js +++ b/public/scripts/extensions/expressions/index.js @@ -449,7 +449,7 @@ function handleImageChange() { return; } - if (extension_settings.expressions.talkinghead) { + if (extension_settings.expressions.talkinghead && !extension_settings.expressions.local) { // Method get IP of endpoint const talkingheadResultFeedSrc = `${getApiUrl()}/api/talkinghead/result_feed`; $('#expression-holder').css({ display: '' }); @@ -479,6 +479,14 @@ function handleImageChange() { async function moduleWorker() { const context = getContext(); + // Hide and disable talkinghead while in local mode + $('#image_type_block').toggle(!extension_settings.expressions.local); + + if (extension_settings.expressions.local && extension_settings.expressions.talkinghead) { + $('#image_type_toggle').prop('checked', false); + setTalkingHeadState(false); + } + // non-characters not supported if (!context.groupId && (context.characterId === undefined || context.characterId === 'invalid-safety-id')) { removeExpression(); @@ -648,6 +656,10 @@ function setTalkingHeadState(switch_var) { extension_settings.expressions.talkinghead = switch_var; // Store setting saveSettingsDebounced(); + if (extension_settings.expressions.local) { + return; + } + talkingHeadCheck().then(result => { if (result) { //console.log("talkinghead exists!"); @@ -929,7 +941,7 @@ async function getExpressionsList() { } async function setExpression(character, expression, force) { - if (!extension_settings.expressions.talkinghead) { + if (extension_settings.expressions.local || !extension_settings.expressions.talkinghead) { console.debug('entered setExpressions'); await validateImages(character); const img = $('img.expression'); @@ -1305,6 +1317,7 @@ function setExpressionOverrideHtml(forceClear = false) { $('#expressions_show_default').prop('checked', extension_settings.expressions.showDefault).trigger('input'); $('#expression_local').prop('checked', extension_settings.expressions.local).on('input', function () { extension_settings.expressions.local = !!$(this).prop('checked'); + moduleWorker(); saveSettingsDebounced(); }); $('#expression_override_cleanup_button').on('click', onClickExpressionOverrideRemoveAllButton); diff --git a/public/scripts/extensions/expressions/settings.html b/public/scripts/extensions/expressions/settings.html index 20c2942c8..5ecd2e971 100644 --- a/public/scripts/extensions/expressions/settings.html +++ b/public/scripts/extensions/expressions/settings.html @@ -10,7 +10,7 @@ Local server classification -