mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-10 12:10:14 +00:00
fix: chat response streaming for messages received faster than polling rate (fixes #757)
This commit is contained in:
parent
2ab6d1a54c
commit
cfd5f6f651
1 changed files with 5 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ abstract class ToolWindowCompletionResponseEventListener implements
|
|||
|
||||
private final Timer updateTimer = new Timer(UPDATE_INTERVAL_MS, e -> processBufferedMessages());
|
||||
private final ConcurrentLinkedQueue<String> messageBuffer = new ConcurrentLinkedQueue<>();
|
||||
private boolean stopped = false;
|
||||
|
||||
public ToolWindowCompletionResponseEventListener(
|
||||
ConversationService conversationService,
|
||||
|
|
@ -134,6 +135,9 @@ abstract class ToolWindowCompletionResponseEventListener implements
|
|||
|
||||
private void processBufferedMessages() {
|
||||
if (messageBuffer.isEmpty()) {
|
||||
if (stopped) {
|
||||
updateTimer.stop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +151,7 @@ abstract class ToolWindowCompletionResponseEventListener implements
|
|||
}
|
||||
|
||||
private void stopStreaming(ChatMessageResponseBody responseContainer) {
|
||||
updateTimer.stop();
|
||||
stopped = true;
|
||||
textArea.setSubmitEnabled(true);
|
||||
responseContainer.hideCaret();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue