feat: Add custom toggles

This commit is contained in:
kwaroran
2024-05-27 11:18:15 +09:00
parent eb992a5c6b
commit 1d5a829f88
7 changed files with 62 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
import type { character, groupChat } from "src/ts/storage/database";
import { DataBase } from "src/ts/storage/database";
import TextInput from "../UI/GUI/TextInput.svelte";
import { DownloadIcon, EditIcon, FolderUpIcon, MenuIcon, TrashIcon } from "lucide-svelte";
import { DownloadIcon, PencilIcon, FolderUpIcon, MenuIcon, TrashIcon } from "lucide-svelte";
import { exportChat, importChat } from "src/ts/characters";
import { alertConfirm, alertError, alertSelect } from "src/ts/alert";
import { language } from "src/lang";
@@ -11,6 +11,7 @@
import CheckInput from "../UI/GUI/CheckInput.svelte";
import { createMultiuserRoom } from "src/ts/sync/multiuser";
import { CurrentCharacter } from "src/ts/stores";
import { getCustomToggles } from "src/ts/process/prompt";
export let chara:character|groupChat
let editMode = false
</script>
@@ -62,7 +63,7 @@
<button class="text-textcolor2 hover:text-green-500 mr-1 cursor-pointer" on:click={() => {
editMode = !editMode
}}>
<EditIcon size={18}/>
<PencilIcon size={18}/>
</button>
<button class="text-textcolor2 hover:text-green-500 mr-1 cursor-pointer" on:click={async (e) => {
e.stopPropagation()
@@ -101,7 +102,7 @@
<button class="text-textcolor2 hover:text-green-500 cursor-pointer" on:click={() => {
editMode = !editMode
}}>
<EditIcon size={18}/>
<PencilIcon size={18}/>
</button>
</div>
@@ -110,6 +111,14 @@
<CheckInput bind:check={$DataBase.jailbreakToggle} name={language.jailbreakToggle}/>
</div>
{#each getCustomToggles($DataBase.customPromptTemplateToggle) as toggle}
<div class="flex mt-2 items-center">
<CheckInput check={$DataBase.globalChatVariables[`toggle_${toggle[0]}`] === '1'} name={toggle[1]} onChange={() => {
$DataBase.globalChatVariables[`toggle_${toggle[0]}`] = $DataBase.globalChatVariables[`toggle_${toggle[0]}`] === '1' ? '0' : '1'
}} />
</div>
{/each}
{#if $DataBase.supaMemoryType !== 'none' || $DataBase.hanuraiEnable}
{#if $DataBase.hanuraiEnable}
<div class="flex mt-2 items-center">