Files
wevads-platform/public/hamid-fullscreen.php.patch
2026-02-26 04:53:11 +01:00

44 lines
1.2 KiB
Diff
Executable File

// === FONCTIONS GÉNÉRATION DOCUMENTS ===
async function generateDoc(type, title, content) {
try {
const res = await fetch('hamid-generate.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: type,
title: title,
content: content,
session_id: '<?=$_SESSION['hamid_session']?>'
})
});
const data = await res.json();
if (data.success) {
addArt(data.filename, data.type, data.url);
return data;
} else {
console.error('Erreur génération:', data.error);
return null;
}
} catch (e) {
console.error('Erreur:', e);
return null;
}
}
// Détecter demandes de génération dans la réponse
function checkForDocRequest(response) {
const patterns = [
/génère[rz]?\s+(un|le|ce)?\s*(document|pdf|fichier|rapport)/i,
/crée[rz]?\s+(un|le|ce)?\s*(document|pdf|fichier|rapport)/i,
/\[GENERATE:(\w+):([^\]]+)\]/i
];
for (const pattern of patterns) {
if (pattern.test(response)) {
return true;
}
}
return false;
}