HypaV2 context deletion safety (#680)

# PR Checklist
- [x] Did you check if it works normally in all models? *ignore this
when it dosen't uses models*
- [] Did you check if it works normally in all of web, local and node
hosted versions? if it dosen't, did you blocked it in those versions? <<
Checked on browser only, works fine
- [x] Did you added a type def?

# Description
HypaV2 data's large type definition update.
```ts
    mainChunks: { // summary itself
        id: number;
        text: string;
        chatMemos: Set<string>; // UUIDs of summarized chats
        lastChatMemo: string;
    }[];
    chunks: { // split mainChunks for retrieval or something. Although quite uncomfortable logic, so maybe I will delete it soon.
        mainChunkID: number;
        text:string;
    }[];
```
With this, ensure that mainChunks is relevant on chat context change by
deletion

If there is no UUID in the chat context, but it exists on chatMemos on
certain mainChunk, removes it.

Changed index.svelte.ts to update args on each call to ensure hypav2 to
stay adaptive on this change without refreshing the page

Also changed mainChunks to be pushed instead of unshifted
This commit is contained in:
kwaroran
2024-12-26 05:02:33 +09:00
committed by GitHub
7 changed files with 445 additions and 157 deletions

View File

@@ -229,6 +229,9 @@ export function setDatabase(data:Database){
if(checkNullish(data.supaMemoryKey)){
data.supaMemoryKey = ""
}
if(checkNullish(data.hypaMemoryKey)){
data.hypaMemoryKey = ""
}
if(checkNullish(data.supaModelType)){
data.supaModelType = "none"
}
@@ -630,6 +633,7 @@ export interface Database{
useStreaming:boolean
palmAPI:string,
supaMemoryKey:string
hypaMemoryKey:string
supaModelType:string
textScreenColor?:string
textBorder?:boolean