feat: Add option to enable dynamic assets in Modify Display stage

This commit is contained in:
kwaroran
2024-05-22 19:36:32 +09:00
parent deef7de308
commit 6b96a36061
4 changed files with 13 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ export const languageEnglish = {
autoContinueChat: "If enabled, it will try to continue the chat if it doesn't ends with a punctuation. DONT USE THIS WITH LANGUAGES THAT DOESN'T USE PUNCTUATION.",
combineTranslation: "If enabled, text that is one sentence but separated by HTML tags will be combined together and translated, then Modify Display script will be reapplied to the translated output.\nThis helps the translator to make the correct translation.\nIf the UI becomes weird when you enable this option, please turn off the option and report it.",
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.",
},
setup: {
chooseProvider: "Choose AI Provider",
@@ -592,4 +593,5 @@ export const languageEnglish = {
noMessage: "Type something to start the chat.",
combineTranslation : "Combine Translation",
dynamicAssets: "Dynamic Assets",
dynamicAssetsEditDisplay: "Use Dynamic Assets in Display",
}

View File

@@ -118,6 +118,13 @@
<Help key="dynamicAssets"/>
</Check>
</div>
{#if $DataBase.dynamicAssets}
<div class="flex items-center mt-4">
<Check bind:check={$DataBase.dynamicAssetsEditDisplay} name={language.dynamicAssetsEditDisplay}>
<Help key="dynamicAssetsEditDisplay"/>
</Check>
</div>
{/if}
<div class="flex items-center mt-4">
<Check bind:check={$DataBase.usePlainFetch} name={language.forcePlainFetch}> <Help key="forcePlainFetch" unrecommended/></Check>
</div>

View File

@@ -214,6 +214,9 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
}
if(db.dynamicAssets && (char.type === 'simple' || char.type === 'character') && char.additionalAssets && char.additionalAssets.length > 0){
if(!db.dynamicAssetsEditDisplay && mode === 'editdisplay'){
return {data, emoChanged}
}
const assetNames = char.additionalAssets.map((v) => v[0])
const processer = new HypaProcesser('MiniLM')
await processer.addText(assetNames)

View File

@@ -656,6 +656,7 @@ export interface Database{
textAreaTextSize:number
combineTranslation:boolean
dynamicAssets:boolean
dynamicAssetsEditDisplay:boolean
}
export interface customscript{