Add option to remove punctuation for HypaMemory

This commit is contained in:
kwaroran
2024-01-15 18:00:19 +09:00
parent f5b4d87db0
commit 52940af010
4 changed files with 14 additions and 1 deletions

View File

@@ -109,6 +109,7 @@ export const languageEnglish = {
genTimes: "This option is used to set the number of responses to generate on support models. other then first response will be act as cached reroll. this can reduce the cost of the model, but it can also increase the cost if you use it without reroll.",
requestretrys: "This option is used to set the number of request retrys when request fails.",
emotionPrompt: "This option is used to set the prompt that is used to detect emotion. if it is blank, it will use the default prompt.",
removePunctuationHypa: "If enabled, it will remove punctuation before executing HypaMemory.",
},
setup: {
chooseProvider: "Choose AI Provider",
@@ -504,4 +505,5 @@ export const languageEnglish = {
openrouterFallback: "Openrouter Fallback",
openrouterMiddleOut: "Openrouter Middle Out",
geminiApiKey: "Gemini API Key",
removePunctuationHypa: "Remove Punctuation for HypaMemory",
}

View File

@@ -92,6 +92,11 @@
<Help key="chainOfThought"/><Help key="experimental"/>
</Check>
</div>
<div class="flex items-center mt-4">
<Check bind:check={$DataBase.removePunctuationHypa} name={language.removePunctuationHypa}>
<Help key="removePunctuationHypa"/><Help key="experimental"/>
</Check>
</div>
<div class="flex items-center mt-4">
<Check check={$DataBase.tpo} name="Alpha DevMode" onChange={() => {
// access code is "tendo"

View File

@@ -142,6 +142,11 @@ export async function supaMemory(
if(hypaChunks.length > 0){
await hypa.addText(hypaChunks.filter((value, index, self) => {
return self.indexOf(value) === index;
}).map((value) => {
if(db.removePunctuationHypa){
value = value.replace(/[\.,\/#!$%\^&\*;:{}=\-_`~()]/g,"")
}
return value
}))
const filteredChat = chats.filter((r) => r.role !== 'system' && r.role !== 'function')
const s = await hypa.similaritySearch(stringlizeChat(filteredChat.slice(0, 4), char?.name ?? '', false))

View File

@@ -592,7 +592,8 @@ export interface Database{
},
top_k:number
claudeAws:boolean
lastPatchNoteCheckVersion?:string
lastPatchNoteCheckVersion?:string,
removePunctuationHypa?:boolean
}
export interface customscript{