fix: only highlight code blocks within current message
This commit is contained in:
parent
9597db7fd8
commit
ff316c7e91
@ -454,7 +454,9 @@ const indexHTML = `<!DOCTYPE html>
|
||||
const content = currentAssistantDiv.querySelector('.message-content');
|
||||
content.innerHTML = renderMarkdown(currentContent);
|
||||
if (typeof hljs !== 'undefined') {
|
||||
hljs.highlightAll();
|
||||
content.querySelectorAll('pre code').forEach(function(block) {
|
||||
hljs.highlightElement(block);
|
||||
});
|
||||
}
|
||||
chatBox.scrollTop = chatBox.scrollHeight;
|
||||
}
|
||||
@ -499,7 +501,9 @@ const indexHTML = `<!DOCTYPE html>
|
||||
chatBox.scrollTop = chatBox.scrollHeight;
|
||||
|
||||
if (role !== 'user' && typeof hljs !== 'undefined') {
|
||||
hljs.highlightAll();
|
||||
text.querySelectorAll('pre code').forEach(function(block) {
|
||||
hljs.highlightElement(block);
|
||||
});
|
||||
}
|
||||
|
||||
return div;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user