setup base for api system

This commit is contained in:
StillHammer 2025-09-15 14:14:32 +08:00
parent 9dbb6be5dc
commit 326a6a5284
54 changed files with 551 additions and 359 deletions

View File

@ -253,6 +253,11 @@ class ManualServer {
await this.handleGetPersonalities(req, res);
});
// 🆕 API simple pour générer un article avec mot-clé
this.app.post('/api/generate-simple', async (req, res) => {
await this.handleGenerateSimple(req, res);
});
// Gestion d'erreurs API
this.app.use('/api/*', (error, req, res, next) => {
logSh(`❌ Erreur API ${req.path}: ${error.message}`, 'ERROR');
@ -888,6 +893,104 @@ class ManualServer {
}
}
/**
* 🆕 Handler pour génération simple d'article avec mot-clé
*/
async handleGenerateSimple(req, res) {
try {
const { keyword } = req.body;
// Validation basique
if (!keyword || typeof keyword !== 'string' || keyword.trim().length === 0) {
return res.status(400).json({
success: false,
error: 'Mot-clé requis',
message: 'Le paramètre "keyword" est obligatoire et doit être une chaîne non vide'
});
}
const cleanKeyword = keyword.trim();
logSh(`🎯 Génération simple pour mot-clé: "${cleanKeyword}"`, 'INFO');
// Créer un template XML simple basé sur le mot-clé
const simpleTemplate = `<?xml version="1.0" encoding="UTF-8"?>
<article>
<h1>|Titre_Principal{{${cleanKeyword}}}{Rédige un titre H1 accrocheur pour "${cleanKeyword}"}|</h1>
<intro>|Introduction{{${cleanKeyword}}}{Rédige une introduction engageante de 2-3 phrases pour "${cleanKeyword}"}|</intro>
<section1>
<h2>|Sous_Titre_1{{${cleanKeyword}}}{Rédige un sous-titre H2 pour "${cleanKeyword}"}|</h2>
<content>|Contenu_1{{${cleanKeyword}}}{Rédige un paragraphe détaillé sur "${cleanKeyword}"}|</content>
</section1>
<section2>
<h2>|Sous_Titre_2{{${cleanKeyword}}}{Rédige un autre sous-titre H2 pour "${cleanKeyword}"}|</h2>
<content>|Contenu_2{{${cleanKeyword}}}{Rédige un autre paragraphe sur "${cleanKeyword}"}|</content>
</section2>
<conclusion>|Conclusion{{${cleanKeyword}}}{Rédige une conclusion pour l'article sur "${cleanKeyword}"}|</conclusion>
</article>`;
// Préparer les données pour le workflow
const workflowData = {
csvData: {
mc0: cleanKeyword,
t0: `Guide complet sur ${cleanKeyword}`,
personality: { nom: 'Marc', style: 'professionnel' },
tMinus1: cleanKeyword,
mcPlus1: `${cleanKeyword},guide ${cleanKeyword},tout savoir ${cleanKeyword}`,
tPlus1: `Guide ${cleanKeyword},Conseils ${cleanKeyword},${cleanKeyword} pratique`
},
xmlTemplate: Buffer.from(simpleTemplate).toString('base64'),
source: 'api_generate_simple'
};
logSh(`📝 Template créé pour "${cleanKeyword}"`, 'DEBUG');
// Utiliser le workflow modulaire simple (juste génération de base)
const { handleModularWorkflow } = require('../Main');
const config = {
selectiveStack: 'lightEnhancement',
adversarialMode: 'none',
humanSimulationMode: 'none',
patternBreakingMode: 'none',
saveVersions: false,
source: 'api_generate_simple'
};
logSh(`🚀 Démarrage génération modulaire pour "${cleanKeyword}"`, 'INFO');
const result = await handleModularWorkflow(workflowData, config);
logSh(`✅ Génération terminée pour "${cleanKeyword}"`, 'INFO');
// Réponse simplifiée
res.json({
success: true,
keyword: cleanKeyword,
article: {
content: result.compiledText || result.generatedTexts || 'Contenu généré',
title: result.generatedTexts?.Titre_Principal || `Article sur ${cleanKeyword}`,
meta: {
processing_time: result.processingTime || 'N/A',
personality: result.personality?.nom || 'Marc',
version: result.version || 'v1.0'
}
},
timestamp: new Date().toISOString()
});
} catch (error) {
logSh(`❌ Erreur génération simple: ${error.message}`, 'ERROR');
logSh(`Stack: ${error.stack}`, 'DEBUG');
res.status(500).json({
success: false,
error: 'Erreur lors de la génération',
message: error.message,
timestamp: new Date().toISOString()
});
}
}
// ========================================
// INTERFACE WEB
// ========================================

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialCore
// Module: adversarial-generation/AdversarialCore.js
// Générés le: 2025-09-08T23:48:02.608Z
// Générés le: 2025-09-15T04:05:52.020Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialInitialGeneration
// Module: adversarial-generation/AdversarialInitialGeneration.js
// Générés le: 2025-09-08T23:48:02.627Z
// Générés le: 2025-09-15T04:05:52.025Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialLayers
// Module: adversarial-generation/AdversarialLayers.js
// Générés le: 2025-09-08T23:48:02.645Z
// Générés le: 2025-09-15T04:05:52.031Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialPromptEngine
// Module: adversarial-generation/AdversarialPromptEngine.js
// Générés le: 2025-09-08T23:48:02.662Z
// Générés le: 2025-09-15T04:05:52.035Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialStyleEnhancement
// Module: adversarial-generation/AdversarialStyleEnhancement.js
// Générés le: 2025-09-08T23:48:02.690Z
// Générés le: 2025-09-15T04:05:52.040Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialTechnicalEnhancement
// Module: adversarial-generation/AdversarialTechnicalEnhancement.js
// Générés le: 2025-09-08T23:48:02.707Z
// Générés le: 2025-09-15T04:05:52.046Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialTransitionEnhancement
// Module: adversarial-generation/AdversarialTransitionEnhancement.js
// Générés le: 2025-09-08T23:48:02.729Z
// Générés le: 2025-09-15T04:05:52.050Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AdversarialUtils
// Module: adversarial-generation/AdversarialUtils.js
// Générés le: 2025-09-08T23:48:02.762Z
// Générés le: 2025-09-15T04:05:52.058Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ArticleStorage
// Module: ArticleStorage.js
// Générés le: 2025-09-08T23:48:02.326Z
// Générés le: 2025-09-15T04:05:51.925Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - AutoProcessor
// Module: modes/AutoProcessor.js
// Générés le: 2025-09-08T23:48:03.003Z
// Générés le: 2025-09-15T04:05:52.128Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - BrainConfig
// Module: BrainConfig.js
// Générés le: 2025-09-08T23:48:02.341Z
// Générés le: 2025-09-15T04:05:51.935Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ComparisonFramework
// Module: adversarial-generation/ComparisonFramework.js
// Générés le: 2025-09-08T23:48:02.783Z
// Générés le: 2025-09-15T04:05:52.063Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ContentAssembly
// Module: ContentAssembly.js
// Générés le: 2025-09-08T23:48:02.356Z
// Générés le: 2025-09-15T04:05:51.939Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ContentGenerationAdversarial
// Module: adversarial-generation/ContentGenerationAdversarial.js
// Générés le: 2025-09-08T23:48:02.811Z
// Générés le: 2025-09-15T04:05:52.067Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - DetectorStrategies
// Module: adversarial-generation/DetectorStrategies.js
// Générés le: 2025-09-08T23:48:02.834Z
// Générés le: 2025-09-15T04:05:52.075Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - DigitalOceanWorkflow
// Module: DigitalOceanWorkflow.js
// Générés le: 2025-09-08T23:48:02.377Z
// Générés le: 2025-09-15T04:05:51.946Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ElementExtraction
// Module: ElementExtraction.js
// Générés le: 2025-09-08T23:48:02.390Z
// Générés le: 2025-09-15T04:05:51.953Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ErrorReporting
// Module: ErrorReporting.js
// Générés le: 2025-09-08T23:48:02.430Z
// Générés le: 2025-09-15T04:05:51.962Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - FatiguePatterns
// Module: human-simulation/FatiguePatterns.js
// Générés le: 2025-09-08T23:48:02.873Z
// Générés le: 2025-09-15T04:05:52.087Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - HumanSimulationCore
// Module: human-simulation/HumanSimulationCore.js
// Générés le: 2025-09-08T23:48:02.903Z
// Générés le: 2025-09-15T04:05:52.093Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - HumanSimulationLayers
// Module: human-simulation/HumanSimulationLayers.js
// Générés le: 2025-09-08T23:48:02.923Z
// Générés le: 2025-09-15T04:05:52.101Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - HumanSimulationUtils
// Module: human-simulation/HumanSimulationUtils.js
// Générés le: 2025-09-08T23:48:02.941Z
// Générés le: 2025-09-15T04:05:52.106Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - InitialGeneration
// Module: generation/InitialGeneration.js
// Générés le: 2025-09-06T12:40:36.058Z
// Générés le: 2025-09-15T04:05:52.082Z
// ========================================
const assert = require('assert');
@ -20,276 +20,40 @@ describe('InitialGeneration - Tests automatiques', () => {
});
test('generateInitialContent - Content Generation', async () => {
const mockInput = "test_value";
test('apply - Async Operation', async () => {
const input = undefined;
try {
const result = await InitialGeneration.generateInitialContent(mockInput);
const startTime = Date.now();
const result = await InitialGeneration.apply(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ generateInitialContent: Content generated successfully');
console.log(`✅ apply: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ generateInitialContent: Generation failed:', error.message);
console.error('❌ apply: Async operation failed:', error.message);
throw error;
}
});
test('generateNormalElements - Content Generation', async () => {
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
test('for - Basic Function', () => {
const input = undefined;
try {
const result = await InitialGeneration.generateNormalElements(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ generateNormalElements: Content generated successfully');
} catch (error) {
console.error('❌ generateNormalElements: Generation failed:', error.message);
throw error;
}
});
test('generateFAQPairs - Content Generation', async () => {
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
try {
const result = await InitialGeneration.generateFAQPairs(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ generateFAQPairs: Content generated successfully');
} catch (error) {
console.error('❌ generateFAQPairs: Generation failed:', error.message);
throw error;
}
});
test('createBatchPrompt - Content Generation', async () => {
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
try {
const result = await InitialGeneration.createBatchPrompt(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ createBatchPrompt: Content generated successfully');
} catch (error) {
console.error('❌ createBatchPrompt: Generation failed:', error.message);
throw error;
}
});
test('parseBatchResponse - Basic Function', () => {
const input = ["test_value", "test_value"];
try {
const result = InitialGeneration.parseBatchResponse(input);
const result = InitialGeneration.for(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ parseBatchResponse: Function executed successfully');
console.log('✅ for: Function executed successfully');
} catch (error) {
console.error('❌ parseBatchResponse: Function failed:', error.message);
throw error;
}
});
test('createFAQPairsPrompt - Content Generation', async () => {
const mockInput = ["test_value", { mc0: "test keyword", t0: "Test title" }];
try {
const result = await InitialGeneration.createFAQPairsPrompt(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ createFAQPairsPrompt: Content generated successfully');
} catch (error) {
console.error('❌ createFAQPairsPrompt: Generation failed:', error.message);
throw error;
}
});
test('parseFAQResponse - Basic Function', () => {
const input = ["test_value", "test_value"];
try {
const result = InitialGeneration.parseFAQResponse(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ parseFAQResponse: Function executed successfully');
} catch (error) {
console.error('❌ parseFAQResponse: Function failed:', error.message);
throw error;
}
});
test('collectElementsInXMLOrder - Basic Function', () => {
const input = "test_value";
try {
const result = InitialGeneration.collectElementsInXMLOrder(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ collectElementsInXMLOrder: Function executed successfully');
} catch (error) {
console.error('❌ collectElementsInXMLOrder: Function failed:', error.message);
throw error;
}
});
test('separateElementTypes - Basic Function', () => {
const input = "test_value";
try {
const result = InitialGeneration.separateElementTypes(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ separateElementTypes: Function executed successfully');
} catch (error) {
console.error('❌ separateElementTypes: Function failed:', error.message);
throw error;
}
});
test('getElementDescription - Basic Function', () => {
const input = "test_value";
try {
const result = InitialGeneration.getElementDescription(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ getElementDescription: Function executed successfully');
} catch (error) {
console.error('❌ getElementDescription: Function failed:', error.message);
throw error;
}
});
test('cleanGeneratedContent - Basic Function', () => {
const input = "Test content for validation";
try {
const result = InitialGeneration.cleanGeneratedContent(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ cleanGeneratedContent: Function executed successfully');
} catch (error) {
console.error('❌ cleanGeneratedContent: Function failed:', error.message);
throw error;
}
});
test('chunkArray - Basic Function', () => {
const input = ["test_value", "test_value"];
try {
const result = InitialGeneration.chunkArray(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ chunkArray: Function executed successfully');
} catch (error) {
console.error('❌ chunkArray: Function failed:', error.message);
throw error;
}
});
test('sleep - Basic Function', () => {
const input = "test_value";
try {
const result = InitialGeneration.sleep(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ sleep: Function executed successfully');
} catch (error) {
console.error('❌ sleep: Function failed:', error.message);
console.error('❌ for: Function failed:', error.message);
throw error;
}
});
@ -330,38 +94,170 @@ describe('InitialGeneration - Tests automatiques', () => {
}
});
test('for - Basic Function', () => {
test('prepareElementsForGeneration - Basic Function', () => {
const input = undefined;
try {
const result = InitialGeneration.for(input);
const result = InitialGeneration.prepareElementsForGeneration(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ for: Function executed successfully');
console.log('✅ prepareElementsForGeneration: Function executed successfully');
} catch (error) {
console.error('❌ for: Function failed:', error.message);
console.error('❌ prepareElementsForGeneration: Function failed:', error.message);
throw error;
}
});
test('forEach - Basic Function', () => {
test('detectElementType - Basic Function', () => {
const input = undefined;
try {
const result = InitialGeneration.forEach(input);
const result = InitialGeneration.detectElementType(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ forEach: Function executed successfully');
console.log('✅ detectElementType: Function executed successfully');
} catch (error) {
console.error('❌ forEach: Function failed:', error.message);
console.error('❌ detectElementType: Function failed:', error.message);
throw error;
}
});
test('createInstructionFromPlaceholder - Content Generation', async () => {
const mockInput = undefined;
try {
const result = await InitialGeneration.createInstructionFromPlaceholder(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ createInstructionFromPlaceholder: Content generated successfully');
} catch (error) {
console.error('❌ createInstructionFromPlaceholder: Generation failed:', error.message);
throw error;
}
});
test('createInitialGenerationPrompt - Content Generation', async () => {
const mockInput = undefined;
try {
const result = await InitialGeneration.createInitialGenerationPrompt(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ createInitialGenerationPrompt: Content generated successfully');
} catch (error) {
console.error('❌ createInitialGenerationPrompt: Generation failed:', error.message);
throw error;
}
});
test('parseInitialGenerationResponse - Basic Function', () => {
const input = undefined;
try {
const result = InitialGeneration.parseInitialGenerationResponse(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ parseInitialGenerationResponse: Function executed successfully');
} catch (error) {
console.error('❌ parseInitialGenerationResponse: Function failed:', error.message);
throw error;
}
});
test('while - Basic Function', () => {
const input = undefined;
try {
const result = InitialGeneration.while(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ while: Function executed successfully');
} catch (error) {
console.error('❌ while: Function failed:', error.message);
throw error;
}
});
test('cleanGeneratedContent - Basic Function', () => {
const input = undefined;
try {
const result = InitialGeneration.cleanGeneratedContent(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ cleanGeneratedContent: Function executed successfully');
} catch (error) {
console.error('❌ cleanGeneratedContent: Function failed:', error.message);
throw error;
}
});
test('createFallbackContent - Content Generation', async () => {
const mockInput = undefined;
try {
const result = await InitialGeneration.createFallbackContent(mockInput);
// Validations de base
assert.ok(result, 'Should return a result');
assert.ok(typeof result === 'string' || typeof result === 'object', 'Should return content');
// Validation IA si contenu texte
if (typeof result === 'string' && result.length > 50) {
const validation = await AIContentValidator.quickValidate(result, {
context: 'Generated content test'
});
assert.ok(validation.overall >= 40, 'Content quality should be acceptable');
}
console.log('✅ createFallbackContent: Content generated successfully');
} catch (error) {
console.error('❌ createFallbackContent: Generation failed:', error.message);
throw error;
}
});
@ -384,54 +280,9 @@ describe('InitialGeneration - Tests automatiques', () => {
}
});
test('Export - generateInitialContent', () => {
assert.ok(InitialGeneration.generateInitialContent !== undefined, 'Export generateInitialContent should be available');
console.log('✅ Export generateInitialContent: Available');
});
test('Export - MAIN', () => {
assert.ok(InitialGeneration.MAIN !== undefined, 'Export MAIN should be available');
console.log('✅ Export MAIN: Available');
});
test('Export - ENTRY', () => {
assert.ok(InitialGeneration.ENTRY !== undefined, 'Export ENTRY should be available');
console.log('✅ Export ENTRY: Available');
});
test('Export - POINT', () => {
assert.ok(InitialGeneration.POINT !== undefined, 'Export POINT should be available');
console.log('✅ Export POINT: Available');
});
test('Export - generateNormalElements', () => {
assert.ok(InitialGeneration.generateNormalElements !== undefined, 'Export generateNormalElements should be available');
console.log('✅ Export generateNormalElements: Available');
});
test('Export - generateFAQPairs', () => {
assert.ok(InitialGeneration.generateFAQPairs !== undefined, 'Export generateFAQPairs should be available');
console.log('✅ Export generateFAQPairs: Available');
});
test('Export - createBatchPrompt', () => {
assert.ok(InitialGeneration.createBatchPrompt !== undefined, 'Export createBatchPrompt should be available');
console.log('✅ Export createBatchPrompt: Available');
});
test('Export - parseBatchResponse', () => {
assert.ok(InitialGeneration.parseBatchResponse !== undefined, 'Export parseBatchResponse should be available');
console.log('✅ Export parseBatchResponse: Available');
});
test('Export - collectElementsInXMLOrder', () => {
assert.ok(InitialGeneration.collectElementsInXMLOrder !== undefined, 'Export collectElementsInXMLOrder should be available');
console.log('✅ Export collectElementsInXMLOrder: Available');
});
test('Export - separateElementTypes', () => {
assert.ok(InitialGeneration.separateElementTypes !== undefined, 'Export separateElementTypes should be available');
console.log('✅ Export separateElementTypes: Available');
test('Export - InitialGenerationLayer', () => {
assert.ok(InitialGeneration.InitialGenerationLayer !== undefined, 'Export InitialGenerationLayer should be available');
console.log('✅ Export InitialGenerationLayer: Available');
});

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - LLMFingerprintRemoval
// Module: post-processing/LLMFingerprintRemoval.js
// Générés le: 2025-09-08T23:48:03.084Z
// Générés le: 2025-09-15T04:05:52.182Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - LLMFingerprints
// Module: pattern-breaking/LLMFingerprints.js
// Générés le: 2025-09-08T23:48:03.039Z
// Générés le: 2025-09-15T04:05:52.155Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - LLMManager
// Module: LLMManager.js
// Générés le: 2025-09-08T23:48:02.444Z
// Générés le: 2025-09-15T04:05:51.966Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - Main
// Module: Main.js
// Générés le: 2025-09-08T23:48:02.465Z
// Générés le: 2025-09-15T04:05:51.978Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ManualServer
// Module: modes/ManualServer.js
// Générés le: 2025-09-08T23:48:03.015Z
// Générés le: 2025-09-15T04:05:52.145Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ManualTrigger
// Module: ManualTrigger.js
// Générés le: 2025-09-08T23:48:02.482Z
// Générés le: 2025-09-15T04:05:51.982Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - MissingKeywords
// Module: MissingKeywords.js
// Générés le: 2025-09-08T23:48:02.495Z
// Générés le: 2025-09-15T04:05:51.987Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - ModeManager
// Module: modes/ModeManager.js
// Générés le: 2025-09-08T23:48:03.033Z
// Générés le: 2025-09-15T04:05:52.151Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - NaturalConnectors
// Module: pattern-breaking/NaturalConnectors.js
// Générés le: 2025-09-08T23:48:03.047Z
// Générés le: 2025-09-15T04:05:52.160Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - PatternBreaking
// Module: post-processing/PatternBreaking.js
// Générés le: 2025-09-08T23:48:03.091Z
// Générés le: 2025-09-15T04:05:52.187Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - PatternBreakingCore
// Module: pattern-breaking/PatternBreakingCore.js
// Générés le: 2025-09-08T23:48:03.054Z
// Générés le: 2025-09-15T04:05:52.166Z
// ========================================
const assert = require('assert');
@ -99,6 +99,166 @@ describe('PatternBreakingCore - Tests automatiques', () => {
}
});
test('applyAggressiveSyntax - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyAggressiveSyntax(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyAggressiveSyntax: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyAggressiveSyntax: Async operation failed:', error.message);
throw error;
}
});
test('applyMicroVariations - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyMicroVariations(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyMicroVariations: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyMicroVariations: Async operation failed:', error.message);
throw error;
}
});
test('applyFrenchPatterns - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyFrenchPatterns(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyFrenchPatterns: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyFrenchPatterns: Async operation failed:', error.message);
throw error;
}
});
test('applyCasualization - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyCasualization(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyCasualization: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyCasualization: Async operation failed:', error.message);
throw error;
}
});
test('applyCasualConnectors - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyCasualConnectors(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyCasualConnectors: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyCasualConnectors: Async operation failed:', error.message);
throw error;
}
});
test('applyHumanImperfections - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyHumanImperfections(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyHumanImperfections: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyHumanImperfections: Async operation failed:', error.message);
throw error;
}
});
test('applyQuestionInjection - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyQuestionInjection(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyQuestionInjection: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyQuestionInjection: Async operation failed:', error.message);
throw error;
}
});
test('applyIntelligentRestructuring - Async Operation', async () => {
const input = ["Test content for validation", "test_value"];
try {
const startTime = Date.now();
const result = await PatternBreakingCore.applyIntelligentRestructuring(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ applyIntelligentRestructuring: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ applyIntelligentRestructuring: Async operation failed:', error.message);
throw error;
}
});
test('validatePatternBreakingQuality - Validation', async () => {
const validInput = ["test_value", "test_value", "test_value"];
const invalidInput = null;
@ -164,6 +324,24 @@ describe('PatternBreakingCore - Tests automatiques', () => {
}
});
test('for - Basic Function', () => {
const input = undefined;
try {
const result = PatternBreakingCore.for(input);
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(typeof result !== 'undefined', 'Result should be defined');
console.log('✅ for: Function executed successfully');
} catch (error) {
console.error('❌ for: Function failed:', error.message);
throw error;
}
});
test('Export - applyPatternBreakingLayer', () => {
assert.ok(PatternBreakingCore.applyPatternBreakingLayer !== undefined, 'Export applyPatternBreakingLayer should be available');
console.log('✅ Export applyPatternBreakingLayer: Available');
@ -189,6 +367,46 @@ describe('PatternBreakingCore - Tests automatiques', () => {
console.log('✅ Export validatePatternBreakingQuality: Available');
});
test('Export - applyAggressiveSyntax', () => {
assert.ok(PatternBreakingCore.applyAggressiveSyntax !== undefined, 'Export applyAggressiveSyntax should be available');
console.log('✅ Export applyAggressiveSyntax: Available');
});
test('Export - applyMicroVariations', () => {
assert.ok(PatternBreakingCore.applyMicroVariations !== undefined, 'Export applyMicroVariations should be available');
console.log('✅ Export applyMicroVariations: Available');
});
test('Export - applyFrenchPatterns', () => {
assert.ok(PatternBreakingCore.applyFrenchPatterns !== undefined, 'Export applyFrenchPatterns should be available');
console.log('✅ Export applyFrenchPatterns: Available');
});
test('Export - applyCasualization', () => {
assert.ok(PatternBreakingCore.applyCasualization !== undefined, 'Export applyCasualization should be available');
console.log('✅ Export applyCasualization: Available');
});
test('Export - applyCasualConnectors', () => {
assert.ok(PatternBreakingCore.applyCasualConnectors !== undefined, 'Export applyCasualConnectors should be available');
console.log('✅ Export applyCasualConnectors: Available');
});
test('Export - applyHumanImperfections', () => {
assert.ok(PatternBreakingCore.applyHumanImperfections !== undefined, 'Export applyHumanImperfections should be available');
console.log('✅ Export applyHumanImperfections: Available');
});
test('Export - applyQuestionInjection', () => {
assert.ok(PatternBreakingCore.applyQuestionInjection !== undefined, 'Export applyQuestionInjection should be available');
console.log('✅ Export applyQuestionInjection: Available');
});
test('Export - applyIntelligentRestructuring', () => {
assert.ok(PatternBreakingCore.applyIntelligentRestructuring !== undefined, 'Export applyIntelligentRestructuring should be available');
console.log('✅ Export applyIntelligentRestructuring: Available');
});
test('Export - DEFAULT_CONFIG', () => {
assert.ok(PatternBreakingCore.DEFAULT_CONFIG !== undefined, 'Export DEFAULT_CONFIG should be available');
console.log('✅ Export DEFAULT_CONFIG: Available');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - PatternBreakingLayers
// Module: pattern-breaking/PatternBreakingLayers.js
// Générés le: 2025-09-08T23:48:03.064Z
// Générés le: 2025-09-15T04:05:52.171Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - PersonalityErrors
// Module: human-simulation/PersonalityErrors.js
// Générés le: 2025-09-08T23:48:02.959Z
// Générés le: 2025-09-15T04:05:52.113Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SelectiveCore
// Module: selective-enhancement/SelectiveCore.js
// Générés le: 2025-09-08T23:48:03.123Z
// Générés le: 2025-09-15T04:05:52.202Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SelectiveEnhancement
// Module: SelectiveEnhancement.js
// Générés le: 2025-09-08T23:48:02.525Z
// Générés le: 2025-09-15T04:05:52.000Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SelectiveLayers
// Module: selective-enhancement/SelectiveLayers.js
// Générés le: 2025-09-08T23:48:03.135Z
// Générés le: 2025-09-15T04:05:52.207Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SelectiveUtils
// Module: selective-enhancement/SelectiveUtils.js
// Générés le: 2025-09-08T23:48:03.146Z
// Générés le: 2025-09-15T04:05:52.212Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SentenceVariation
// Module: post-processing/SentenceVariation.js
// Générés le: 2025-09-08T23:48:03.098Z
// Générés le: 2025-09-15T04:05:52.192Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - StepByStepSessionManager
// Module: StepByStepSessionManager.js
// Générés le: 2025-09-08T23:48:02.538Z
// Générés le: 2025-09-15T04:05:52.006Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - StepExecutor
// Module: StepExecutor.js
// Générés le: 2025-09-08T23:48:02.561Z
// Générés le: 2025-09-15T04:05:52.011Z
// ========================================
const assert = require('assert');
@ -76,6 +76,26 @@ describe('StepExecutor - Tests automatiques', () => {
}
});
test('executeInitialGeneration - Async Operation', async () => {
const input = undefined;
try {
const startTime = Date.now();
const result = await StepExecutor.executeInitialGeneration(input);
const duration = Date.now() - startTime;
// Validations de base
assert.ok(result !== undefined, 'Should return a result');
assert.ok(duration < 30000, 'Should complete within 30 seconds');
console.log(`✅ executeInitialGeneration: Completed in ${duration}ms`);
} catch (error) {
console.error('❌ executeInitialGeneration: Async operation failed:', error.message);
throw error;
}
});
test('executeSelective - Async Operation', async () => {
const input = undefined;

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - StyleLayer
// Module: selective-enhancement/StyleLayer.js
// Générés le: 2025-09-08T23:48:03.153Z
// Générés le: 2025-09-15T04:05:52.217Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - SyntaxVariations
// Module: pattern-breaking/SyntaxVariations.js
// Générés le: 2025-09-08T23:48:03.070Z
// Générés le: 2025-09-15T04:05:52.176Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TechnicalLayer
// Module: selective-enhancement/TechnicalLayer.js
// Générés le: 2025-09-08T23:48:03.160Z
// Générés le: 2025-09-15T04:05:52.224Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TemporalStyles
// Module: human-simulation/TemporalStyles.js
// Générés le: 2025-09-08T23:48:02.971Z
// Générés le: 2025-09-15T04:05:52.119Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TransitionHumanization
// Module: post-processing/TransitionHumanization.js
// Générés le: 2025-09-08T23:48:03.109Z
// Générés le: 2025-09-15T04:05:52.197Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - TransitionLayer
// Module: selective-enhancement/TransitionLayer.js
// Générés le: 2025-09-08T23:48:03.195Z
// Générés le: 2025-09-15T04:05:52.233Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - Utils
// Module: Utils.js
// Générés le: 2025-09-08T23:48:02.582Z
// Générés le: 2025-09-15T04:05:52.015Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - demo-modulaire
// Module: selective-enhancement/demo-modulaire.js
// Générés le: 2025-09-08T23:48:03.208Z
// Générés le: 2025-09-15T04:05:52.238Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - trace-wrap
// Module: trace-wrap.js
// Générés le: 2025-09-08T23:48:03.234Z
// Générés le: 2025-09-15T04:05:52.240Z
// ========================================
const assert = require('assert');

View File

@ -1,7 +1,7 @@
// ========================================
// TESTS GÉNÉRÉS AUTOMATIQUEMENT - trace
// Module: trace.js
// Générés le: 2025-09-08T23:48:03.257Z
// Générés le: 2025-09-15T04:05:52.248Z
// ========================================
const assert = require('assert');