test-content-analysis.js•3.43 kB
#!/usr/bin/env node
/**
* Simple test to check if the intelligent content generation system is working
*/
import { readFileSync } from 'fs';
// Read the generated composition from the earlier test
const compositionFiles = [
'/Users/ricardokawasaki/Desktop/euconquisto-composer-mcp-poc/docs/references/photosynthesis-class.json'
];
console.log('🧪 Testing Intelligent Content Generation Results...');
for (const file of compositionFiles) {
try {
const content = readFileSync(file, 'utf8');
const composition = JSON.parse(content);
console.log(`\n📄 Analyzing: ${file}`);
console.log(` Title: ${composition.metadata.title}`);
console.log(` Elements: ${composition.structure.length}`);
// Find the text widget
const textWidget = composition.structure.find(element => element.type === 'text-2');
if (textWidget) {
console.log(`\n📝 Text Widget Analysis:`);
console.log(` Title: ${textWidget.content_title}`);
console.log(` Content Preview: ${textWidget.text.slice(0, 200)}...`);
// Check for intelligent content markers
const hasPhotosynthesis = textWidget.text.includes('fotossíntese');
const hasChlorophyll = textWidget.text.includes('clorofila');
const hasCO2 = textWidget.text.includes('CO₂');
const hasGlucose = textWidget.text.includes('glicose');
const hasGenericSobre = textWidget.text.includes('Sobre');
console.log(`\n🔍 Content Analysis:`);
console.log(` ✅ Contains "fotossíntese": ${hasPhotosynthesis}`);
console.log(` ✅ Contains "clorofila": ${hasChlorophyll}`);
console.log(` ✅ Contains "CO₂": ${hasCO2}`);
console.log(` ✅ Contains "glicose": ${hasGlucose}`);
console.log(` ❌ Contains generic "Sobre": ${hasGenericSobre}`);
const isIntelligent = hasPhotosynthesis && hasChlorophyll && hasCO2 && hasGlucose && !hasGenericSobre;
console.log(`\n🎯 INTELLIGENT GENERATION STATUS: ${isIntelligent ? '✅ SUCCESS' : '❌ FAILED'}`);
if (isIntelligent) {
console.log('🎉 The intelligent content generation is working correctly!');
console.log('✨ Scientific terms are present and generic placeholders are absent.');
} else {
console.log('⚠️ The intelligent content generation needs debugging.');
console.log('🔧 This appears to be using template/fallback generation.');
}
}
// Check flashcards
const flashcardsWidget = composition.structure.find(element => element.type === 'flashcards-1');
if (flashcardsWidget && flashcardsWidget.items) {
console.log(`\n🃏 Flashcards Analysis:`);
console.log(` Number of flashcards: ${flashcardsWidget.items.length}`);
const firstCard = flashcardsWidget.items[0];
if (firstCard) {
console.log(` First card front: ${firstCard.front_card.text}`);
console.log(` First card back: ${firstCard.back_card.text}`);
const hasIntelligentFlashcards = firstCard.front_card.text.includes('fotossíntese') ||
firstCard.back_card.text.includes('fotossíntese');
console.log(` ✅ Intelligent flashcards: ${hasIntelligentFlashcards}`);
}
}
} catch (error) {
console.log(`❌ Error reading ${file}: ${error.message}`);
}
}
console.log('\n🏁 Analysis Complete!');