Files
kidsai/test-humor.js
root 500bd192d5 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
2025-07-13 16:59:42 +02:00

66 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Test script to verify humorous answers handling
const fetch = require('node-fetch');
const BASE_URL = 'http://localhost:3002';
async function testHumorousAnswers() {
console.log('🧪 Testing KidsAI humorous answers handling...\n');
try {
// Step 1: Start conversation about hormones
console.log('1⃣ Starting conversation about hormones...');
const step1 = await fetch(`${BASE_URL}/api/ask`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question: "Warum wächst Männern ein Bart?",
language: "de"
})
});
const step1Data = await step1.json();
console.log('🤖 AI Response:', step1Data.guidance?.steps?.[0]?.text || 'No response');
// Step 2: Child gives humorous answer "per fax"
console.log('\n2⃣ Child gives humorous answer "per fax"...');
const step2 = await fetch(`${BASE_URL}/api/respond-to-answer`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
answer: "per fax",
question: "Weißt du, was Hormone sind und wie sie in unserem Körper wirken?",
originalTopic: "Warum wächst Männern ein Bart?",
language: "de",
sessionId: "test-humor-123"
})
});
const step2Data = await step2.json();
console.log('🤖 AI Response:', step2Data.response || 'No response');
// Check if the response acknowledges creativity
const response = step2Data.response || '';
const isAppropriate = response.includes('kreativ') ||
response.includes('witzig') ||
response.includes('Humor') ||
response.includes('lächeln') ||
response.includes('lustig');
console.log('\n📊 RESULT ANALYSIS:');
console.log('✅ Response acknowledges humor/creativity:', isAppropriate);
console.log('🎉 FEATURE STATUS:', isAppropriate ? 'SUCCESS! ✅' : 'NEEDS IMPROVEMENT ❌');
if (isAppropriate) {
console.log('\n🎊 EXCELLENT! The AI now acknowledges humorous or creative answers!');
} else {
console.log('\n❌ The feature needs improvement. AI should acknowledge the child\'s creativity.');
}
} catch (error) {
console.error('❌ Test failed:', error.message);
}
}
// Run the test
testHumorousAnswers();