fix: toggles should be reactive
This commit is contained in:
@@ -18,8 +18,6 @@
|
|||||||
import { getChatBranches } from "src/ts/gui/branches";
|
import { getChatBranches } from "src/ts/gui/branches";
|
||||||
import { getModuleToggles } from "src/ts/process/modules";
|
import { getModuleToggles } from "src/ts/process/modules";
|
||||||
|
|
||||||
let parsedCustomToggles: [string, string][] = parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles())
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
chara: character|groupChat;
|
chara: character|groupChat;
|
||||||
}
|
}
|
||||||
@@ -224,12 +222,12 @@
|
|||||||
{#if DBState.db.characters[$selectedCharID]?.chaId !== '§playground'}
|
{#if DBState.db.characters[$selectedCharID]?.chaId !== '§playground'}
|
||||||
|
|
||||||
|
|
||||||
{#if parsedCustomToggles.length > 4}
|
{#if parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles()).length > 4}
|
||||||
<div class="h-48 border-darkborderc p-2 border rounded flex flex-col items-start mt-2 overflow-y-auto">
|
<div class="h-48 border-darkborderc p-2 border rounded flex flex-col items-start mt-2 overflow-y-auto">
|
||||||
<div class="flex mt-2 items-center w-full" class:justify-end={$MobileGUI}>
|
<div class="flex mt-2 items-center w-full" class:justify-end={$MobileGUI}>
|
||||||
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse />
|
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse />
|
||||||
</div>
|
</div>
|
||||||
{#each parsedCustomToggles as toggle}
|
{#each parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles()) as toggle}
|
||||||
<div class="flex mt-2 items-center w-full" class:justify-end={$MobileGUI}>
|
<div class="flex mt-2 items-center w-full" class:justify-end={$MobileGUI}>
|
||||||
<CheckInput check={DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1'} reverse name={toggle[1]} onChange={() => {
|
<CheckInput check={DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1'} reverse name={toggle[1]} onChange={() => {
|
||||||
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
|
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
|
||||||
@@ -242,11 +240,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{:else if parsedCustomToggles.length > 0}
|
{:else if parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles()).length > 0}
|
||||||
<div class="flex mt-2 items-center">
|
<div class="flex mt-2 items-center">
|
||||||
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse/>
|
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse/>
|
||||||
</div>
|
</div>
|
||||||
{#each parsedCustomToggles as toggle}
|
{#each parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles()) as toggle}
|
||||||
<div class="flex mt-2 items-center">
|
<div class="flex mt-2 items-center">
|
||||||
<CheckInput check={DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1'} reverse name={toggle[1]} onChange={() => {
|
<CheckInput check={DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1'} reverse name={toggle[1]} onChange={() => {
|
||||||
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
|
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
|
||||||
|
|||||||
Reference in New Issue
Block a user