🔧 ADD: CPU/Computer responses and server improvements
- Added comprehensive CPU/computer responses in ai-responses.js - Added contextual CPU detection logic in script-new.js - Fixed server encouragements to be topic-specific - Improved pneumatic tool responses - Added debugging to troubleshoot response generation - Server now provides contextual encouragements based on question content
This commit is contained in:
@@ -85,6 +85,20 @@ const AIResponses = {
|
||||
general: "🔨 You're thinking about the mechanics of pneumatic tools - that's exactly the kind of engineering thinking we need!"
|
||||
},
|
||||
|
||||
// Computer and CPU responses
|
||||
computer: {
|
||||
cpu: {
|
||||
computes: "💻 Exactly! You understand that CPUs do computing! Now you're thinking about what materials could handle billions of calculations per second!",
|
||||
processor: "🧠 Perfect! The CPU is like the brain of the computer - it processes information super fast!",
|
||||
electricity: "⚡ Great thinking! You're right that electricity is key - CPUs need materials that can handle electrical signals perfectly!",
|
||||
silicon: "🔬 Excellent! Silicon is exactly right - it's a semiconductor that can control electricity in precise ways!",
|
||||
circuits: "⚙️ Brilliant! You're thinking about circuits - CPUs have millions of tiny circuits etched into silicon!",
|
||||
dontKnow: "That's perfectly okay! 💡 Not knowing about CPU materials just means we get to discover something fascinating together!",
|
||||
materials: "🔧 Good question! Think about what properties a material would need to handle billions of electrical signals per second!"
|
||||
},
|
||||
general: "💻 You're exploring how computers work - that's the kind of curiosity that builds understanding!"
|
||||
},
|
||||
|
||||
// Generic responses based on answer quality (last resort)
|
||||
generic: {
|
||||
veryDetailed: "🌟 I appreciate your detailed explanation! You're really working through this systematically.",
|
||||
|
||||
@@ -558,9 +558,12 @@ class KidsAIExplorer {
|
||||
// Ensure AIResponses is available
|
||||
if (typeof AIResponses === 'undefined') {
|
||||
console.warn('⚠️ AIResponses not loaded, using fallback');
|
||||
console.log('Available global objects:', Object.keys(window));
|
||||
return "🌟 Great thinking! Keep exploring - you're doing wonderfully!";
|
||||
}
|
||||
|
||||
console.log('🔍 Generating response for:', { answer: answerLower, question: questionLower });
|
||||
|
||||
// Handle "I don't know" or help-seeking responses
|
||||
if (answerLower.includes('don\'t know') || answerLower.includes('no idea')) {
|
||||
return AIResponses.helpSeeking.dontKnow;
|
||||
@@ -688,6 +691,25 @@ class KidsAIExplorer {
|
||||
}
|
||||
}
|
||||
|
||||
// COMPUTER/CPU responses
|
||||
if (questionLower.includes('cpu') || questionLower.includes('processor') || questionLower.includes('computer')) {
|
||||
if (answerLower.includes('compute') || answerLower.includes('process')) {
|
||||
return AIResponses.computer.cpu.computes;
|
||||
} else if (answerLower.includes('don\'t know') || answerLower.includes('no idea')) {
|
||||
return AIResponses.computer.cpu.dontKnow;
|
||||
} else if (answerLower.includes('silicon')) {
|
||||
return AIResponses.computer.cpu.silicon;
|
||||
} else if (answerLower.includes('electric') || answerLower.includes('conduct')) {
|
||||
return AIResponses.computer.cpu.electricity;
|
||||
} else if (answerLower.includes('circuit')) {
|
||||
return AIResponses.computer.cpu.circuits;
|
||||
} else if (answerLower.includes('material')) {
|
||||
return AIResponses.computer.cpu.materials;
|
||||
} else {
|
||||
return AIResponses.computer.general;
|
||||
}
|
||||
}
|
||||
|
||||
// Generic responses based on answer quality and engagement
|
||||
if (answer.length > 25) {
|
||||
return AIResponses.generic.veryDetailed;
|
||||
|
||||
Reference in New Issue
Block a user