From 1c12ae3d75f819561ee8d8649d9411a2a6f2ce75 Mon Sep 17 00:00:00 2001 From: Heesu Suh Date: Thu, 24 Oct 2024 15:42:50 +0900 Subject: [PATCH] send only 20 most recent messages to LLM --- src/utils/promptGenerator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/promptGenerator.ts b/src/utils/promptGenerator.ts index 87fc0b1..9960d14 100644 --- a/src/utils/promptGenerator.ts +++ b/src/utils/promptGenerator.ts @@ -96,7 +96,7 @@ export class PromptGenerator { const requestMessages: RequestMessage[] = [ systemMessage, ...(currentFileMessage ? [currentFileMessage] : []), - ...compiledMessages.map((message): RequestMessage => { + ...compiledMessages.slice(-20).map((message): RequestMessage => { if (message.role === 'user') { return { role: 'user',