feat: enable regex for lorebook search

This commit is contained in:
kwaroran
2024-05-26 03:52:19 +09:00
parent 21782b55be
commit 963d9736c8
2 changed files with 10 additions and 2 deletions

View File

@@ -125,6 +125,7 @@ export const languageEnglish = {
dynamicAssets: "If enabled, if the asset name is not found when processing data, it will try to find the closest asset name by using vector search and replace it with the closest asset name.", dynamicAssets: "If enabled, if the asset name is not found when processing data, it will try to find the closest asset name by using vector search and replace it with the closest asset name.",
dynamicAssetsEditDisplay: "If enabled, the dynamic assets will be applied to the Modify Display stage too. however, this can cause performance issues.", dynamicAssetsEditDisplay: "If enabled, the dynamic assets will be applied to the Modify Display stage too. however, this can cause performance issues.",
nickname: "Nickname would used be in {{char}} or <char> in chat instead of character's name if it is set.", nickname: "Nickname would used be in {{char}} or <char> in chat instead of character's name if it is set.",
useRegexLorebook: "If enabled, it will use regex for lorebook search, instead of string matching. it uses /regex/flags format.",
}, },
setup: { setup: {
chooseProvider: "Choose AI Provider", chooseProvider: "Choose AI Provider",
@@ -606,4 +607,5 @@ export const languageEnglish = {
risupresetDesc: "Risupreset format is a format specifically designed for RisuAI presets.", risupresetDesc: "Risupreset format is a format specifically designed for RisuAI presets.",
jsonDesc: "JSON format is a format that is easy to read and write for both humans and machines.", jsonDesc: "JSON format is a format that is easy to read and write for both humans and machines.",
nickname: "Nickname", nickname: "Nickname",
useRegexLorebook: "Use Regex"
} }

View File

@@ -56,7 +56,7 @@
<span class="text-textcolor mt-6">{language.name} <Help key="loreName"/></span> <span class="text-textcolor mt-6">{language.name} <Help key="loreName"/></span>
<TextInput size="sm" bind:value={value.comment}/> <TextInput size="sm" bind:value={value.comment}/>
{#if !lorePlus} {#if !lorePlus}
{#if !value.alwaysActive} {#if !value.alwaysActive && !value.useRegex}
<span class="text-textcolor mt-6">{language.activationKeys} <Help key="loreActivationKey"/></span> <span class="text-textcolor mt-6">{language.activationKeys} <Help key="loreActivationKey"/></span>
<span class="text-xs text-textcolor2">{language.activationKeysInfo}</span> <span class="text-xs text-textcolor2">{language.activationKeysInfo}</span>
<TextInput size="sm" bind:value={value.key}/> <TextInput size="sm" bind:value={value.key}/>
@@ -95,12 +95,18 @@
<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>
{#if !lorePlus} {#if !lorePlus && !value.useRegex}
<div class="flex items-center mt-2"> <div class="flex items-center mt-2">
<Check bind:check={value.selective} name={language.selective}/> <Check bind:check={value.selective} name={language.selective}/>
<Help key="loreSelective" name={language.selective}/> <Help key="loreSelective" name={language.selective}/>
</div> </div>
{/if} {/if}
{#if !lorePlus && !value.alwaysActive}
<div class="flex items-center mt-2">
<Check bind:check={value.useRegex} name={language.useRegexLorebook}/>
<Help key="useRegexLorebook" name={language.useRegexLorebook}/>
</div>
{/if}
{#if !lorePlus} {#if !lorePlus}
<div class="flex items-center mt-2 mb-6"> <div class="flex items-center mt-2 mb-6">
{#if value.activationPercent === undefined || value.activationPercent === null} {#if value.activationPercent === undefined || value.activationPercent === null}