mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-02 01:42:53 -05:00
perf: streaming a reply in a long chat no longer rescans every message for artifacts with full regex passes (#35209)
This commit is contained in:
2 files changed
+2
-1
No files matched your search
@@ -3041,7 +3041,7 @@
|
||||
if (message?.role !== 'user') {
|
||||
const messageContent =
|
||||
getOutputText(message?.output) || removeAllDetails(message?.content ?? '');
|
||||
if (!messageContent.trim()) {
|
||||
if (!messageContent.includes('```') && !messageContent.includes('<')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1146,6 +1146,7 @@ export const removeDetails = (content, types) => {
|
||||
};
|
||||
|
||||
export const removeAllDetails = (content) => {
|
||||
if (!/<details/i.test(content)) return content.trim();
|
||||
// Strip details before splitting code fences, which can separate opening and closing tags.
|
||||
content = content.replace(/<details[^>]*>[\s\S]*?<\/details>/gi, '');
|
||||
// Second pass: catch any remaining blocks that live outside code fences
|
||||
|
||||
Reference in new issue
Block a user