From 5626944e8ec746e844b170bd7f7bc9a9acafe5bb Mon Sep 17 00:00:00 2001 From: Heesu Suh Date: Thu, 24 Oct 2024 15:43:11 +0900 Subject: [PATCH] send only 20 most recent messages to LLM (#36) --- 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',