diff --git a/html/kidsai/ai-responses.js b/html/kidsai/ai-responses.js
new file mode 100644
index 0000000..3445f3b
--- /dev/null
+++ b/html/kidsai/ai-responses.js
@@ -0,0 +1,91 @@
+// AI Response Configuration
+// This file contains all the contextual responses for the KidsAI system
+// Separated from main script to prevent corruption during edits
+
+const AIResponses = {
+ // Handle "I don't know" or help-seeking responses
+ helpSeeking: {
+ dontKnow: "That's perfectly fine! ๐ค Not knowing something just means we're about to learn something new together. Let's keep exploring!",
+ whatIsIt: "That's a great question! ๐ That's exactly what we're exploring together - let's discover it step by step!",
+ tellMe: "I love your curiosity! ๐ Instead of telling you directly, let's think through it together so you can discover it yourself!"
+ },
+
+ // Short answer responses
+ shortAnswers: {
+ yes: {
+ bicycle: "Great! ๐ดโโ๏ธ Since you have bicycle experience, you understand how mechanical controls work. That's perfect for what we're exploring!",
+ general: "Perfect! ๐ I can see you're following along. Let's dive a bit deeper!",
+ knowledge: "Excellent! ๐ Your knowledge will help us build on these concepts together!"
+ },
+ no: "No problem at all! ๐ That's why we're exploring this together - to discover new things!"
+ },
+
+ // Topic-specific responses
+ bicycle: {
+ brake: {
+ slowDown: "๐ดโโ๏ธ Exactly right! You understand that brakes slow you down and stop you. That's the basic function we need to understand!",
+ technical: "๐ฏ Great technical thinking! You understand how the brake mechanism works on the wheel!",
+ general: "๐ค Tell me more about what happens when you use bicycle brakes."
+ },
+ mechanics: {
+ pedalChainWheel: "๐ดโโ๏ธ Excellent! You understand the connection between pedals, chain, and wheels. That mechanical connection concept is key!",
+ gearSpeed: "โ๏ธ Yes! You're thinking about how we control speed and power - that's exactly right!",
+ slowStop: "๐ดโโ๏ธ Right! You understand the basic control functions of bicycles!"
+ }
+ },
+
+ car: {
+ brake: {
+ perfectAnswer: "๐ฏ EXACTLY! ๐ Yes, it's the brake system! Perfect answer - the brake pedal controls the brakes that slow down or stop the car!",
+ brakeAndPedal: "๐ Perfect! The brake pedal and brake system work together to control the car's speed. You nailed it!",
+ justBrake: "๐ฏ YES! The brakes! You got it exactly right! The brake system is what slows down and stops the car!",
+ wheelTire: "๐ You're thinking about where the braking happens - at the wheels! The brake system applies pressure there.",
+ pedal: "๐ฆถ Good! You're thinking about pedals. Which specific pedal controls stopping?",
+ general: "๐ค What component do you think actually does the slowing down in a car?"
+ },
+ comparison: {
+ engine: "๐ You're thinking about the engine - that's the power source! But I'm thinking of a specific part that works between the engine and wheels, kind of like how bike pedals connect to the chain.",
+ gearTransmission: "๐ฏ Great thinking! You're absolutely on the right track with gears and transmission systems!",
+ pedalBrake: "๐ฆถ Good connection! You're thinking about pedals in cars. There are actually multiple pedals that do different things!"
+ },
+ clutch: {
+ perfect: "๐ฏ Perfect! You know about the clutch! That's exactly what I was thinking of - the component that helps with smooth gear changes!",
+ transmission: "๐ง Excellent! You're thinking about the transmission system. The clutch is the part that connects and disconnects the engine from the gearbox!",
+ separate: "๐ Yes! You understand the separation concept - that's exactly what the clutch does!",
+ different: "๐ก Good observation! You're noticing that clutch and brake do different things. That's key insight!",
+ engineTransmission: "๐ Excellent! You're thinking about the engine and transmission connection - that's exactly what the clutch controls!",
+ general: "๐ค The clutch is quite different from the brake. What do you think it might do instead of slowing down?"
+ },
+ trafficLight: {
+ clutchNeutral: "๐ฆ Perfect! You understand that something allows the engine to keep running while the car is stopped!",
+ disconnect: "๐ก Exactly! Something disconnects the wheels from the engine so it can keep running while stopped!",
+ brakePark: "๐ You're thinking about stopping the car, which is important! But I'm thinking of how the engine can keep running while the wheels aren't moving."
+ }
+ },
+
+ // Bird flight responses
+ birds: {
+ pushAirLift: "๐ฆ Fantastic! You understand that it's all about air and creating lift! That's exactly how flight works!",
+ featherAirflow: "โจ Brilliant! Feathers and airflow are absolutely key to how birds fly!",
+ flapMove: "๐ Perfect! Wing movement creates the forces that allow birds to fly!"
+ },
+
+ // General mechanical understanding
+ mechanical: {
+ connectControl: "๐ง Excellent mechanical thinking! You understand that cars have systems that connect and control different parts!"
+ },
+
+ // Generic responses based on answer quality (last resort)
+ generic: {
+ veryDetailed: "๐ I appreciate your detailed explanation! You're really working through this systematically.",
+ detailed: "๐ Good thinking! I can see you're considering different aspects of this.",
+ medium: "๐ญ Interesting! Can you help me understand your reasoning a bit more?",
+ short: "๐ค I see what you're thinking. Can you elaborate on that?",
+ veryShort: "๐ก Feel free to share any thoughts - every idea helps us learn!"
+ }
+};
+
+// Export for use in main script
+if (typeof module !== 'undefined' && module.exports) {
+ module.exports = AIResponses;
+}
diff --git a/html/kidsai/index.html b/html/kidsai/index.html
index 071bcf9..efdc084 100755
--- a/html/kidsai/index.html
+++ b/html/kidsai/index.html
@@ -1,8 +1,5 @@
-
-
-
- ang="en">
+
@@ -22,7 +19,7 @@
-
+
@@ -90,6 +87,20 @@
๐กLet's Think Step by Step!
+
+
+
+
+
@@ -165,10 +176,39 @@
}, 100);
-
-
+
+
+
-
-
+
+
diff --git a/html/kidsai/script-new.js b/html/kidsai/script-new.js
index 4c4e36c..c667486 100644
--- a/html/kidsai/script-new.js
+++ b/html/kidsai/script-new.js
@@ -603,86 +603,133 @@ class KidsAIExplorer {
const currentQuestion = this.questions[questionIndex];
const questionLower = currentQuestion ? currentQuestion.toLowerCase() : '';
+ // Ensure AIResponses is available
+ if (typeof AIResponses === 'undefined') {
+ console.warn('โ ๏ธ AIResponses not loaded, using fallback');
+ return "๐ Great thinking! Keep exploring - you're doing wonderfully!";
+ }
+
// Handle "I don't know" or help-seeking responses
- if (answerLower.includes('don\'t know') || answerLower.includes('no idea') ||
- answerLower.includes('what is it') || answerLower.includes('tell me') ||
- (answerLower === 'no' && questionLower.includes('heard of'))) {
- return "That's perfectly fine! ๐ค Not knowing something just means we're about to learn something new together. Let's keep exploring!";
+ if (answerLower.includes('don\'t know') || answerLower.includes('no idea')) {
+ return AIResponses.helpSeeking.dontKnow;
+ }
+ if (answerLower.includes('what is it')) {
+ return AIResponses.helpSeeking.whatIsIt;
+ }
+ if (answerLower.includes('tell me')) {
+ return AIResponses.helpSeeking.tellMe;
}
// Handle very short positive answers like "yes"
if (answerLower === 'yes' || answerLower === 'yeah' || answerLower === 'yep') {
if (questionLower.includes('bicycle') || questionLower.includes('pedal')) {
- return "Great! ๐ดโโ๏ธ Since you understand how bicycles work, you're already thinking about mechanical connections. That's exactly the kind of thinking we need!";
+ return AIResponses.shortAnswers.yes.bicycle;
} else if (questionLower.includes('heard of') || questionLower.includes('know')) {
- return "Excellent! ๐ Your knowledge will help us build on these concepts together!";
+ return AIResponses.shortAnswers.yes.knowledge;
} else {
- return "Perfect! ๐ I can see you're following along. Let's dive a bit deeper!";
+ return AIResponses.shortAnswers.yes.general;
}
}
// Handle "no" responses
if (answerLower === 'no' || answerLower === 'nope') {
- return "No problem at all! ๐ That's why we're exploring this together - to discover new things!";
+ return AIResponses.shortAnswers.no;
}
- // Topic-specific contextual responses
+ // Topic-specific contextual responses - BICYCLE
if (questionLower.includes('bicycle') || questionLower.includes('pedal') || questionLower.includes('chain')) {
- if (answerLower.includes('pedal') || answerLower.includes('chain') || answerLower.includes('wheel')) {
- return "๏ฟฝโโ๏ธ Excellent! You understand the connection between pedals, chain, and wheels. That mechanical connection concept is key!";
+ if (answerLower.includes('brake') && (answerLower.includes('slow') || answerLower.includes('stop'))) {
+ return AIResponses.bicycle.brake.slowDown;
+ } else if (answerLower.includes('brake')) {
+ return AIResponses.bicycle.brake.technical;
+ } else if (answerLower.includes('pedal') || answerLower.includes('chain') || answerLower.includes('wheel')) {
+ return AIResponses.bicycle.mechanics.pedalChainWheel;
} else if (answerLower.includes('gear') || answerLower.includes('speed')) {
- return "๐ Yes! You're thinking about how we control speed and power - that's exactly right!";
+ return AIResponses.bicycle.mechanics.gearSpeed;
+ } else if (answerLower.includes('slow') || answerLower.includes('stop')) {
+ return AIResponses.bicycle.mechanics.slowStop;
}
}
+ // CAR vs BICYCLE comparison
if (questionLower.includes('car') && questionLower.includes('bicycle')) {
if (answerLower.includes('engine')) {
- return "๏ฟฝ You're thinking about the engine - that's the power source! But I'm thinking of a specific part that works between the engine and wheels, kind of like how bike pedals connect to the chain.";
+ return AIResponses.car.comparison.engine;
} else if (answerLower.includes('gear') || answerLower.includes('transmission')) {
- return "๐ฏ Great thinking! You're absolutely on the right track with gears and transmission systems!";
+ return AIResponses.car.comparison.gearTransmission;
} else if (answerLower.includes('pedal') || answerLower.includes('brake')) {
- return "๐ฆถ Good connection! You're thinking about pedals in cars. There are actually multiple pedals that do different things!";
+ return AIResponses.car.comparison.pedalBrake;
}
}
+ // CAR BRAKE responses
+ if (questionLower.includes('slow') || questionLower.includes('stop') || questionLower.includes('car')) {
+ if (answerLower.includes('brake') && (answerLower.includes('pedal') || answerLower.includes('system'))) {
+ return AIResponses.car.brake.perfectAnswer;
+ } else if (answerLower.includes('brake') && !answerLower.includes('clutch')) {
+ return AIResponses.car.brake.justBrake;
+ } else if (answerLower.includes('wheel') || answerLower.includes('tire')) {
+ return AIResponses.car.brake.wheelTire;
+ } else if (answerLower.includes('pedal') && !answerLower.includes('brake')) {
+ return AIResponses.car.brake.pedal;
+ }
+ }
+
+ // CLUTCH responses
if (questionLower.includes('clutch') || questionLower.includes('gears') || questionLower.includes('switch gears')) {
if (answerLower.includes('clutch')) {
- return "๐ฏ Perfect! You know about the clutch! That's exactly what I was thinking of - the component that helps with smooth gear changes!";
+ return AIResponses.car.clutch.perfect;
} else if (answerLower.includes('transmission') || answerLower.includes('gearbox')) {
- return "๐ง Excellent! You're thinking about the transmission system. The clutch is the part that connects and disconnects the engine from the gearbox!";
+ return AIResponses.car.clutch.transmission;
} else if (answerLower.includes('separate') || answerLower.includes('disconnect')) {
- return "๐ Yes! You understand the separation concept - that's exactly what the clutch does!";
+ return AIResponses.car.clutch.separate;
+ } else if (answerLower.includes('different') && answerLower.includes('brake')) {
+ return AIResponses.car.clutch.different;
+ } else if (answerLower.includes('engine') && answerLower.includes('transmission')) {
+ return AIResponses.car.clutch.engineTransmission;
+ } else {
+ return AIResponses.car.clutch.general;
}
}
+ // TRAFFIC LIGHT / ENGINE RUNNING responses
if (questionLower.includes('traffic light') || questionLower.includes('stopped') || questionLower.includes('engine running')) {
if (answerLower.includes('clutch') || answerLower.includes('neutral')) {
- return "๐ฆ Brilliant! You understand that we need a way to keep the engine running while the car is stopped!";
+ return AIResponses.car.trafficLight.clutchNeutral;
+ } else if (answerLower.includes('disconnect') || answerLower.includes('separate')) {
+ return AIResponses.car.trafficLight.disconnect;
} else if (answerLower.includes('brake') || answerLower.includes('park')) {
- return "๐ You're thinking about stopping the car, which is important! But I'm thinking of how the engine can keep running while the wheels aren't moving.";
+ return AIResponses.car.trafficLight.brakePark;
}
}
- // Bird flight responses
+ // BIRD FLIGHT responses
if (questionLower.includes('bird') || questionLower.includes('wing') || questionLower.includes('fly')) {
if (answerLower.includes('push') || answerLower.includes('air') || answerLower.includes('lift')) {
- return "๏ฟฝ Fantastic! You understand that it's all about air and creating lift! That's exactly how flight works!";
+ return AIResponses.birds.pushAirLift;
} else if (answerLower.includes('feather') || answerLower.includes('airflow')) {
- return "โจ Brilliant! Feathers and airflow are absolutely key to how birds fly!";
+ return AIResponses.birds.featherAirflow;
} else if (answerLower.includes('flap') || answerLower.includes('move')) {
- return "๐ Perfect! Wing movement creates the forces that allow birds to fly!";
+ return AIResponses.birds.flapMove;
}
}
+ // MECHANICAL understanding responses
+ if (answerLower.includes('connect') || answerLower.includes('control')) {
+ return AIResponses.mechanical.connectControl;
+ }
+
// Generic responses based on answer quality and engagement
if (answer.length > 25) {
- return "๐ I love your detailed thinking! You're really exploring this concept thoroughly. That kind of curiosity is what leads to great discoveries!";
- } else if (answer.length > 10) {
- return "๐ Good observation! I can see you're thinking about this carefully. Your reasoning is developing nicely!";
+ return AIResponses.generic.veryDetailed;
+ } else if (answer.length > 15) {
+ return AIResponses.generic.detailed;
+ } else if (answer.length > 8) {
+ return AIResponses.generic.medium;
} else if (answer.length > 3) {
- return "๏ฟฝ Interesting thought! You're engaging with the concept. Can you help me understand your thinking a bit more?";
+ return AIResponses.generic.short;
} else {
- return "๐ค I see you're thinking about this! Feel free to share whatever comes to mind - there are no wrong answers here!";
+ return AIResponses.generic.veryShort;
}
}