Experimental settings updated

regular push for saving
This commit is contained in:
LightningHyperBlaze45654
2024-06-12 20:58:30 -07:00
parent 0e70869b88
commit 9e77b46936
7 changed files with 35 additions and 30 deletions

View File

@@ -277,25 +277,29 @@
<SelectInput value={
$DataBase.hypav2 ? 'hypaV2' :
$DataBase.supaMemoryType !== 'none' ? 'supaMemory' :
$DataBase.supaModelType !== 'none' ? 'supaMemory' :
$DataBase.hanuraiEnable ? 'hanuraiMemory' : 'none'
} on:change={(v) => {
//@ts-ignore
const value = v.target.value
if (value === 'supaMemory'){
$DataBase.supaMemoryType = 'distilbart'
$DataBase.supaModelType = 'distilbart'
$DataBase.memoryAlgorithmType = 'supaMemory'
$DataBase.hypav2 = false
$DataBase.hanuraiEnable = false
} else if (value === 'hanuraiMemory'){
$DataBase.supaMemoryType = 'none'
$DataBase.supaModelType = 'none'
$DataBase.memoryAlgorithmType = 'hanuraiMemory'
$DataBase.hypav2 = false
$DataBase.hanuraiEnable = true
} else if (value === 'hypaV2') {
$DataBase.supaMemoryType = 'hypaV2'
$DataBase.supaModelType = 'hypaV2'
$DataBase.memoryAlgorithmType = 'hypaMemoryV2'
$DataBase.hypav2= true
$DataBase.hanuraiEnable = false
} else {
$DataBase.supaMemoryType = 'none'
$DataBase.supaModelType = 'none'
$DataBase.memoryAlgorithmType = 'none'
$DataBase.hypav2 = false
$DataBase.hanuraiEnable = false
}
@@ -316,12 +320,12 @@
{:else if $DataBase.hypav2}
<span class="mb-2 text-textcolor2 text-sm text-wrap break-words max-w-full">{language.hypaV2Desc}</span>
<span class="text-textcolor mt-4">{language.SuperMemory} {language.model}</span>
<SelectInput className="mt-2 mb-2" bind:value={$DataBase.supaMemoryType}>
<SelectInput className="mt-2 mb-2" bind:value={$DataBase.supaModelType}>
<OptionInput value="distilbart">distilbart-cnn-6-6 (Free/Local)</OptionInput>
<OptionInput value="instruct35">OpenAI 3.5 Turbo Instruct</OptionInput>
<OptionInput value="subModel">{language.submodel}</OptionInput>
</SelectInput>
{#if $DataBase.supaMemoryType === 'davinci' || $DataBase.supaMemoryType === 'curie' || $DataBase.supaMemoryType === 'instruct35'}
{#if $DataBase.supaModelType === 'davinci' || $DataBase.supaModelType === 'curie' || $DataBase.supaModelType === 'instruct35'}
<span class="text-textcolor">{language.SuperMemory} OpenAI Key</span>
<TextInput size="sm" marginBottom bind:value={$DataBase.supaMemoryKey}/>
{/if}
@@ -337,21 +341,21 @@
<NumberInput size="sm" marginBottom bind:value={$DataBase.hypaChunkSize} min={100} />
<span class="text-textcolor">{language.hypaAllocatedTokens}</span>
<NumberInput size="sm" marginBottom bind:value={$DataBase.hypaAllocatedTokens} min={100} />
{:else if ($DataBase.supaMemoryType !== 'none' && $DataBase.hypav2 === false)}
{:else if ($DataBase.supaModelType !== 'none' && $DataBase.hypav2 === false)}
<span class="mb-2 text-textcolor2 text-sm text-wrap break-words max-w-full">{language.supaDesc}</span>
<span class="text-textcolor mt-4">{language.SuperMemory} {language.model}</span>
<SelectInput className="mt-2 mb-2" bind:value={$DataBase.supaMemoryType}>
<SelectInput className="mt-2 mb-2" bind:value={$DataBase.supaModelType}>
<OptionInput value="distilbart" >distilbart-cnn-6-6 (Free/Local)</OptionInput>
<OptionInput value="instruct35" >OpenAI 3.5 Turbo Instruct</OptionInput>
<OptionInput value="subModel" >{language.submodel}</OptionInput>
</SelectInput>
<span class="text-textcolor">{language.maxSupaChunkSize}</span>
<NumberInput size="sm" marginBottom bind:value={$DataBase.maxSupaChunkSize} min={100} />
{#if $DataBase.supaMemoryType === 'davinci' || $DataBase.supaMemoryType === 'curie' || $DataBase.supaMemoryType === 'instruct35'}
{#if $DataBase.supaModelType === 'davinci' || $DataBase.supaModelType === 'curie' || $DataBase.supaModelType === 'instruct35'}
<span class="text-textcolor">{language.SuperMemory} OpenAI Key</span>
<TextInput size="sm" marginBottom bind:value={$DataBase.supaMemoryKey}/>
{/if}
{#if $DataBase.supaMemoryType !== 'none'}
{#if $DataBase.supaModelType !== 'none'}
<span class="text-textcolor">{language.SuperMemory} Prompt</span>
<TextInput size="sm" marginBottom bind:value={$DataBase.supaMemoryPrompt} placeholder="Leave it blank to use default"/>
{/if}

View File

@@ -257,7 +257,7 @@
{/each}
{#if $DataBase.supaMemoryType !== 'none' || $DataBase.hanuraiEnable}
{#if $DataBase.supaModelType !== 'none' || $DataBase.hanuraiEnable}
{#if $DataBase.hanuraiEnable}
<div class="flex mt-2 items-center">
<Check bind:check={currentChar.data.supaMemory} name={ language.hanuraiMemory}/>
@@ -904,12 +904,12 @@
<span> <Help key="utilityBot" name={language.utilityBot}/></span>
</div>
{#if $DataBase.supaMemoryType !== 'none' && $DataBase.hypav2}
{#if $DataBase.supaModelType !== 'none' && $DataBase.hypav2}
<Button
on:click={() => {
currentChar.data.chats[currentChar.data.chatPage].hypaV2Data ??= {
chunks: [],
mainChunks: []
mainChunks: []
}
showHypaV2Alert()
}}

View File

@@ -165,7 +165,7 @@
</div>
{/each}
{#if $DataBase.supaMemoryType !== 'none' || $DataBase.hanuraiEnable}
{#if $DataBase.supaModelType !== 'none' || $DataBase.hanuraiEnable}
{#if $DataBase.hanuraiEnable}
<div class="flex mt-2 items-center">
<CheckInput bind:check={chara.supaMemory} name={ language.hanuraiMemory}/>

View File

@@ -714,7 +714,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
currentTokens += await tokenizer.tokenizeChat(chat)
}
if(nowChatroom.supaMemory && (db.supaMemoryType !== 'none' || db.hanuraiEnable)){
if(nowChatroom.supaMemory && (db.supaModelType !== 'none' || db.hanuraiEnable)){
chatProcessStage.set(2)
if(db.hanuraiEnable){
const hn = await hanuraiMemory(chats, {
@@ -730,7 +730,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
chats = hn.chats
currentTokens = hn.tokens
}
else if(db.supaMemoryType !== 'none' && db.hypav2){ //HypaV2 support needs to be changed like this.
else if(db.hypav2){ //HypaV2 support needs to be changed like this.
const sp = await hypaMemoryV2(chats, currentTokens, maxContextTokens, currentChat, nowChatroom, tokenizer)
if(sp.error){
alertError(sp.error)

View File

@@ -26,7 +26,7 @@ async function summary(stringlizedChat: string): Promise<{ success: boolean; dat
* @param {string} stringlizedChat - The chat to be summarized, represented as a string.
* @return {Promise<{ success: boolean; data: string }>} A promise that resolves to an object containing the success status and the generated summary.
*/
if (db.supaMemoryType === 'distilbart') {
if (db.supaModelType === 'distilbart') {
try {
const sum = await runSummarizer(stringlizedChat);
return { success: true, data: sum };
@@ -43,7 +43,7 @@ async function summary(stringlizedChat: string): Promise<{ success: boolean; dat
: db.supaMemoryPrompt;
let result = '';
if (db.supaMemoryType !== 'subModel') {
if (db.supaModelType !== 'subModel') {
const promptbody = stringlizedChat + '\n\n' + supaPrompt + "\n\nOutput:";
const da = await globalFetch("https://api.openai.com/v1/completions", {
headers: {
@@ -52,8 +52,8 @@ async function summary(stringlizedChat: string): Promise<{ success: boolean; dat
},
method: "POST",
body: {
"model": db.supaMemoryType === 'curie' ? "text-curie-001"
: db.supaMemoryType === 'instruct35' ? 'gpt-3.5-turbo-instruct'
"model": db.supaModelType === 'curie' ? "text-curie-001"
: db.supaModelType === 'instruct35' ? 'gpt-3.5-turbo-instruct'
: "text-davinci-003",
"prompt": promptbody,
"max_tokens": 600,
@@ -220,7 +220,7 @@ export async function hypaMemoryV2(
await processor.addText(data.chunks.filter(v => {
return v.text.trim().length > 0;
}).map((v) => {
return "search_document: " + v.text.trim();hy
return "search_document: " + v.text.trim();
}));
let scoredResults: { [key: string]: number } = {};

View File

@@ -183,7 +183,7 @@ export async function supaMemory(
async function summarize(stringlizedChat:string){
if(db.supaMemoryType === 'distilbart'){
if(db.supaModelType === 'distilbart'){
try {
const sum = await runSummarizer(stringlizedChat)
return sum
@@ -204,7 +204,7 @@ export async function supaMemory(
let result = ''
if(db.supaMemoryType !== 'subModel'){
if(db.supaModelType !== 'subModel'){
const promptbody = stringlizedChat + '\n\n' + supaPrompt + "\n\nOutput:"
const da = await globalFetch("https://api.openai.com/v1/completions",{
@@ -214,8 +214,8 @@ export async function supaMemory(
},
method: "POST",
body: {
"model": db.supaMemoryType === 'curie' ? "text-curie-001"
: db.supaMemoryType === 'instruct35' ? 'gpt-3.5-turbo-instruct'
"model": db.supaModelType === 'curie' ? "text-curie-001"
: db.supaModelType === 'instruct35' ? 'gpt-3.5-turbo-instruct'
: "text-davinci-003",
"prompt": promptbody,
"max_tokens": 600,

View File

@@ -230,8 +230,8 @@ export function setDatabase(data:Database){
if(checkNullish(data.supaMemoryKey)){
data.supaMemoryKey = ""
}
if(checkNullish(data.supaMemoryType)){
data.supaMemoryType = "none"
if(checkNullish(data.supaModelType)){
data.supaModelType = "none"
}
if(checkNullish(data.askRemoval)){
data.askRemoval = true
@@ -526,7 +526,7 @@ export interface Database{
useStreaming:boolean
palmAPI:string,
supaMemoryKey:string
supaMemoryType:string
supaModelType:string
textScreenColor?:string
textBorder?:boolean
textScreenRounded?:boolean
@@ -568,7 +568,8 @@ export interface Database{
useAdditionalAssetsPreview:boolean,
usePlainFetch:boolean
hypaMemory:boolean
hypav2:boolean // Why this is not appended?
hypav2:boolean
memoryAlgorithmType:string // To enable new memory module/algorithms
proxyRequestModel:string
ooba:OobaSettings
ainconfig: AINsettings