forked from Shinonome/dots-hyprland
ai: actually make chat messages update incrementally
(instead of destroying and recreating every update) MUCH better performance and no more hundreds of latex files for one integration by parts work
This commit is contained in:
@@ -49,7 +49,7 @@ const replaceCategory = (text, replaces) => {
|
||||
// Main function
|
||||
|
||||
export function replaceInlineLatexWithCodeBlocks(text) {
|
||||
return text.replace(/\\\[(.*?)\\\]|\\\((.*?)\\\)|\$\$(.*?)\$\$|(?<!\w)\$(.*?[^\\])\$(?!\w)/gs, (match, square, round, double, single) => {
|
||||
return text.replace(/\\\[(.*?)\\\]|\\\((.*?)\\\)|\$\$(.*?)\$\$|(?:^|[^\w])\$(.*?[^\\])\$(?!\w)/gs, (match, square, round, double, single) => {
|
||||
const latex = square || round || double || single;
|
||||
return `\n\`\`\`latex\n${latex}\n\`\`\`\n`;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user