feat: custom toggles for modules

This commit is contained in:
bangonicdd
2025-02-06 19:45:55 +09:00
parent 7b57bdf5f1
commit ef6f671792
4 changed files with 26 additions and 6 deletions

View File

@@ -132,6 +132,8 @@
<div class="flex items-center mt-4">
<Check bind:check={currentModule.hideIcon} name={language.hideChatIcon}/>
</div>
<span class="mt-4">{language.customPromptTemplateToggle} <Help key='customPromptTemplateToggle' /></span>
<TextAreaInput bind:value={currentModule.customModuleToggle}/>
{/if}
{#if submenu === 1 && (Array.isArray(currentModule.lorebook))}
<div class="border border-selected p-2 flex flex-col rounded-md mt-2">

View File

@@ -30,7 +30,7 @@
import { updateInlayScreen } from "src/ts/process/inlayScreen";
import { registerOnnxModel } from "src/ts/process/transformers";
import MultiLangInput from "../UI/GUI/MultiLangInput.svelte";
import { applyModule } from "src/ts/process/modules";
import { applyModule, getModuleToggles } from "src/ts/process/modules";
import { exportRegex, importRegex } from "src/ts/process/scripts";
import Arcodion from "../UI/Arcodion.svelte";
import SliderInput from "../UI/GUI/SliderInput.svelte";
@@ -293,7 +293,7 @@
<Check bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle}/>
</div>
{#each parseKeyValue(DBState.db.customPromptTemplateToggle) as toggle}
{#each parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles()) as toggle}
<div class="flex mt-2 items-center">
<Check check={DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1'} name={toggle[1]} onChange={() => {
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'

View File

@@ -16,6 +16,9 @@
import { onDestroy, onMount } from "svelte";
import { v4 } from "uuid";
import { getChatBranches } from "src/ts/gui/branches";
import { getModuleToggles } from "src/ts/process/modules";
let parsedCustomToggles: [string, string][] = parseKeyValue(DBState.db.customPromptTemplateToggle + getModuleToggles())
interface Props {
chara: character|groupChat;
@@ -221,12 +224,12 @@
{#if DBState.db.characters[$selectedCharID]?.chaId !== '§playground'}
{#if parseKeyValue(DBState.db.customPromptTemplateToggle).length > 4}
{#if parsedCustomToggles.length > 4}
<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}>
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse />
</div>
{#each parseKeyValue(DBState.db.customPromptTemplateToggle) as toggle}
{#each parsedCustomToggles as toggle}
<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={() => {
DBState.db.globalChatVariables[`toggle_${toggle[0]}`] = DBState.db.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
@@ -239,11 +242,11 @@
</div>
{/if}
</div>
{:else if parseKeyValue(DBState.db.customPromptTemplateToggle).length > 0}
{:else if parsedCustomToggles.length > 0}
<div class="flex mt-2 items-center">
<CheckInput bind:check={DBState.db.jailbreakToggle} name={language.jailbreakToggle} reverse/>
</div>
{#each parseKeyValue(DBState.db.customPromptTemplateToggle) as toggle}
{#each parsedCustomToggles as toggle}
<div class="flex mt-2 items-center">
<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'