2025年4月3日18:13:53
parent
61ca638f92
commit
5c86ff4c32
|
|
@ -141,10 +141,10 @@ public class MainController {
|
||||||
modelSelector.getValue(),
|
modelSelector.getValue(),
|
||||||
chunk -> {
|
chunk -> {
|
||||||
// 在JavaFX线程中更新UI
|
// 在JavaFX线程中更新UI
|
||||||
// contentBuilder.append(chunk);
|
contentBuilder.append(chunk);
|
||||||
javafx.application.Platform.runLater(() -> {
|
javafx.application.Platform.runLater(() -> {
|
||||||
assistantMessage.setContent(contentBuilder.toString());
|
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) {
|
private void updateMessage(TextArea textArea, String content) {
|
||||||
if (!textArea.getText().isEmpty()){
|
textArea.setText(content);
|
||||||
textArea.appendText(content);
|
|
||||||
}else {
|
|
||||||
textArea.setText(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadChat(Chat chat) {
|
private void loadChat(Chat chat) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue