[feat] lorebook tokens
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
import TextInput from "../../UI/GUI/TextInput.svelte";
|
import TextInput from "../../UI/GUI/TextInput.svelte";
|
||||||
import NumberInput from "../../UI/GUI/NumberInput.svelte";
|
import NumberInput from "../../UI/GUI/NumberInput.svelte";
|
||||||
import TextAreaInput from "../../UI/GUI/TextAreaInput.svelte";
|
import TextAreaInput from "../../UI/GUI/TextAreaInput.svelte";
|
||||||
|
import { tokenizeAccurate } from "src/ts/tokenizer";
|
||||||
export let value:loreBook
|
export let value:loreBook
|
||||||
export let onRemove: () => void = () => {}
|
export let onRemove: () => void = () => {}
|
||||||
export let onClose: () => void = () => {}
|
export let onClose: () => void = () => {}
|
||||||
@@ -16,6 +17,12 @@
|
|||||||
|
|
||||||
export let idx:number
|
export let idx:number
|
||||||
let open = false
|
let open = false
|
||||||
|
|
||||||
|
async function getTokens(data:string){
|
||||||
|
tokens = await tokenizeAccurate(data)
|
||||||
|
return tokens
|
||||||
|
}
|
||||||
|
let tokens = 0
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-full flex flex-col pt-2 mt-2 border-t border-t-selected first:pt-0 first:mt-0 first:border-0" data-risu-idx={idx}>
|
<div class="w-full flex flex-col pt-2 mt-2 border-t border-t-selected first:pt-0 first:mt-0 first:border-0" data-risu-idx={idx}>
|
||||||
@@ -80,6 +87,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<span class="text-textcolor mt-4 mb-2">{language.prompt}</span>
|
<span class="text-textcolor mt-4 mb-2">{language.prompt}</span>
|
||||||
<TextAreaInput autocomplete="off" bind:value={value.content} />
|
<TextAreaInput autocomplete="off" bind:value={value.content} />
|
||||||
|
{#await getTokens(value.content)}
|
||||||
|
<span class="text-textcolor2 mt-2 mb-2 text-sm">{tokens} {language.tokens}</span>
|
||||||
|
{:then e}
|
||||||
|
<span class="text-textcolor2 mt-2 mb-2 text-sm">{e} {language.tokens}</span>
|
||||||
|
{/await}
|
||||||
<div class="flex items-center mt-4">
|
<div class="flex items-center mt-4">
|
||||||
<Check bind:check={value.alwaysActive} name={language.alwaysActive}/>
|
<Check bind:check={value.alwaysActive} name={language.alwaysActive}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user