this looks good
This commit is contained in:
parent
307e2f7c1a
commit
7a38fd5762
3 changed files with 4 additions and 27 deletions
|
@ -58,7 +58,7 @@ class ExampleSource implements ChatSource {
|
||||||
|
|
||||||
return new ChatResponse() {
|
return new ChatResponse() {
|
||||||
@Override
|
@Override
|
||||||
boolean isStreaming() {
|
boolean streaming() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ public interface ChatResponse {
|
||||||
*
|
*
|
||||||
* @return is this response streaming
|
* @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)
|
* if streamed, text token by token as it goes (or other splitting depending on the source)
|
||||||
|
|
|
@ -6,29 +6,6 @@ import eu.m724.chat.ChatMessage;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.LinkedBlockingQueue;
|
||||||
|
|
||||||
public class SimpleChatResponse implements ChatResponse {
|
public record SimpleChatResponse(boolean streaming, LinkedBlockingQueue<ChatEvent> eventQueue,
|
||||||
public final boolean streaming;
|
CompletableFuture<ChatMessage> message) implements ChatResponse {
|
||||||
public final LinkedBlockingQueue<ChatEvent> eventQueue;
|
|
||||||
public final CompletableFuture<ChatMessage> message;
|
|
||||||
|
|
||||||
public SimpleChatResponse(boolean streaming, LinkedBlockingQueue<ChatEvent> eventQueue, CompletableFuture<ChatMessage> message) {
|
|
||||||
this.streaming = streaming;
|
|
||||||
this.eventQueue = eventQueue;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isStreaming() {
|
|
||||||
return streaming;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LinkedBlockingQueue<ChatEvent> eventQueue() {
|
|
||||||
return eventQueue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompletableFuture<ChatMessage> message() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue