From 7a38fd57622eaec72d7938943da8617a4f4c6eca Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 31 Aug 2024 12:25:36 +0200 Subject: [PATCH] this looks good --- .../java/eu/m724/example/ExampleSource.groovy | 2 +- .../java/eu/m724/source/ChatResponse.java | 2 +- .../eu/m724/source/SimpleChatResponse.java | 27 ++----------------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/src/main/java/eu/m724/example/ExampleSource.groovy b/src/main/java/eu/m724/example/ExampleSource.groovy index f974539..6c4d7d5 100644 --- a/src/main/java/eu/m724/example/ExampleSource.groovy +++ b/src/main/java/eu/m724/example/ExampleSource.groovy @@ -58,7 +58,7 @@ class ExampleSource implements ChatSource { return new ChatResponse() { @Override - boolean isStreaming() { + boolean streaming() { return false } diff --git a/src/main/java/eu/m724/source/ChatResponse.java b/src/main/java/eu/m724/source/ChatResponse.java index c2f9fe2..957c034 100644 --- a/src/main/java/eu/m724/source/ChatResponse.java +++ b/src/main/java/eu/m724/source/ChatResponse.java @@ -13,7 +13,7 @@ public interface ChatResponse { * * @return is this response streaming */ - boolean isStreaming(); + boolean streaming(); /** * if streamed, text token by token as it goes (or other splitting depending on the source) diff --git a/src/main/java/eu/m724/source/SimpleChatResponse.java b/src/main/java/eu/m724/source/SimpleChatResponse.java index 0b35514..170d63f 100644 --- a/src/main/java/eu/m724/source/SimpleChatResponse.java +++ b/src/main/java/eu/m724/source/SimpleChatResponse.java @@ -6,29 +6,6 @@ import eu.m724.chat.ChatMessage; import java.util.concurrent.CompletableFuture; import java.util.concurrent.LinkedBlockingQueue; -public class SimpleChatResponse implements ChatResponse { - public final boolean streaming; - public final LinkedBlockingQueue eventQueue; - public final CompletableFuture message; - - public SimpleChatResponse(boolean streaming, LinkedBlockingQueue eventQueue, CompletableFuture message) { - this.streaming = streaming; - this.eventQueue = eventQueue; - this.message = message; - } - - @Override - public boolean isStreaming() { - return streaming; - } - - @Override - public LinkedBlockingQueue eventQueue() { - return eventQueue; - } - - @Override - public CompletableFuture message() { - return message; - } +public record SimpleChatResponse(boolean streaming, LinkedBlockingQueue eventQueue, + CompletableFuture message) implements ChatResponse { }