Initial commit: KidsAI Explorer with complete functionality
- Complete KidsAI Explorer application - Multi-language support (English/German) - AI-powered educational guidance using OpenAI - Interactive chat interface for children - Proper placeholder translation fixes - Mobile-responsive design - Educational framework for critical thinking
This commit is contained in:
65
test-next-fundamental.js
Normal file
65
test-next-fundamental.js
Normal file
@@ -0,0 +1,65 @@
|
||||
// Test script to verify the next fundamental functionality
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const BASE_URL = 'http://localhost:3002';
|
||||
|
||||
async function testNextFundamental() {
|
||||
console.log('🧪 Testing KidsAI next fundamental functionality...\n');
|
||||
|
||||
try {
|
||||
// Step 1: Start conversation about rockets
|
||||
console.log('1️⃣ Starting conversation about rockets...');
|
||||
const step1 = await fetch(`${BASE_URL}/api/ask`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
question: "Wie fliegt eine Rakete?",
|
||||
language: "de"
|
||||
})
|
||||
});
|
||||
|
||||
const step1Data = await step1.json();
|
||||
console.log('🤖 AI Initial Response:', step1Data.guidance?.steps?.[0]?.text || 'No response');
|
||||
|
||||
// Extract session ID
|
||||
const sessionId = "test-session-next-fundamental-" + Date.now();
|
||||
|
||||
// Step 2: Continue to next fundamental
|
||||
console.log('\n2️⃣ Requesting next fundamental...');
|
||||
const step2 = await fetch(`${BASE_URL}/api/next-fundamental`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
context: 'next_fundamental',
|
||||
language: "de",
|
||||
sessionId: sessionId
|
||||
})
|
||||
});
|
||||
|
||||
const step2Data = await step2.json();
|
||||
console.log('\n🤖 Next Fundamental Summary:', step2Data.nextFundamental?.summary || 'No summary');
|
||||
console.log('🤖 Next Fundamental Question:', step2Data.nextFundamental?.question || 'No question');
|
||||
|
||||
// Check if the response is appropriate
|
||||
const hasValidSummary = !!step2Data.nextFundamental?.summary;
|
||||
const hasValidQuestion = !!step2Data.nextFundamental?.question;
|
||||
|
||||
console.log('\n📊 RESULT ANALYSIS:');
|
||||
console.log('✅ Received summary:', hasValidSummary);
|
||||
console.log('✅ Received question:', hasValidQuestion);
|
||||
console.log('🎉 FUNCTIONALITY STATUS:',
|
||||
(hasValidSummary && hasValidQuestion) ? 'SUCCESS! ✅' : 'INCOMPLETE ❌');
|
||||
|
||||
if (hasValidSummary && hasValidQuestion) {
|
||||
console.log('\n🎊 EXCELLENT! The next fundamental functionality is working correctly!');
|
||||
} else {
|
||||
console.log('\n❌ The functionality is not complete. Need further investigation.');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Test failed:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Run the test
|
||||
testNextFundamental();
|
||||
Reference in New Issue
Block a user