Skip to content

Commit c66da6e

Browse files
committed
fix: updates
1 parent a6e2141 commit c66da6e

File tree

6 files changed

+18
-8
lines changed

6 files changed

+18
-8
lines changed

backend/src/main/java/ch/xxx/aidoclibchat/domain/client/OpenLibraryClient.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* Copyright 2023 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
113
package ch.xxx.aidoclibchat.domain.client;
214

315
import java.util.List;
@@ -10,8 +22,6 @@
1022
import com.fasterxml.jackson.annotation.JsonProperty;
1123
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
1224

13-
14-
1525
public interface OpenLibraryClient extends Function<OpenLibraryClient.Request, OpenLibraryClient.Response> {
1626
@JsonIgnoreProperties(ignoreUnknown = true)
1727
record Book(@JsonProperty(value= "author_name", required = false) List<String> authorName,

backend/src/main/java/ch/xxx/aidoclibchat/usecase/mapping/DocumentMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public DocumentDto toDtoNoContent(Document entity) {
7171
public DocumentSearchDto toDto(AiDocumentResult aiResult) {
7272
var dto = new DocumentSearchDto();
7373
dto.setDocuments(aiResult.documents().stream().map(this::toDtoNoContent).toList());
74-
dto.setResultStrings(aiResult.generations().stream().map(myGen -> myGen.getOutput().getContent()).toList());
74+
dto.setResultStrings(aiResult.generations().stream().map(myGen -> myGen.getOutput().getText()).toList());
7575
dto.setSearchString(aiResult.searchString());
7676
return dto;
7777
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ public String generateTest(String url, Optional<String> testUrlOpt) {
121121
testExample)))
122122
.call().chatResponse();
123123
if ((Instant.now().getEpochSecond() - start.getEpochSecond()) >= 300) {
124-
LOGGER.info(response.getResult().getOutput().getContent());
124+
LOGGER.info(response.getResult().getOutput().getText());
125125
}
126126
LOGGER.info("Prompt tokens: " + response.getMetadata().getUsage().getPromptTokens());
127127
LOGGER.info("Generation tokens: " + response.getMetadata().getUsage().getGenerationTokens());
128128
LOGGER.info("Total tokens: " + response.getMetadata().getUsage().getTotalTokens());
129129
LOGGER.info("Time in seconds: {}", (Instant.now().toEpochMilli() - start.toEpochMilli()) / 1000.0);
130-
return response.getResult().getOutput().getContent();
130+
return response.getResult().getOutput().getText();
131131
}
132132

133133
public GithubSource createTestSources(String url, final boolean referencedSources) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public AiDocumentResult queryDocuments(SearchDto searchDto) {
230230
: new UserMessage(searchDto.getSearchString());
231231
LocalDateTime start = LocalDateTime.now();
232232
var response = chatClient.prompt().system(s -> s.text(systemMessage.getText()))
233-
.user(u -> u.text(userMessage.getContent())).call().chatResponse();
233+
.user(u -> u.text(userMessage.getText())).call().chatResponse();
234234
LOGGER.info("AI response time: {}ms",
235235
ZonedDateTime.of(LocalDateTime.now(), ZoneId.systemDefault()).toInstant().toEpochMilli()
236236
- ZonedDateTime.of(start, ZoneId.systemDefault()).toInstant().toEpochMilli());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private ResultData createAIResult(ImageQueryDto imageDto) {
123123
new ByteArrayResource(imageDto.getImageContent()))));
124124

125125
var response = this.chatClient.prompt(prompt).call().chatResponse();
126-
var resultData = new ResultData(response.getResult().getOutput().getContent(), imageDto);
126+
var resultData = new ResultData(response.getResult().getOutput().getText(), imageDto);
127127
return resultData;
128128
}
129129

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public SqlRowSet searchTables(SearchDto searchDto) {
128128
private String createQuery(Prompt prompt) {
129129
var chatStart = new Date();
130130
ChatResponse response = chatClient.prompt(prompt).call().chatResponse();
131-
String chatResult = response.getResults().stream().map(myGen -> myGen.getOutput().getContent())
131+
String chatResult = response.getResults().stream().map(myGen -> myGen.getOutput().getText())
132132
.collect(Collectors.joining(","));
133133
LOGGER.info("AI response time: {}ms", new Date().getTime() - chatStart.getTime());
134134
LOGGER.info("AI response: {}", chatResult);

0 commit comments

Comments
 (0)