From bf1ea155a3f3fc2895270f7aea39c7d4e9dfc632 Mon Sep 17 00:00:00 2001 From: poroyo <132068975+poroyo@users.noreply.github.com> Date: Mon, 19 May 2025 19:52:07 +0900 Subject: [PATCH] revert: remove memo field logic from prompt text processing The memo field was used in prompt text logic, but its usage affects string merging conditions for the `formated` inside pushPrompts(). To avoid unintended merging issues, logic involving the memo field has been rolled back. --- src/ts/process/index.svelte.ts | 55 +++++++--------------------------- 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/src/ts/process/index.svelte.ts b/src/ts/process/index.svelte.ts index 5b10df9e..acc014a7 100644 --- a/src/ts/process/index.svelte.ts +++ b/src/ts/process/index.svelte.ts @@ -400,15 +400,13 @@ export async function sendChat(chatProcessIndex = -1,arg:{ if(currentChat.note){ unformated.authorNote.push({ role: 'system', - content: risuChatParser(currentChat.note, {chara: currentChar}), - memo: 'authornote' + content: risuChatParser(currentChat.note, {chara: currentChar}) }) } else if(getAuthorNoteDefaultText() !== ''){ unformated.authorNote.push({ role: 'system', - content: risuChatParser(getAuthorNoteDefaultText(), {chara: currentChar}), - memo: 'authornote' + content: risuChatParser(getAuthorNoteDefaultText(), {chara: currentChar}) }) } @@ -438,8 +436,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ unformated.description.push({ role: 'system', - content: description, - memo: 'description', + content: description }) if(nowChatroom.type === 'group'){ @@ -460,8 +457,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ for(const lorebook of normalActives){ unformated.lorebook.push({ role: lorebook.role, - content: risuChatParser(lorebook.prompt, {chara: currentChar}), - memo: 'lore', + content: risuChatParser(lorebook.prompt, {chara: currentChar}) }) } @@ -485,8 +481,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ if(DBState.db.personaPrompt){ unformated.personaPrompt.push({ role: 'system', - content: risuChatParser(getPersonaPrompt(), {chara: currentChar}), - memo: 'persona', + content: risuChatParser(getPersonaPrompt(), {chara: currentChar}) }) } @@ -511,8 +506,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ for(const lorebook of postEverythingLorebooks){ unformated.postEverything.push({ role: lorebook.role, - content: risuChatParser(lorebook.prompt, {chara: currentChar}), - memo: 'postEverything', + content: risuChatParser(lorebook.prompt, {chara: currentChar}) }) } @@ -1100,12 +1094,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{ } } - type MemoType = 'persona' | 'description' | 'authornote' | 'supaMemory'; - const promptBodyMap: Record = { persona: [], description: [], authornote: [], supaMemory: [] }; - function pushPromptInfoBody(memo: MemoType, fmt: string) { - promptBodyMap[memo].push(risuChatParser(fmt)); - } - if(promptTemplate){ const template = promptTemplate @@ -1118,7 +1106,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ pmt[i].content = risuChatParser(positionParser(card.innerFormat), {chara: currentChar}).replace('{{slot}}', pmt[i].content) if(DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat){ - pushPromptInfoBody(card.type, card.innerFormat) + } } } @@ -1133,7 +1121,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ pmt[i].content = risuChatParser(positionParser(card.innerFormat), {chara: currentChar}).replace('{{slot}}', pmt[i].content) if(DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat){ - pushPromptInfoBody(card.type, card.innerFormat) + } } } @@ -1148,7 +1136,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ pmt[i].content = risuChatParser(positionParser(card.innerFormat), {chara: currentChar}).replace('{{slot}}', pmt[i].content || card.defaultText || '') if(DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat){ - pushPromptInfoBody(card.type, card.innerFormat) + } } } @@ -1267,7 +1255,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{ pmt[i].content = risuChatParser(card.innerFormat, {chara: currentChar}).replace('{{slot}}', pmt[i].content) if(DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat){ - pushPromptInfoBody('supaMemory', card.innerFormat) + } } } @@ -1388,29 +1376,6 @@ export async function sendChat(chatProcessIndex = -1,arg:{ return true } - - function isPromptMemo(m: string): m is MemoType { - return ['persona', 'description', 'authornote', 'supaMemory'].includes(m); - } - if(DBState.db.promptInfoInsideChat && DBState.db.promptTextInfoInsideChat){ - const promptBodyInfo: OpenAIChat[] = formated.flatMap(format => { - if (isPromptMemo(format.memo)) { - return promptBodyMap[format.memo].map(content => ({ - role: format.role, - content, - })) - } - - if (format.memo == null) { - return [format] - } - - return [] - }) - - promptInfo.promptText = promptBodyInfo - } - let result = '' let emoChanged = false let resendChat = false