Fix typo
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { ArrowLeft, PlusIcon } from "lucide-svelte";
|
||||
import { language } from "src/lang";
|
||||
import ProomptItem from "src/lib/UI/ProomptItem.svelte";
|
||||
import { tokenizePreset, type Proompt } from "src/ts/process/proompt";
|
||||
import PromptDataItem from "src/lib/UI/PromptDataItem.svelte";
|
||||
import { tokenizePreset, type PromptItem } from "src/ts/process/prompt";
|
||||
import { templateCheck } from "src/ts/process/templates/templateCheck";
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
import Check from "src/lib/UI/GUI/CheckInput.svelte";
|
||||
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
|
||||
import NumberInput from "src/lib/UI/GUI/NumberInput.svelte";
|
||||
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
|
||||
import NumberInput from "src/lib/UI/GUI/NumberInput.svelte";
|
||||
|
||||
let sorted = 0
|
||||
let opened = 0
|
||||
@@ -18,7 +18,7 @@
|
||||
executeTokenize($DataBase.promptTemplate)
|
||||
let subMenu = 0
|
||||
|
||||
async function executeTokenize(prest: Proompt[]){
|
||||
async function executeTokenize(prest: PromptItem[]){
|
||||
tokens = await tokenizePreset(prest, true)
|
||||
extokens = await tokenizePreset(prest, false)
|
||||
}
|
||||
@@ -62,7 +62,7 @@
|
||||
{/if}
|
||||
{#key sorted}
|
||||
{#each $DataBase.promptTemplate as proompt, i}
|
||||
<ProomptItem bind:proompt={proompt} onRemove={() => {
|
||||
<PromptDataItem bind:promptItem={proompt} onRemove={() => {
|
||||
let templates = $DataBase.promptTemplate
|
||||
templates.splice(i, 1)
|
||||
$DataBase.promptTemplate = templates
|
||||
@@ -103,18 +103,15 @@
|
||||
<span class="text-textcolor2 text-sm mt-2">{tokens} {language.fixedTokens}</span>
|
||||
<span class="text-textcolor2 mb-6 text-sm mt-2">{extokens} {language.exactTokens}</span>
|
||||
{:else}
|
||||
|
||||
<!-- <span class="text-textcolor mt-4">{language.assistantPrefill}</span>
|
||||
<TextInput bind:value={$DataBase.proomptSettings.assistantPrefill}/> -->
|
||||
<span class="text-textcolor mt-4">{language.postEndInnerFormat}</span>
|
||||
<TextInput bind:value={$DataBase.proomptSettings.postEndInnerFormat}/>
|
||||
<TextInput bind:value={$DataBase.promptSettings.postEndInnerFormat}/>
|
||||
|
||||
<Check bind:check={$DataBase.proomptSettings.sendChatAsSystem} name={language.sendChatAsSystem} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.proomptSettings.sendName} name={language.sendName} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.proomptSettings.utilOverride} name={language.utilOverride} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.proomptSettings.customChainOfThought} name={language.customChainOfThought} className="mt-4"/>
|
||||
{#if $DataBase.proomptSettings.customChainOfThought}
|
||||
<Check bind:check={$DataBase.promptSettings.sendChatAsSystem} name={language.sendChatAsSystem} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.promptSettings.sendName} name={language.sendName} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.promptSettings.utilOverride} name={language.utilOverride} className="mt-4"/>
|
||||
<Check bind:check={$DataBase.promptSettings.customChainOfThought} name={language.customChainOfThought} className="mt-4"/>
|
||||
{#if $DataBase.promptSettings.customChainOfThought}
|
||||
<span class="text-textcolor mt-4">{language.maxThoughtTagDepth}</span>
|
||||
<NumberInput bind:value={$DataBase.proomptSettings.maxThoughtTagDepth}/>
|
||||
<NumberInput bind:value={$DataBase.promptSettings.maxThoughtTagDepth}/>
|
||||
{/if}
|
||||
{/if}
|
||||
126
src/lib/UI/PromptDataItem.svelte
Normal file
126
src/lib/UI/PromptDataItem.svelte
Normal file
@@ -0,0 +1,126 @@
|
||||
<script lang="ts">
|
||||
import type { PromptItem, PromptItemChat } from "src/ts/process/prompt";
|
||||
import OptionInput from "./GUI/OptionInput.svelte";
|
||||
import TextAreaInput from "./GUI/TextAreaInput.svelte";
|
||||
import SelectInput from "./GUI/SelectInput.svelte";
|
||||
import { language } from "src/lang";
|
||||
import NumberInput from "./GUI/NumberInput.svelte";
|
||||
import CheckInput from "./GUI/CheckInput.svelte";
|
||||
import { ArrowDown, ArrowUp, XIcon } from "lucide-svelte";
|
||||
import TextInput from "./GUI/TextInput.svelte";
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
export let promptItem:PromptItem
|
||||
export let onRemove:() => void = () => {}
|
||||
export let moveUp:() => void = () => {}
|
||||
export let moveDown:() => void = () => {}
|
||||
|
||||
const chatPromptChange = () => {
|
||||
const currentprompt = promptItem as PromptItemChat
|
||||
if(currentprompt.rangeStart === -2){
|
||||
currentprompt.rangeStart = 0
|
||||
currentprompt.rangeEnd = 'end'
|
||||
}else{
|
||||
currentprompt.rangeStart = -2
|
||||
currentprompt.rangeEnd = 'end'
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col first:mt-0 mt-2 border border-selected p-4 rounded-md bg-darkbg">
|
||||
<span class="mb-2">
|
||||
<button class="float-right" on:click={onRemove}><XIcon /></button>
|
||||
<button class="float-right" on:click={moveDown}><ArrowDown /></button>
|
||||
<button class="float-right" on:click={moveUp}><ArrowUp /></button>
|
||||
</span>
|
||||
<span>{language.type}
|
||||
</span>
|
||||
<SelectInput bind:value={promptItem.type} on:change={() => {
|
||||
if(promptItem.type === 'plain' || promptItem.type === 'jailbreak' || promptItem.type === 'cot'){
|
||||
promptItem.text = ""
|
||||
promptItem.role = "system"
|
||||
}
|
||||
if(promptItem.type === 'chat'){
|
||||
promptItem.rangeStart = -2
|
||||
promptItem.rangeEnd = 'end'
|
||||
}
|
||||
}} >
|
||||
<OptionInput value="plain">{language.formating.plain}</OptionInput>
|
||||
<OptionInput value="jailbreak">{language.formating.jailbreak}</OptionInput>
|
||||
<OptionInput value="chat">{language.Chat}</OptionInput>
|
||||
<OptionInput value="persona">{language.formating.personaPrompt}</OptionInput>
|
||||
<OptionInput value="description">{language.formating.description}</OptionInput>
|
||||
<OptionInput value="authornote">{language.formating.authorNote}</OptionInput>
|
||||
<OptionInput value="lorebook">{language.formating.lorebook}</OptionInput>
|
||||
<OptionInput value="memory">{language.formating.memory}</OptionInput>
|
||||
<OptionInput value="postEverything">{language.formating.postEverything}</OptionInput>
|
||||
{#if $DataBase.promptSettings.customChainOfThought}
|
||||
<OptionInput value="cot">{language.cot}</OptionInput>
|
||||
{/if}
|
||||
</SelectInput>
|
||||
|
||||
{#if promptItem.type === 'plain' || promptItem.type === 'jailbreak' || promptItem.type === 'cot'}
|
||||
<span>{language.specialType}</span>
|
||||
<SelectInput bind:value={promptItem.type2}>
|
||||
<OptionInput value="normal">{language.noSpecialType}</OptionInput>
|
||||
<OptionInput value="main">{language.mainPrompt}</OptionInput>
|
||||
<OptionInput value="globalNote">{language.globalNote}</OptionInput>
|
||||
</SelectInput>
|
||||
<span>{language.prompt}</span>
|
||||
<TextAreaInput bind:value={promptItem.text} />
|
||||
<span>{language.role}</span>
|
||||
<SelectInput bind:value={promptItem.role}>
|
||||
<OptionInput value="user">{language.user}</OptionInput>
|
||||
<OptionInput value="bot">{language.character}</OptionInput>
|
||||
<OptionInput value="system">{language.systemPrompt}</OptionInput>
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if promptItem.type === 'chat'}
|
||||
<CheckInput name={language.advanced} check={promptItem.rangeStart !== -2} onChange={chatPromptChange}/>
|
||||
|
||||
|
||||
{#if promptItem.rangeStart !== -2}
|
||||
<span>{language.rangeStart}</span>
|
||||
<NumberInput bind:value={promptItem.rangeStart} />
|
||||
<span>{language.rangeEnd}</span>
|
||||
{#if promptItem.rangeEnd === 'end'}
|
||||
<CheckInput name={language.untilChatEnd} check={true} onChange={() => {
|
||||
if(promptItem.type === 'chat'){
|
||||
promptItem.rangeEnd = 0
|
||||
}
|
||||
}} />
|
||||
{:else}
|
||||
<NumberInput bind:value={promptItem.rangeEnd} marginBottom />
|
||||
<CheckInput name={language.untilChatEnd} check={false} onChange={() => {
|
||||
if(promptItem.type === 'chat'){
|
||||
promptItem.rangeEnd = 'end'
|
||||
}
|
||||
}} />
|
||||
{/if}
|
||||
{#if $DataBase.promptSettings.sendChatAsSystem}
|
||||
<CheckInput name={language.chatAsOriginalOnSystem} bind:check={promptItem.chatAsOriginalOnSystem}/>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{#if promptItem.type === 'authornote'}
|
||||
<span>{language.defaultPrompt}</span>
|
||||
<TextInput bind:value={promptItem.defaultText} />
|
||||
{/if}
|
||||
{#if promptItem.type === 'persona' || promptItem.type === 'description' || promptItem.type === 'authornote' || promptItem.type === 'memory'}
|
||||
{#if !promptItem.innerFormat}
|
||||
<CheckInput name={language.customInnerFormat} check={false} className="mt-2" onChange={() => {
|
||||
if(promptItem.type === 'persona' || promptItem.type === 'description' || promptItem.type === 'authornote' || promptItem.type === 'memory'){
|
||||
promptItem.innerFormat = "{{slot}}"
|
||||
}
|
||||
}} />
|
||||
{:else}
|
||||
<span>{language.innerFormat}</span>
|
||||
<TextAreaInput bind:value={promptItem.innerFormat}/>
|
||||
<CheckInput name={language.customInnerFormat} check={true} className="mt-2" onChange={() => {
|
||||
if(promptItem.type === 'persona' || promptItem.type === 'description' || promptItem.type === 'authornote' || promptItem.type === 'memory'){
|
||||
promptItem.innerFormat = null
|
||||
}
|
||||
}} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -1,110 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Proompt } from "src/ts/process/proompt";
|
||||
import OptionInput from "./GUI/OptionInput.svelte";
|
||||
import TextAreaInput from "./GUI/TextAreaInput.svelte";
|
||||
import SelectInput from "./GUI/SelectInput.svelte";
|
||||
import { language } from "src/lang";
|
||||
import NumberInput from "./GUI/NumberInput.svelte";
|
||||
import CheckInput from "./GUI/CheckInput.svelte";
|
||||
import { ArrowDown, ArrowUp, XIcon } from "lucide-svelte";
|
||||
import TextInput from "./GUI/TextInput.svelte";
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
export let proompt:Proompt
|
||||
export let onRemove:() => void = () => {}
|
||||
export let moveUp:() => void = () => {}
|
||||
export let moveDown:() => void = () => {}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col first:mt-0 mt-2 border border-selected p-4 rounded-md bg-darkbg">
|
||||
<span class="mb-2">
|
||||
<button class="float-right" on:click={onRemove}><XIcon /></button>
|
||||
<button class="float-right" on:click={moveDown}><ArrowDown /></button>
|
||||
<button class="float-right" on:click={moveUp}><ArrowUp /></button>
|
||||
</span>
|
||||
<span>{language.type}
|
||||
</span>
|
||||
<SelectInput bind:value={proompt.type} on:change={() => {
|
||||
if(proompt.type === 'plain' || proompt.type === 'jailbreak' || proompt.type === 'cot'){
|
||||
proompt.text = ""
|
||||
proompt.role = "system"
|
||||
}
|
||||
if(proompt.type === 'chat'){
|
||||
proompt.rangeStart = 0
|
||||
proompt.rangeEnd = 'end'
|
||||
}
|
||||
}} >
|
||||
<OptionInput value="plain">{language.formating.plain}</OptionInput>
|
||||
<OptionInput value="jailbreak">{language.formating.jailbreak}</OptionInput>
|
||||
<OptionInput value="chat">{language.Chat}</OptionInput>
|
||||
<OptionInput value="persona">{language.formating.personaPrompt}</OptionInput>
|
||||
<OptionInput value="description">{language.formating.description}</OptionInput>
|
||||
<OptionInput value="authornote">{language.formating.authorNote}</OptionInput>
|
||||
<OptionInput value="lorebook">{language.formating.lorebook}</OptionInput>
|
||||
<OptionInput value="memory">{language.formating.memory}</OptionInput>
|
||||
<OptionInput value="postEverything">{language.formating.postEverything}</OptionInput>
|
||||
{#if $DataBase.proomptSettings.customChainOfThought}
|
||||
<OptionInput value="cot">{language.cot}</OptionInput>
|
||||
{/if}
|
||||
</SelectInput>
|
||||
|
||||
{#if proompt.type === 'plain' || proompt.type === 'jailbreak' || proompt.type === 'cot'}
|
||||
<span>{language.specialType}</span>
|
||||
<SelectInput bind:value={proompt.type2}>
|
||||
<OptionInput value="normal">{language.noSpecialType}</OptionInput>
|
||||
<OptionInput value="main">{language.mainPrompt}</OptionInput>
|
||||
<OptionInput value="globalNote">{language.globalNote}</OptionInput>
|
||||
</SelectInput>
|
||||
<span>{language.prompt}</span>
|
||||
<TextAreaInput bind:value={proompt.text} />
|
||||
<span>{language.role}</span>
|
||||
<SelectInput bind:value={proompt.role}>
|
||||
<OptionInput value="user">{language.user}</OptionInput>
|
||||
<OptionInput value="bot">{language.character}</OptionInput>
|
||||
<OptionInput value="system">{language.systemPrompt}</OptionInput>
|
||||
</SelectInput>
|
||||
{/if}
|
||||
{#if proompt.type === 'chat'}
|
||||
<span>{language.rangeStart}</span>
|
||||
<NumberInput bind:value={proompt.rangeStart} />
|
||||
<span>{language.rangeEnd}</span>
|
||||
{#if proompt.rangeEnd === 'end'}
|
||||
<CheckInput name={language.untilChatEnd} check={true} onChange={() => {
|
||||
if(proompt.type === 'chat'){
|
||||
proompt.rangeEnd = 0
|
||||
}
|
||||
}} />
|
||||
{:else}
|
||||
<NumberInput bind:value={proompt.rangeEnd} marginBottom />
|
||||
<CheckInput name={language.untilChatEnd} check={false} onChange={() => {
|
||||
if(proompt.type === 'chat'){
|
||||
proompt.rangeEnd = 'end'
|
||||
}
|
||||
}} />
|
||||
{/if}
|
||||
{#if $DataBase.proomptSettings.sendChatAsSystem}
|
||||
<CheckInput name={language.chatAsOriginalOnSystem} bind:check={proompt.chatAsOriginalOnSystem}/>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if proompt.type === 'authornote'}
|
||||
<span>{language.defaultPrompt}</span>
|
||||
<TextInput bind:value={proompt.defaultText} />
|
||||
{/if}
|
||||
{#if proompt.type === 'persona' || proompt.type === 'description' || proompt.type === 'authornote' || proompt.type === 'memory'}
|
||||
{#if !proompt.innerFormat}
|
||||
<CheckInput name={language.customInnerFormat} check={false} className="mt-2" onChange={() => {
|
||||
if(proompt.type === 'persona' || proompt.type === 'description' || proompt.type === 'authornote' || proompt.type === 'memory'){
|
||||
proompt.innerFormat = "{{slot}}"
|
||||
}
|
||||
}} />
|
||||
{:else}
|
||||
<span>{language.innerFormat}</span>
|
||||
<TextAreaInput bind:value={proompt.innerFormat}/>
|
||||
<CheckInput name={language.customInnerFormat} check={true} className="mt-2" onChange={() => {
|
||||
if(proompt.type === 'persona' || proompt.type === 'description' || proompt.type === 'authornote' || proompt.type === 'memory'){
|
||||
proompt.innerFormat = null
|
||||
}
|
||||
}} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
Reference in New Issue
Block a user