From cc223dfefa699204d0b99e0c5e901e6908375932 Mon Sep 17 00:00:00 2001 From: Kwaroran Date: Fri, 27 Dec 2024 15:56:48 +0900 Subject: [PATCH] feat: limit thoughts extraction based on maxThoughtTagDepth setting --- src/ts/process/index.svelte.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ts/process/index.svelte.ts b/src/ts/process/index.svelte.ts index dfd67895..d3f9957f 100644 --- a/src/ts/process/index.svelte.ts +++ b/src/ts/process/index.svelte.ts @@ -753,8 +753,11 @@ export async function sendChat(chatProcessIndex = -1,arg:{ } } let thoughts:string[] = [] + const maxThoughtDepth = DBState.db.promptSettings?.maxThoughtTagDepth ?? -1 formatedChat = formatedChat.replace(/(.+)<\/Thoughts>/gms, (match, p1) => { - thoughts.push(p1) + if(maxThoughtDepth === -1 || (maxThoughtDepth - ms.length) <= index){ + thoughts.push(p1) + } return '' })