2025年4月3日18:13:53

master
qmstyle 2025-04-03 18:20:24 +08:00
parent 61ca638f92
commit 5c86ff4c32
1 changed files with 3 additions and 8 deletions

View File

@ -141,10 +141,10 @@ public class MainController {
modelSelector.getValue(),
chunk -> {
// 在JavaFX线程中更新UI
// contentBuilder.append(chunk);
contentBuilder.append(chunk);
javafx.application.Platform.runLater(() -> {
assistantMessage.setContent(contentBuilder.toString());
updateMessage(textArea, chunk);
updateMessage(textArea, contentBuilder.toString() );
});
},
() -> {
@ -203,12 +203,7 @@ public class MainController {
}
private void updateMessage(TextArea textArea, String content) {
if (!textArea.getText().isEmpty()){
textArea.appendText(content);
}else {
textArea.setText(content);
}
textArea.setText(content);
}
private void loadChat(Chat chat) {