Skip to content

Commit

Permalink
Add entries variable to user message in AI chat (JabRef#12184)
Browse files Browse the repository at this point in the history
* Fix AI settings

* Add `entries` variable to user message template
  • Loading branch information
InAnYan authored Nov 11, 2024
1 parent 71b238c commit 9d8c590
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ public String makeChattingSystemMessage(List<BibEntry> entries) {
return makeTemplate(AiTemplate.CHATTING_SYSTEM_MESSAGE, context);
}

public String makeChattingUserMessage(String message, List<PaperExcerpt> excerpts) {
public String makeChattingUserMessage(List<BibEntry> entries, String message, List<PaperExcerpt> excerpts) {
VelocityContext context = new VelocityContext(baseContext);
context.put("entries", entries);
context.put("message", message);
context.put("excerpts", excerpts);

Expand Down

0 comments on commit 9d8c590

Please sign in to comment.