Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Aug 15, 2024
1 parent 3cd4160 commit 3567e7f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,22 @@ public class AudioData implements Serializable {
private String audioAsText;

@JsonProperty("actionItems")
private String actionItems;
private List<String> actionItems;

@JsonProperty("summary")
private String summary;

@JsonProperty("tone")
private String tone;

private List<String> actionItemsList;

public AudioData() { }

public AudioData(String id, String audioAsText, String actionItems, String summary, String tone) {
public AudioData(String id, String audioAsText, List<String> actionItems, String summary, String tone) {
this.setId(id);
this.audioAsText = audioAsText;
this.actionItems = actionItems;
this.summary = summary;
this.tone = tone;

this.setActionItemsList(this.actionItems);
}

public void setId(String id) {
Expand All @@ -51,20 +47,12 @@ public void setAudioAsText(String audioAsText) {
public String getAudioAsText() {
return this.audioAsText;
}
public void setActionItems(String actionItems) {
public void setActionItems(List<String> actionItems) {
this.actionItems = actionItems;
this.setActionItemsList(this.actionItems);
}
public String getActionItems() {
public List<String> getActionItems() {
return this.actionItems;
}
public List<String> getActionItemsList() {
return this.actionItemsList;
}
public void setActionItemsList(String actionItems) {
this.actionItemsList = List.of(actionItems.split("- "));
this.actionItemsList = this.actionItemsList.subList(1, this.actionItemsList.size());
}
public void setSummary(String summary) {
this.summary = summary;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ public List<AudioData> audioSearch() {
.bodyToMono(String.class)
.block();

audioData = this.objectMapper.readValue(response, this.objectMapper.getTypeFactory().constructCollectionType(List.class, AudioData.class));
// Configure ObjectMapper to allow coercion of empty strings to null
ObjectMapper objectMapper = this.objectMapper.copy();
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);

// Deserialize the JSON array response into a list of AudioData objects
audioData = objectMapper.readValue(response, objectMapper.getTypeFactory().constructCollectionType(List.class, AudioData.class));

} catch (WebClientException wce) {
e = wce;
} catch (IllegalArgumentException iae) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ <h5 class="mb-0">
</div>
<div style="margin-bottom: 20px;">
<span style="font-weight: bold;">Action Items: <br/> </span>
<div th:if="${audioData.actionItemsList.size() > 0}">
<div th:each="actionItem : ${audioData.actionItemsList}">
<div th:if="${audioData.actionItems != null && audioData.actionItems.size() > 0}">
<div th:each="actionItem : ${audioData.actionItems}">
<span th:text="${actionItem}"></span>
<br>
</div>
</div>
<img th:unless="${audioData.actionItemsList.size() > 0}" src="content/spinner.gif" alt="Spinner" style="height: 10%; width: 10%;">
<img th:unless="${audioData.actionItems != null && audioData.actionItems.size() > 0}" src="content/spinner.gif" alt="Spinner" style="height: 10%; width: 10%;">
</div>
</div>
</div>
Expand Down

0 comments on commit 3567e7f

Please sign in to comment.