mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-10 12:10:14 +00:00
fix: chat response rendering
This commit is contained in:
parent
d58c1d8bc0
commit
bacfba16d9
1 changed files with 14 additions and 9 deletions
|
|
@ -118,8 +118,6 @@ public class ChatMessageResponseBody extends JPanel {
|
|||
}
|
||||
|
||||
for (var message : MarkdownUtil.splitCodeBlocks(response)) {
|
||||
currentlyProcessedEditorPanel = null;
|
||||
currentlyProcessedTextPane = null;
|
||||
processResponse(message, message.startsWith("```"), false);
|
||||
}
|
||||
|
||||
|
|
@ -267,23 +265,30 @@ public class ChatMessageResponseBody extends JPanel {
|
|||
}
|
||||
|
||||
private void processText(String markdownText, boolean caretVisible) {
|
||||
var html = convertMdToHtml(markdownText);
|
||||
if (currentlyProcessedTextPane == null) {
|
||||
prepareProcessingText(caretVisible);
|
||||
}
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
if (currentlyProcessedTextPane == null) {
|
||||
prepareProcessingText(caretVisible);
|
||||
}
|
||||
currentlyProcessedTextPane.setText(convertMdToHtml(markdownText));
|
||||
currentlyProcessedTextPane.setText(html);
|
||||
});
|
||||
}
|
||||
|
||||
private void prepareProcessingText(boolean caretVisible) {
|
||||
if (highlightedText != null && !highlightedText.isEmpty()
|
||||
if (highlightedText != null
|
||||
&& !highlightedText.isEmpty()
|
||||
&& currentlyProcessedEditorPanel != null) {
|
||||
currentlyProcessedEditorPanel.showEditorActions();
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
currentlyProcessedEditorPanel.showEditorActions();
|
||||
});
|
||||
}
|
||||
|
||||
currentlyProcessedEditorPanel = null;
|
||||
currentlyProcessedTextPane = createTextPane("", caretVisible);
|
||||
add(currentlyProcessedTextPane);
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
add(currentlyProcessedTextPane);
|
||||
});
|
||||
}
|
||||
|
||||
private void prepareProcessingCode(String code, String markdownLanguage) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue