mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-10 15:16:18 -05:00
refac
This commit is contained in:
@@ -889,13 +889,19 @@ export const removeDetails = (content, types) => {
|
||||
);
|
||||
}
|
||||
return segment;
|
||||
});
|
||||
}).trim();
|
||||
};
|
||||
|
||||
export const removeAllDetails = (content) => {
|
||||
// First pass: strip <details> blocks on the full string before code-fence
|
||||
// splitting, so blocks whose body contains triple backticks are caught.
|
||||
// (replaceOutsideCode splits on ``` fences, which breaks the <details>
|
||||
// regex when the opening and closing tags land in different segments.)
|
||||
content = content.replace(/<details[^>]*>[\s\S]*?<\/details>/gi, '');
|
||||
// Second pass: catch any remaining blocks that live outside code fences
|
||||
return replaceOutsideCode(content, (segment) => {
|
||||
return segment.replace(/<details[^>]*>.*?<\/details>/gis, '');
|
||||
});
|
||||
}).trim();
|
||||
};
|
||||
|
||||
export const processDetails = (content) => {
|
||||
|
||||
Reference in New Issue
Block a user