✅ REFACTOR: Separate AI prompts into external file
- Created ai-responses.js to store all AI response prompts - Refactored generateContextualResponse() to use external AIResponses object - Added ai-responses.js script to index.html - Enhanced brake-specific responses for bicycle and car questions - Improved maintainability and prevents script corruption during edits - All contextual responses now centralized in structured object
This commit is contained in:
91
html/kidsai/ai-responses.js
Normal file
91
html/kidsai/ai-responses.js
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user