From 40e91e59a73030fc68c2ae87ab4d245edf1a50de Mon Sep 17 00:00:00 2001 From: enzi221 Date: Fri, 16 May 2025 03:36:50 +0900 Subject: [PATCH] feat: Return all lore books of same name without sort --- src/ts/process/lua.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/ts/process/lua.ts b/src/ts/process/lua.ts index 080d1023..274833aa 100644 --- a/src/ts/process/lua.ts +++ b/src/ts/process/lua.ts @@ -498,13 +498,9 @@ export async function runLua(code:string, arg:{ } const loreBooks = [...selectedChar.chats[selectedChar.chatPage]?.localLore ?? [], ...selectedChar.globalLore, ...getModuleLorebooks()] - const found = loreBooks.find((b) => b.comment === search) + const found = loreBooks.filter((b) => b.comment === search) - if (found) { - return JSON.stringify({ ...found, content: risuChatParser(found.content, { chara: selectedChar }) } satisfies loreBook) - } else { - return JSON.stringify(false) - } + return JSON.stringify(found.map((b) => ({ ...b, content: risuChatParser(b.content, { chara: selectedChar }) }))) }) luaEngine.global.set('loadLoreBooksMain', async (id:string, usedContext:number) => {