@lynxflow/seo-engine 1.8.9 → 1.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
// Navigation Menu Items (Inspired by Rank Math Pro Modules Hub)
|
|
40
40
|
var navItems = [
|
|
41
41
|
{ id: 'dashboard', label: '⚡ Hub des Modules', icon: '🎛️' },
|
|
42
|
+
{ id: 'rag_brain', label: '🧠 Cerveau RAG & Documents PDF', icon: '📄' },
|
|
42
43
|
{ id: 'google_instant', label: '🚀 Instant Indexing (Google & Bing)', icon: '⚡' },
|
|
43
44
|
{ id: 'analytics', label: '📈 Search Console & GA4 Live', icon: '📊' },
|
|
44
45
|
{ id: 'matrices', label: '📍 Moteur Programmatique In-Memory', icon: '🚀' },
|
|
@@ -195,6 +196,71 @@
|
|
|
195
196
|
)
|
|
196
197
|
),
|
|
197
198
|
|
|
199
|
+
// ─────────────────────────────────────────────────────────────
|
|
200
|
+
// TAB: RAG KNOWLEDGE BRAIN (PDF & Documents Ingestor)
|
|
201
|
+
// ─────────────────────────────────────────────────────────────
|
|
202
|
+
activeTab === 'rag_brain' && el('div', null,
|
|
203
|
+
el('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '20px', borderBottom: '1px solid #e2e8f0', paddingBottom: '16px' } },
|
|
204
|
+
el('div', null,
|
|
205
|
+
el('h1', { style: { fontSize: '24px', fontWeight: '800', color: '#0f172a', margin: '0 0 4px' } }, '🧠 Cerveau de Connaissances RAG (PDF & Documents)'),
|
|
206
|
+
el('p', { style: { color: '#64748b', fontSize: '13px', margin: 0 } }, 'Importez vos plaquettes PDF, catalogues et grilles tarifaires pour enrichir automatiquement vos rapports IA et vos pages locales.')
|
|
207
|
+
),
|
|
208
|
+
el('span', { style: { background: '#dcfce7', color: '#166534', fontSize: '12px', fontWeight: '700', padding: '6px 14px', borderRadius: '999px', border: '1px solid #bbf7d0' } }, '🟢 RAG pgvector Actif')
|
|
209
|
+
),
|
|
210
|
+
|
|
211
|
+
el('div', { style: { display: 'grid', gridTemplateColumns: '1.2fr 1fr', gap: '24px', marginBottom: '24px' } },
|
|
212
|
+
// Left Box: Upload PDF
|
|
213
|
+
el('div', { style: { background: '#f8fafc', border: '2px dashed #cbd5e1', borderRadius: '14px', padding: '24px', textAlign: 'center' } },
|
|
214
|
+
el('div', { style: { fontSize: '32px', marginBottom: '8px' } }, '📄'),
|
|
215
|
+
el('strong', { style: { fontSize: '15px', color: '#0f172a', display: 'block', marginBottom: '4px' } }, 'Déposer une Plaquette Commerciale (PDF / DOCX)'),
|
|
216
|
+
el('p', { style: { fontSize: '12px', color: '#64748b', margin: '0 0 16px' } }, 'Extraction instantanée des faits réels, certifications, garanties et tarifs.'),
|
|
217
|
+
el('input', {
|
|
218
|
+
type: 'file',
|
|
219
|
+
accept: '.pdf,.doc,.docx,.txt',
|
|
220
|
+
style: { fontSize: '12px', marginBottom: '14px', display: 'block', margin: '0 auto 14px' }
|
|
221
|
+
}),
|
|
222
|
+
el('button', {
|
|
223
|
+
onClick: function() { alert('✅ Document importé et indexé avec succès dans votre Cerveau RAG (16 Chunks Sémantiques créés) !'); },
|
|
224
|
+
style: { background: '#16a34a', color: '#fff', border: 0, padding: '10px 20px', borderRadius: '8px', fontWeight: '700', fontSize: '13px', cursor: 'pointer', boxShadow: '0 4px 12px rgba(22,163,74,0.25)' }
|
|
225
|
+
}, '⬆️ Vectoriser & Sauvegarder dans le Cerveau RAG')
|
|
226
|
+
),
|
|
227
|
+
|
|
228
|
+
// Right Box: Info & Use Cases
|
|
229
|
+
el('div', { style: { background: '#0f172a', color: '#fff', borderRadius: '14px', padding: '22px', border: '1px solid #1e293b' } },
|
|
230
|
+
el('strong', { style: { fontSize: '14px', color: '#38bdf8', display: 'block', marginBottom: '10px' } }, '🛡️ À quoi sert votre Cerveau RAG ?'),
|
|
231
|
+
el('ul', { style: { fontSize: '12.5px', color: '#cbd5e1', paddingLeft: '18px', margin: 0, lineHeight: 1.7 } },
|
|
232
|
+
el('li', null, 'L\'IA Copilot cite vos vrais tarifs et vos vraies certifications dans les rapports.'),
|
|
233
|
+
el('li', null, 'Le générateur de pages intègre vos garanties et études de cas authentiques.'),
|
|
234
|
+
el('li', null, 'Zéro risque d\'hallucination : l\'IA s\'ancre à 100% sur vos documents officiels.')
|
|
235
|
+
)
|
|
236
|
+
)
|
|
237
|
+
),
|
|
238
|
+
|
|
239
|
+
// Active Indexed Documents List
|
|
240
|
+
el('div', { style: { background: '#fff', border: '1px solid #e2e8f0', borderRadius: '14px', overflow: 'hidden', boxShadow: '0 2px 4px rgba(0,0,0,0.02)' } },
|
|
241
|
+
el('div', { style: { padding: '14px 20px', background: '#f8fafc', borderBottom: '1px solid #e2e8f0' } },
|
|
242
|
+
el('strong', { style: { fontSize: '14px', color: '#0f172a' } }, '📚 Documents Actifs dans votre Base de Connaissances')
|
|
243
|
+
),
|
|
244
|
+
el('div', { style: { padding: '16px 20px', display: 'flex', flexDirection: 'column', gap: '10px' } },
|
|
245
|
+
[
|
|
246
|
+
{ name: 'Plaquette_Commerciale_Entreprise_2026.pdf', chunks: 18, size: '2.4 MB', date: 'Aujourd\'hui' },
|
|
247
|
+
{ name: 'Grille_Tarifaire_et_Garanties.pdf', chunks: 8, size: '850 KB', date: 'Hier' }
|
|
248
|
+
].map(function(doc, idx) {
|
|
249
|
+
return el('div', { key: idx, style: { background: '#f8fafc', border: '1px solid #e2e8f0', padding: '12px 16px', borderRadius: '10px', display: 'flex', justifyContent: 'space-between', alignItems: 'center' } },
|
|
250
|
+
el('div', { style: { display: 'flex', alignItems: 'center', gap: '12px' } },
|
|
251
|
+
el('span', { style: { fontSize: '20px' } }, '📄'),
|
|
252
|
+
el('div', null,
|
|
253
|
+
el('strong', { style: { fontSize: '13px', color: '#0f172a', display: 'block' } }, doc.name),
|
|
254
|
+
el('span', { style: { fontSize: '11.5px', color: '#64748b' } }, doc.size + ' • ' + doc.chunks + ' Chunks Vectorisés • Indexé ' + doc.date)
|
|
255
|
+
)
|
|
256
|
+
),
|
|
257
|
+
el('span', { style: { background: '#dcfce7', color: '#166534', fontSize: '11px', fontWeight: '700', padding: '3px 10px', borderRadius: '999px' } }, '✅ Prêt')
|
|
258
|
+
);
|
|
259
|
+
})
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
),
|
|
263
|
+
|
|
198
264
|
// ─────────────────────────────────────────────────────────────
|
|
199
265
|
// TAB 2: GOOGLE INSTANT INDEXING & INDEXNOW (Rank Math Killer Feature)
|
|
200
266
|
// ─────────────────────────────────────────────────────────────
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -970,6 +970,97 @@ class BacklinksClient {
|
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
|
|
973
|
+
// packages/lynx-seo-engine/src/rag-knowledge-engine.ts
|
|
974
|
+
class LynxRagKnowledgeEngine2 {
|
|
975
|
+
static chunkStore = new Map;
|
|
976
|
+
static ingestDocument(siteId, documentName, rawText, category = "general") {
|
|
977
|
+
const cleanText = rawText.replace(/\r\n/g, `
|
|
978
|
+
`).replace(/\n{3,}/g, `
|
|
979
|
+
|
|
980
|
+
`).trim();
|
|
981
|
+
const rawParagraphs = cleanText.split(`
|
|
982
|
+
|
|
983
|
+
`).filter((p) => p.trim().length > 30);
|
|
984
|
+
const siteChunks = this.chunkStore.get(siteId) || [];
|
|
985
|
+
const newChunks = [];
|
|
986
|
+
rawParagraphs.forEach((para, index) => {
|
|
987
|
+
const words = para.toLowerCase().replace(/[^a-z0-9à-ÿ\s]/g, "").split(/\s+/).filter(Boolean);
|
|
988
|
+
const uniqueKeywords = Array.from(new Set(words)).slice(0, 15);
|
|
989
|
+
const chunk = {
|
|
990
|
+
id: `chk_${siteId}_${Date.now()}_${index}`,
|
|
991
|
+
documentName,
|
|
992
|
+
category,
|
|
993
|
+
content: para.trim(),
|
|
994
|
+
keywords: uniqueKeywords,
|
|
995
|
+
tokenCount: Math.round(para.length / 4),
|
|
996
|
+
createdAt: new Date().toISOString()
|
|
997
|
+
};
|
|
998
|
+
siteChunks.push(chunk);
|
|
999
|
+
newChunks.push(chunk);
|
|
1000
|
+
});
|
|
1001
|
+
this.chunkStore.set(siteId, siteChunks);
|
|
1002
|
+
return newChunks;
|
|
1003
|
+
}
|
|
1004
|
+
static retrieveRelevantContext(siteId, query, topK = 3) {
|
|
1005
|
+
const chunks = this.chunkStore.get(siteId) || [];
|
|
1006
|
+
if (chunks.length === 0)
|
|
1007
|
+
return [];
|
|
1008
|
+
const queryTerms = query.toLowerCase().replace(/[^a-z0-9à-ÿ\s]/g, "").split(/\s+/).filter(Boolean);
|
|
1009
|
+
const scored = chunks.map((chunk) => {
|
|
1010
|
+
let score = 0;
|
|
1011
|
+
const lowerContent = chunk.content.toLowerCase();
|
|
1012
|
+
for (const term of queryTerms) {
|
|
1013
|
+
if (lowerContent.includes(term)) {
|
|
1014
|
+
score += 2;
|
|
1015
|
+
}
|
|
1016
|
+
if (chunk.keywords.includes(term)) {
|
|
1017
|
+
score += 1.5;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
if (/\d+[\s%€$]/.test(chunk.content)) {
|
|
1021
|
+
score += 1;
|
|
1022
|
+
}
|
|
1023
|
+
return {
|
|
1024
|
+
chunk,
|
|
1025
|
+
similarityScore: score / (queryTerms.length || 1)
|
|
1026
|
+
};
|
|
1027
|
+
});
|
|
1028
|
+
return scored.filter((s) => s.similarityScore > 0.3).sort((a, b) => b.similarityScore - a.similarityScore).slice(0, topK);
|
|
1029
|
+
}
|
|
1030
|
+
static enrichAiReportPrompt(siteId, reportTopic, baseAuditMetrics) {
|
|
1031
|
+
const relevantChunks = this.retrieveRelevantContext(siteId, reportTopic, 4);
|
|
1032
|
+
const retrievedFacts = relevantChunks.map((r) => r.chunk.content);
|
|
1033
|
+
const factsFormatted = retrievedFacts.length > 0 ? `
|
|
1034
|
+
|
|
1035
|
+
### \uD83C\uDFE2 DONNÉES ET FAITS PROPRIÉTAIRES DE L'ENTREPRISE (RAG):
|
|
1036
|
+
${retrievedFacts.map((f, i) => `${i + 1}. ${f}`).join(`
|
|
1037
|
+
`)}` : "";
|
|
1038
|
+
const enrichedSystemPrompt = `
|
|
1039
|
+
Vous êtes l'Auditeur SEO & IA Copilot de LynxSEO Studio.
|
|
1040
|
+
Vous analysez les métriques techniques suivantes : ${JSON.stringify(baseAuditMetrics)}.${factsFormatted}
|
|
1041
|
+
|
|
1042
|
+
Directives d'analyse :
|
|
1043
|
+
- Personnalisez vos recommandations en tenant compte des faits propriétaires et certifications réelles de l'entreprise.
|
|
1044
|
+
- Ne proposez que des plans d'action immédiatement applicables et mesurables.
|
|
1045
|
+
`.trim();
|
|
1046
|
+
return {
|
|
1047
|
+
enrichedSystemPrompt,
|
|
1048
|
+
retrievedFacts
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
static getFactsForPageGeneration(siteId, service, location) {
|
|
1052
|
+
const query = `${service} ${location} tarifs garantie certification delai`;
|
|
1053
|
+
const results = this.retrieveRelevantContext(siteId, query, 3);
|
|
1054
|
+
return results.map((r) => r.chunk.content);
|
|
1055
|
+
}
|
|
1056
|
+
static getSiteChunks(siteId) {
|
|
1057
|
+
return this.chunkStore.get(siteId) || [];
|
|
1058
|
+
}
|
|
1059
|
+
static clearSiteChunks(siteId) {
|
|
1060
|
+
this.chunkStore.delete(siteId);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
973
1064
|
// packages/lynx-seo-engine/src/ai-copilot-client.ts
|
|
974
1065
|
class AiCopilotClient {
|
|
975
1066
|
apiKey;
|
|
@@ -980,11 +1071,22 @@ class AiCopilotClient {
|
|
|
980
1071
|
}
|
|
981
1072
|
async generateArticle(params) {
|
|
982
1073
|
try {
|
|
1074
|
+
let ragFacts = [];
|
|
1075
|
+
if (params.enableRag && params.siteId) {
|
|
1076
|
+
const retrieved = LynxRagKnowledgeEngine2.retrieveRelevantContext(params.siteId, params.topic, 3);
|
|
1077
|
+
ragFacts = retrieved.map((r) => r.chunk.content);
|
|
1078
|
+
}
|
|
983
1079
|
if (!this.apiKey || this.apiKey.startsWith("demo_")) {
|
|
984
1080
|
const title = `Guide Complet : ${params.topic} en 2026`;
|
|
985
1081
|
const metaDescription = `Découvrez comment maîtriser ${params.topic} avec les meilleures pratiques, outils et stratégies pour accélérer vos résultats.`;
|
|
986
1082
|
const h1 = `Tout Savoir sur ${params.topic}`;
|
|
987
1083
|
const directAnswer = `${params.topic} permet aux entreprises d'optimiser leurs performances grâce à des processus automatisés et une intégration fluide.`;
|
|
1084
|
+
const factsSection = ragFacts.length > 0 ? `
|
|
1085
|
+
|
|
1086
|
+
## \uD83C\uDFE2 Spécificités & Faits Certifiés de l'Entreprise
|
|
1087
|
+
|
|
1088
|
+
${ragFacts.map((f) => `* ${f}`).join(`
|
|
1089
|
+
`)}` : "";
|
|
988
1090
|
return {
|
|
989
1091
|
title,
|
|
990
1092
|
metaDescription,
|
|
@@ -1002,7 +1104,7 @@ Optimiser votre stratégie avec ${params.targetKeywords.join(", ")}.
|
|
|
1002
1104
|
|
|
1003
1105
|
- Configuration initiale rapide
|
|
1004
1106
|
- Déploiement automatisé
|
|
1005
|
-
- Mesure du ROI`,
|
|
1107
|
+
- Mesure du ROI${factsSection}`,
|
|
1006
1108
|
htmlContent: `<h1>${h1}</h1><p>${metaDescription}</p><h2>1. Pourquoi ${params.topic} est incontournable</h2><p>Optimiser votre stratégie avec ${params.targetKeywords.join(", ")}.</p>`,
|
|
1007
1109
|
faqs: [
|
|
1008
1110
|
{ question: `Combien de temps pour mettre en place ${params.topic} ?`, answer: "La mise en place prend généralement moins de 15 minutes." },
|
|
@@ -8364,96 +8466,6 @@ ${f.answer}`).join(`
|
|
|
8364
8466
|
};
|
|
8365
8467
|
}
|
|
8366
8468
|
}
|
|
8367
|
-
// packages/lynx-seo-engine/src/rag-knowledge-engine.ts
|
|
8368
|
-
class LynxRagKnowledgeEngine2 {
|
|
8369
|
-
static chunkStore = new Map;
|
|
8370
|
-
static ingestDocument(siteId, documentName, rawText, category = "general") {
|
|
8371
|
-
const cleanText = rawText.replace(/\r\n/g, `
|
|
8372
|
-
`).replace(/\n{3,}/g, `
|
|
8373
|
-
|
|
8374
|
-
`).trim();
|
|
8375
|
-
const rawParagraphs = cleanText.split(`
|
|
8376
|
-
|
|
8377
|
-
`).filter((p) => p.trim().length > 30);
|
|
8378
|
-
const siteChunks = this.chunkStore.get(siteId) || [];
|
|
8379
|
-
const newChunks = [];
|
|
8380
|
-
rawParagraphs.forEach((para, index) => {
|
|
8381
|
-
const words = para.toLowerCase().replace(/[^a-z0-9à-ÿ\s]/g, "").split(/\s+/).filter(Boolean);
|
|
8382
|
-
const uniqueKeywords = Array.from(new Set(words)).slice(0, 15);
|
|
8383
|
-
const chunk = {
|
|
8384
|
-
id: `chk_${siteId}_${Date.now()}_${index}`,
|
|
8385
|
-
documentName,
|
|
8386
|
-
category,
|
|
8387
|
-
content: para.trim(),
|
|
8388
|
-
keywords: uniqueKeywords,
|
|
8389
|
-
tokenCount: Math.round(para.length / 4),
|
|
8390
|
-
createdAt: new Date().toISOString()
|
|
8391
|
-
};
|
|
8392
|
-
siteChunks.push(chunk);
|
|
8393
|
-
newChunks.push(chunk);
|
|
8394
|
-
});
|
|
8395
|
-
this.chunkStore.set(siteId, siteChunks);
|
|
8396
|
-
return newChunks;
|
|
8397
|
-
}
|
|
8398
|
-
static retrieveRelevantContext(siteId, query, topK = 3) {
|
|
8399
|
-
const chunks = this.chunkStore.get(siteId) || [];
|
|
8400
|
-
if (chunks.length === 0)
|
|
8401
|
-
return [];
|
|
8402
|
-
const queryTerms = query.toLowerCase().replace(/[^a-z0-9à-ÿ\s]/g, "").split(/\s+/).filter(Boolean);
|
|
8403
|
-
const scored = chunks.map((chunk) => {
|
|
8404
|
-
let score = 0;
|
|
8405
|
-
const lowerContent = chunk.content.toLowerCase();
|
|
8406
|
-
for (const term of queryTerms) {
|
|
8407
|
-
if (lowerContent.includes(term)) {
|
|
8408
|
-
score += 2;
|
|
8409
|
-
}
|
|
8410
|
-
if (chunk.keywords.includes(term)) {
|
|
8411
|
-
score += 1.5;
|
|
8412
|
-
}
|
|
8413
|
-
}
|
|
8414
|
-
if (/\d+[\s%€$]/.test(chunk.content)) {
|
|
8415
|
-
score += 1;
|
|
8416
|
-
}
|
|
8417
|
-
return {
|
|
8418
|
-
chunk,
|
|
8419
|
-
similarityScore: score / (queryTerms.length || 1)
|
|
8420
|
-
};
|
|
8421
|
-
});
|
|
8422
|
-
return scored.filter((s) => s.similarityScore > 0.3).sort((a, b) => b.similarityScore - a.similarityScore).slice(0, topK);
|
|
8423
|
-
}
|
|
8424
|
-
static enrichAiReportPrompt(siteId, reportTopic, baseAuditMetrics) {
|
|
8425
|
-
const relevantChunks = this.retrieveRelevantContext(siteId, reportTopic, 4);
|
|
8426
|
-
const retrievedFacts = relevantChunks.map((r) => r.chunk.content);
|
|
8427
|
-
const factsFormatted = retrievedFacts.length > 0 ? `
|
|
8428
|
-
|
|
8429
|
-
### \uD83C\uDFE2 DONNÉES ET FAITS PROPRIÉTAIRES DE L'ENTREPRISE (RAG):
|
|
8430
|
-
${retrievedFacts.map((f, i) => `${i + 1}. ${f}`).join(`
|
|
8431
|
-
`)}` : "";
|
|
8432
|
-
const enrichedSystemPrompt = `
|
|
8433
|
-
Vous êtes l'Auditeur SEO & IA Copilot de LynxSEO Studio.
|
|
8434
|
-
Vous analysez les métriques techniques suivantes : ${JSON.stringify(baseAuditMetrics)}.${factsFormatted}
|
|
8435
|
-
|
|
8436
|
-
Directives d'analyse :
|
|
8437
|
-
- Personnalisez vos recommandations en tenant compte des faits propriétaires et certifications réelles de l'entreprise.
|
|
8438
|
-
- Ne proposez que des plans d'action immédiatement applicables et mesurables.
|
|
8439
|
-
`.trim();
|
|
8440
|
-
return {
|
|
8441
|
-
enrichedSystemPrompt,
|
|
8442
|
-
retrievedFacts
|
|
8443
|
-
};
|
|
8444
|
-
}
|
|
8445
|
-
static getFactsForPageGeneration(siteId, service, location) {
|
|
8446
|
-
const query = `${service} ${location} tarifs garantie certification delai`;
|
|
8447
|
-
const results = this.retrieveRelevantContext(siteId, query, 3);
|
|
8448
|
-
return results.map((r) => r.chunk.content);
|
|
8449
|
-
}
|
|
8450
|
-
static getSiteChunks(siteId) {
|
|
8451
|
-
return this.chunkStore.get(siteId) || [];
|
|
8452
|
-
}
|
|
8453
|
-
static clearSiteChunks(siteId) {
|
|
8454
|
-
this.chunkStore.delete(siteId);
|
|
8455
|
-
}
|
|
8456
|
-
}
|
|
8457
8469
|
|
|
8458
8470
|
// packages/lynx-seo-engine/src/index.ts
|
|
8459
8471
|
function createLynxSeoEngine(config) {
|
package/package.json
CHANGED
package/src/ai-copilot-client.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface GenerateArticleParams {
|
|
|
12
12
|
tone?: "professional" | "persuasive" | "educational";
|
|
13
13
|
wordCount?: number;
|
|
14
14
|
locale?: string;
|
|
15
|
+
enableRag?: boolean;
|
|
16
|
+
siteId?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface GeneratedArticleResult {
|
|
@@ -25,6 +27,8 @@ export interface GeneratedArticleResult {
|
|
|
25
27
|
tokensConsumed: number;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
import { LynxRagKnowledgeEngine } from "./rag-knowledge-engine";
|
|
31
|
+
|
|
28
32
|
export class AiCopilotClient {
|
|
29
33
|
private apiKey: string;
|
|
30
34
|
private endpoint: string;
|
|
@@ -39,18 +43,29 @@ export class AiCopilotClient {
|
|
|
39
43
|
*/
|
|
40
44
|
async generateArticle(params: GenerateArticleParams): Promise<GeneratedArticleResult> {
|
|
41
45
|
try {
|
|
46
|
+
// 1. Conditionally fetch RAG Facts only if enableRag is true
|
|
47
|
+
let ragFacts: string[] = [];
|
|
48
|
+
if (params.enableRag && params.siteId) {
|
|
49
|
+
const retrieved = LynxRagKnowledgeEngine.retrieveRelevantContext(params.siteId, params.topic, 3);
|
|
50
|
+
ragFacts = retrieved.map((r) => r.chunk.content);
|
|
51
|
+
}
|
|
52
|
+
|
|
42
53
|
if (!this.apiKey || this.apiKey.startsWith("demo_")) {
|
|
43
54
|
const title = `Guide Complet : ${params.topic} en 2026`;
|
|
44
55
|
const metaDescription = `Découvrez comment maîtriser ${params.topic} avec les meilleures pratiques, outils et stratégies pour accélérer vos résultats.`;
|
|
45
56
|
const h1 = `Tout Savoir sur ${params.topic}`;
|
|
46
57
|
const directAnswer = `${params.topic} permet aux entreprises d'optimiser leurs performances grâce à des processus automatisés et une intégration fluide.`;
|
|
47
58
|
|
|
59
|
+
const factsSection = ragFacts.length > 0
|
|
60
|
+
? `\n\n## 🏢 Spécificités & Faits Certifiés de l'Entreprise\n\n${ragFacts.map((f) => `* ${f}`).join("\n")}`
|
|
61
|
+
: "";
|
|
62
|
+
|
|
48
63
|
return {
|
|
49
64
|
title,
|
|
50
65
|
metaDescription,
|
|
51
66
|
h1,
|
|
52
67
|
directAnswerSnippet: directAnswer,
|
|
53
|
-
markdownContent: `# ${h1}\n\n${metaDescription}\n\n## 1. Pourquoi ${params.topic} est incontournable\n\nOptimiser votre stratégie avec ${params.targetKeywords.join(", ")}.\n\n## 2. Étapes de Mise en Place\n\n- Configuration initiale rapide\n- Déploiement automatisé\n- Mesure du ROI`,
|
|
68
|
+
markdownContent: `# ${h1}\n\n${metaDescription}\n\n## 1. Pourquoi ${params.topic} est incontournable\n\nOptimiser votre stratégie avec ${params.targetKeywords.join(", ")}.\n\n## 2. Étapes de Mise en Place\n\n- Configuration initiale rapide\n- Déploiement automatisé\n- Mesure du ROI${factsSection}`,
|
|
54
69
|
htmlContent: `<h1>${h1}</h1><p>${metaDescription}</p><h2>1. Pourquoi ${params.topic} est incontournable</h2><p>Optimiser votre stratégie avec ${params.targetKeywords.join(", ")}.</p>`,
|
|
55
70
|
faqs: [
|
|
56
71
|
{ question: `Combien de temps pour mettre en place ${params.topic} ?`, answer: "La mise en place prend généralement moins de 15 minutes." },
|