feat: upgrade AI prompts to v2 specification with grounding and injection shield

This commit is contained in:
mstfyldz
2026-08-14 00:52:41 +03:00
parent f1457b02ca
commit fab80e05a0
8 changed files with 257 additions and 45 deletions
+19
View File
@@ -0,0 +1,19 @@
const AdmZip = require("adm-zip");
function parseUDF(buffer) {
try {
const zip = new AdmZip(buffer);
const zipEntries = zip.getEntries();
const contentEntry = zipEntries.find((entry) => entry.entryName === "content.xml" || entry.entryName.endsWith(".xml"));
if (!contentEntry) {
throw new Error("No XML content found inside UDF/ZIP");
}
const xmlData = zip.readAsText(contentEntry);
// Remove XML tags and replace with space, then replace multiple spaces with single space
const plainText = xmlData.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
return plainText;
} catch (err) {
console.error("UDF parse error:", err);
return "";
}
}
console.log("ok");