Files
kidsai/test-frustration.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

83 lines
3.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 frustration/inappropriate comment handling
const fetch = require('node-fetch');
const BASE_URL = 'http://localhost:3002';
async function testFrustrationHandling() {
console.log('🧪 Testing KidsAI frustration handling...\n');
try {
// Step 1: Start conversation about communication
console.log('1⃣ Starting conversation about communication...');
const step1 = await fetch(`${BASE_URL}/api/ask`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
question: "Warum antwortet Papa nicht auf meine Fragen?",
language: "de"
})
});
const step1Data = await step1.json();
console.log('🤖 AI Response:', step1Data.guidance?.steps?.[0]?.text || 'No response');
// Step 2: Child says something inappropriate about their dad
console.log('\n2⃣ Child says "Meine Vermutung ist, dass Papa doof ist"...');
const step2 = await fetch(`${BASE_URL}/api/respond-to-answer`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
answer: "Meine Vermutung ist, dass Papa doof ist",
question: "Was denkst du, ist Kommunikation?",
originalTopic: "Warum antwortet Papa nicht auf meine Fragen?",
language: "de",
sessionId: "test-frustration-123"
})
});
const step2Data = await step2.json();
console.log('🤖 AI Response:', step2Data.response || 'No response');
// Step 3: Child gets more frustrated
console.log('\n3⃣ Child says "Bist du auch doof? Das hat doch gar nichts mit meiner Antwort zu tun!"...');
const step3 = await fetch(`${BASE_URL}/api/respond-to-answer`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
answer: "Bist du auch doof? Das hat doch gar nichts mit meiner Antwort zu tun!",
question: "Was denkst du, wie Menschen miteinander sprechen oder Informationen austauschen?",
originalTopic: "Warum antwortet Papa nicht auf meine Fragen?",
language: "de",
sessionId: "test-frustration-123"
})
});
const step3Data = await step3.json();
console.log('🤖 AI Response:', step3Data.response || 'No response');
// Check if the response handles frustration appropriately
const response = step3Data.response || '';
const handlesEmotionWell = response.includes('verstehen') ||
response.includes('frustriert') ||
response.includes('ärgerlich') ||
response.includes('fühlen') ||
response.includes('anders angehen');
console.log('\n📊 RESULT ANALYSIS:');
console.log('✅ Response acknowledges child\'s emotions:', handlesEmotionWell);
console.log('🎉 FEATURE STATUS:', handlesEmotionWell ? 'SUCCESS! ✅' : 'NEEDS IMPROVEMENT ❌');
if (handlesEmotionWell) {
console.log('\n🎊 EXCELLENT! The AI handles frustration and emotions well!');
} else {
console.log('\n❌ The AI needs better emotional intelligence for frustrated children.');
}
} catch (error) {
console.error('❌ Test failed:', error.message);
}
}
// Run the test
testFrustrationHandling();