refactor: Make custom chain of thought prompt option unrecommended

This commit is contained in:
kwaroran
2024-05-27 10:51:28 +09:00
parent 40c832d31a
commit 7e1e3ecc61
3 changed files with 9 additions and 5 deletions

View File

@@ -126,6 +126,7 @@ export const languageEnglish = {
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.",
useRegexLorebook: "If enabled, it will use regex for lorebook search, instead of string matching. it uses /regex/flags format.",
customChainOfThought: "If enabled, it will use custom chain of thought prompt instead of default one if chain of thought prompt is enabled. Warning: chain of thought toggle is no longer recommended to use. put chain of thought prompt in other prompt entries instead.",
},
setup: {
chooseProvider: "Choose AI Provider",

View File

@@ -8,6 +8,7 @@
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 Help from "src/lib/Others/Help.svelte";
let sorted = 0
let opened = 0
@@ -109,9 +110,11 @@
<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.promptSettings.maxThoughtTagDepth}/>
{#if $DataBase.showUnrecommended}
<Check bind:check={$DataBase.promptSettings.customChainOfThought} name={language.customChainOfThought} className="mt-4">
<Help unrecommended key='customChainOfThought' />
</Check>
{/if}
<span class="text-textcolor mt-4">{language.maxThoughtTagDepth}</span>
<NumberInput bind:value={$DataBase.promptSettings.maxThoughtTagDepth}/>
{/if}

View File

@@ -669,7 +669,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
formatedChat = name + ': ' + formatedChat
attr.push('nameAdded')
}
if(usingPromptTemplate && db.promptSettings.customChainOfThought && db.promptSettings.maxThoughtTagDepth !== -1){
if(usingPromptTemplate && db.promptSettings.maxThoughtTagDepth !== -1){
const depth = ms.length - index
if(depth >= db.promptSettings.maxThoughtTagDepth){
formatedChat = formatedChat.replace(/<Thoughts>(.+?)<\/Thoughts>/gm, '')