Skip to content

Commit d678bf3

Browse files
Fixed the issue that when an error occurs, the submit icon remains the spinning circle instead of go back to the triangle
1 parent 483faa4 commit d678bf3

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/main/java/io/github/jeddict/ai/lang/JeddictStreamHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,17 @@ public void onError(Throwable throwable) {
8484
LOGGER.log(Level.SEVERE, "Exception in JeddictStreamHandler", throwable);
8585
// Update UI on the Event Dispatch Thread
8686
SwingUtilities.invokeLater(() -> {
87+
final String error = "[Error] An error occurred: " + throwable.getMessage();
8788
if (textArea != null) {
88-
textArea.append("\n\n[Error] An error occurred: " + throwable.getMessage());
89+
textArea.append("\n\n" + error);
8990
} else {
9091
// If textArea not yet initialized, clear and create one to show error
9192
topComponent.clear();
9293
JTextArea errorArea = topComponent.createTextAreaPane();
93-
errorArea.setText("[Error] An error occurred: " + throwable.getMessage());
94+
errorArea.setText(error);
9495
textArea = errorArea;
95-
}
96+
}
97+
onComplete(error);
9698
if (handle != null) {
9799
handle.finish();
98100
}
@@ -113,6 +115,6 @@ public void onComplete(Response<AiMessage> out) {
113115
}
114116

115117
public abstract void onComplete(String response);
116-
117-
118+
119+
118120
}

0 commit comments

Comments
 (0)