Skip to content

Commit 7751820

Browse files
committed
fix: generation
1 parent 6c0f0f0 commit 7751820

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

backend/src/main/java/ch/xxx/aidoclibchat/usecase/service/DocumentService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,16 @@ public Optional<Book> findBookByUuid(String uuidStr) {
139139
@Async
140140
public void addBookSummaries(Book book) {
141141
var myChapters = book.getChapters().stream().map(myChapter -> {
142-
Message systemMessage = new SystemPromptTemplate(this.bookPrompt)
143-
.createMessage(Map.of("text", myChapter.getChapterText()));
144-
myChapter.setSummary(systemMessage.getContent());
142+
var answer = this.chatClient.call(new SystemPromptTemplate(this.bookPrompt)
143+
.createMessage(Map.of("text", myChapter.getChapterText())).getContent());
144+
myChapter.setSummary(answer);
145145
return myChapter;
146146
}).toList();
147147
// LOGGER.info(myChapters.getLast().getSummary());
148148
var summaries = myChapters.stream().map(myChapter -> myChapter.getChapterText())
149149
.reduce((acc, myChapter) -> acc + "\n" + myChapter);
150-
book.setSummary(
151-
new SystemPromptTemplate(this.bookPrompt).createMessage(Map.of("text", summaries)).getContent());
150+
book.setSummary(this.chatClient.call(
151+
new SystemPromptTemplate(this.bookPrompt).createMessage(Map.of("text", summaries)).getContent()));
152152
// LOGGER.info(myBook.getSummary());
153153
this.bookRepository.save(book);
154154
}

0 commit comments

Comments
 (0)