refactor name and icon get

This commit is contained in:
kwaroran
2024-07-29 23:36:52 +09:00
parent 47c3fab589
commit 9d5b5da351
13 changed files with 73 additions and 45 deletions

View File

@@ -7,6 +7,7 @@ import { HypaProcesser } from "./hypamemory";
import { stringlizeChat } from "../stringlize";
import { globalFetch } from "src/ts/storage/globalApi";
import { runSummarizer } from "../transformers";
import { getUserName } from "src/ts/util";
export async function supaMemory(
chats:OpenAIChat[],
@@ -329,7 +330,7 @@ export async function supaMemory(
if((chunkSize + tokens) > maxChunkSize){
if(stringlizedChat === ''){
if(cont.role !== 'function' && cont.role !== 'system'){
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : db.username}: ${cont.content}\n\n`
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : getUserName()}: ${cont.content}\n\n`
spiceLen += 1
currentTokens -= tokens
chunkSize += tokens
@@ -338,7 +339,7 @@ export async function supaMemory(
lastId = cont.memo
break
}
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : db.username}: ${cont.content}\n\n`
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : getUserName()}: ${cont.content}\n\n`
spiceLen += 1
currentTokens -= tokens
chunkSize += tokens