Skip to content

Commit 998abbf

Browse files
committed
code format
1 parent 61d59ea commit 998abbf

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

shared/src/main/java/com/javaaidev/pdfqa/AppConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
public class AppConfiguration {
1212

1313
@Bean
14-
public RetrievalAugmentationAdvisor questionAnswerAdvisor(VectorStore vectorStore) {
14+
public RetrievalAugmentationAdvisor questionAnswerAdvisor(
15+
VectorStore vectorStore) {
1516
return RetrievalAugmentationAdvisor.builder().documentRetriever(
16-
VectorStoreDocumentRetriever.builder().vectorStore(vectorStore).build()
17+
VectorStoreDocumentRetriever.builder().vectorStore(vectorStore)
18+
.build()
1719
).build();
1820
}
1921

shared/src/main/java/com/javaaidev/pdfqa/PDFContentLoader.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
public class PDFContentLoader implements CommandLineRunner {
1414

15-
private static final Logger LOGGER = LoggerFactory.getLogger(PDFContentLoader.class);
15+
private static final Logger LOGGER = LoggerFactory.getLogger(
16+
PDFContentLoader.class);
1617
private final VectorStore vectorStore;
1718

1819
public PDFContentLoader(VectorStore vectorStore) {
@@ -21,7 +22,8 @@ public PDFContentLoader(VectorStore vectorStore) {
2122

2223
public void load(Path pdfFilePath) {
2324
LOGGER.info("Load PDF file {}", pdfFilePath);
24-
var reader = new PagePdfDocumentReader(new FileSystemResource(pdfFilePath));
25+
var reader = new PagePdfDocumentReader(
26+
new FileSystemResource(pdfFilePath));
2527
var splitter = new TokenTextSplitter();
2628
var docs = splitter.split(reader.read());
2729
vectorStore.add(docs);
@@ -32,7 +34,9 @@ public void load(Path pdfFilePath) {
3234
public void run(String... args) throws Exception {
3335
var markerFile = Path.of(".", ".pdf-imported");
3436
if (Files.exists(markerFile)) {
35-
LOGGER.info("Marker file {} exists, skip. Delete this file to re-import.", markerFile);
37+
LOGGER.info(
38+
"Marker file {} exists, skip. Delete this file to re-import.",
39+
markerFile);
3640
return;
3741
}
3842
load(Path.of(".", "content", "Understanding_Climate_Change.pdf"));

shared/src/main/java/com/javaaidev/pdfqa/QaController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ public QaController(ChatClient.Builder builder,
2727
}
2828

2929
@PostMapping("/chat")
30-
public Flux<ServerSentEvent<ChatAgentResponse>> qa(@RequestBody ChatAgentRequest request) {
30+
public Flux<ServerSentEvent<ChatAgentResponse>> qa(
31+
@RequestBody ChatAgentRequest request) {
3132
return ModelAdapter.toStreamingResponse(
3233
chatClient.prompt()
33-
.messages(ModelAdapter.fromRequest(request).toArray(new Message[0]))
34+
.messages(
35+
ModelAdapter.fromRequest(request).toArray(new Message[0]))
3436
.stream()
3537
.chatResponse());
3638
}

0 commit comments

Comments
 (0)