Skip to content

Commit

Permalink
Refinements to clients and views
Browse files Browse the repository at this point in the history
  • Loading branch information
pacphi committed Dec 20, 2024
1 parent 4474091 commit b7a93c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/cftoolsuite/client/SanfordClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ public interface SanfordClient {
ResponseEntity<FileMetadata> uploadFile(@RequestPart("fileName") MultipartFile file);

@PostMapping("/api/crawl")
public ResponseEntity<CrawlResponse> startCrawl(@RequestBody CrawlRequest crawlRequest);
ResponseEntity<CrawlResponse> startCrawl(@RequestBody CrawlRequest crawlRequest);

@PostMapping("/api/fetch")
public ResponseEntity<FetchResponse> fetchUrls(@RequestBody FetchRequest request);
ResponseEntity<FetchResponse> fetchUrls(@RequestBody FetchRequest request);

@PostMapping(value = "/api/converse", consumes = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public ResponseEntity<AudioResponse> converse(@RequestBody byte[] audioBytes);
ResponseEntity<AudioResponse> converse(@RequestBody byte[] audioBytes);

@PostMapping("/api/chat")
public ResponseEntity<String> chat(@RequestBody Inquiry inquiry);
ResponseEntity<String> chat(@RequestBody Inquiry inquiry);

@GetMapping(value = "/api/files", produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<List<FileMetadata>> getFileMetadata(@RequestParam(value = "fileName", required = false) String fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
public interface SanfordStreamingClient {

@PostMapping("/api/stream/chat")
public Flux<String> streamResponseToQuestion(@RequestBody Inquiry inquiry);
Flux<String> streamResponseToQuestion(@RequestBody Inquiry inquiry);
}

2 changes: 1 addition & 1 deletion src/main/java/org/cftoolsuite/ui/view/ConverseView.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public ConverseView(SanfordClient sanfordClient, AppProperties appProperties) {

@Override
protected void setupUI() {

addClassName("box-border");
setAlignItems(Alignment.CENTER);
setSpacing(true);
setPadding(true);

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/cftoolsuite/ui/view/SummarizeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ protected void setupUI() {

protected void summarizeRequest() {
try {
ResponseEntity<String> response = sanfordClient.summarize(fileName.getValue());
String title = fileName.getValue();
ResponseEntity<String> response = sanfordClient.summarize(title);
if (response.getStatusCode().is2xxSuccessful() && response.getBody() != null) {
Dialog summaryDialog = new Dialog();
summaryDialog.setWidth("800px");

H3 title = new H3("Summary for " + fileName);
H3 heading = new H3(String.format("Summary for %s", title));

Div contentWrapper = new Div();
contentWrapper.setWidthFull();
Expand All @@ -86,7 +87,7 @@ protected void summarizeRequest() {
buttonLayout.setJustifyContentMode(JustifyContentMode.END);
buttonLayout.setWidthFull();

VerticalLayout layout = new VerticalLayout(title, contentWrapper, buttonLayout);
VerticalLayout layout = new VerticalLayout(heading, contentWrapper, buttonLayout);
summaryDialog.add(layout);
summaryDialog.open();
} else {
Expand Down

0 comments on commit b7a93c9

Please sign in to comment.