Merge pull request #18195 from EventHorizon-AI/fix/artifacts-duplicate-match
fix: Artifacts duplicate matching
This commit is contained in:
1 file changed
+6
-6
@@ -39,17 +39,16 @@
|
||||
const codeBlockContents = message.content.match(/```[\s\S]*?```/g);
|
||||
let codeBlocks = [];
|
||||
|
||||
let htmlContent = '';
|
||||
let cssContent = '';
|
||||
let jsContent = '';
|
||||
|
||||
if (codeBlockContents) {
|
||||
codeBlockContents.forEach((block) => {
|
||||
const lang = block.split('\n')[0].replace('```', '').trim().toLowerCase();
|
||||
const code = block.replace(/```[\s\S]*?\n/, '').replace(/```$/, '');
|
||||
codeBlocks.push({ lang, code });
|
||||
});
|
||||
}
|
||||
|
||||
let htmlContent = '';
|
||||
let cssContent = '';
|
||||
let jsContent = '';
|
||||
|
||||
codeBlocks.forEach((block) => {
|
||||
const { lang, code } = block;
|
||||
@@ -62,7 +61,7 @@
|
||||
jsContent += code + '\n';
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
const inlineHtml = message.content.match(/<html>[\s\S]*?<\/html>/gi);
|
||||
const inlineCss = message.content.match(/<style>[\s\S]*?<\/style>/gi);
|
||||
const inlineJs = message.content.match(/<script>[\s\S]*?<\/script>/gi);
|
||||
@@ -85,6 +84,7 @@
|
||||
jsContent += content + '\n';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (htmlContent || cssContent || jsContent) {
|
||||
const renderedContent = `
|
||||
|
||||
Reference in new issue
Block a user