Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Vitale <[email protected]>
  • Loading branch information
ThomasVitale committed May 14, 2024
1 parent 5685c26 commit 5f05d43
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,4 @@ String chatFromImageUrl(@RequestParam(defaultValue = "What do you see in this pi
return chatService.chatFromImageUrl(message);
}

@GetMapping("/chat/audio/file")
String chatFromAudioFile(@RequestParam(defaultValue = "Who's the artist who sang this song? Give a short answer") String message) throws IOException {
return chatService.chatFromAudioFile(message);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ class ChatService {

private final Resource image;

private final Resource audio;

ChatService(ChatClient chatClient, @Value("classpath:tabby-cat.png") Resource image, @Value("classpath:speech.mp3") Resource audio) {
ChatService(ChatClient chatClient, @Value("classpath:tabby-cat.png") Resource image) {
this.chatClient = chatClient;
this.image = image;
this.audio = audio;
}

String chatFromImageFile(String message) throws IOException {
Expand All @@ -40,11 +37,4 @@ String chatFromImageUrl(String message) {
return chatClient.call(userMessage);
}

String chatFromAudioFile(String message) throws IOException {
var audioData = audio.getContentAsByteArray();
var userMessage = new UserMessage(message,
List.of(new Media(MimeTypeUtils.parseMimeType("audio/mpeg"), audioData)));
return chatClient.call(userMessage);
}

}

0 comments on commit 5f05d43

Please sign in to comment.