diff --git a/src/main/java/org/jabref/logic/ai/chatting/AiChatLogic.java b/src/main/java/org/jabref/logic/ai/chatting/AiChatLogic.java index d237afbdd0b..fb6f5656cdf 100644 --- a/src/main/java/org/jabref/logic/ai/chatting/AiChatLogic.java +++ b/src/main/java/org/jabref/logic/ai/chatting/AiChatLogic.java @@ -171,7 +171,7 @@ public AiMessage execute(UserMessage message) { chatMemory.messages().forEach(tempChatMemory::add); - tempChatMemory.add(new UserMessage(templatesService.makeChattingUserMessage(message.singleText(), excerpts))); + tempChatMemory.add(new UserMessage(templatesService.makeChattingUserMessage(entries, message.singleText(), excerpts))); chatMemory.add(message); AiMessage aiMessage = chatLanguageModel.generate(tempChatMemory.messages()).content(); diff --git a/src/main/java/org/jabref/logic/ai/templates/TemplatesService.java b/src/main/java/org/jabref/logic/ai/templates/TemplatesService.java index 79e1634491d..c130670d0bd 100644 --- a/src/main/java/org/jabref/logic/ai/templates/TemplatesService.java +++ b/src/main/java/org/jabref/logic/ai/templates/TemplatesService.java @@ -30,8 +30,9 @@ public String makeChattingSystemMessage(List entries) { return makeTemplate(AiTemplate.CHATTING_SYSTEM_MESSAGE, context); } - public String makeChattingUserMessage(String message, List excerpts) { + public String makeChattingUserMessage(List entries, String message, List excerpts) { VelocityContext context = new VelocityContext(baseContext); + context.put("entries", entries); context.put("message", message); context.put("excerpts", excerpts);