🎯 IMPROVE: Contextual encouragements and pneumatic responses
- Added pneumatic hammer responses to ai-responses.js for engineering questions - Enhanced server encouragements to be contextual based on question topic - Removed generic 'smart question' responses - Added specific responses for compressed air, air pressure, direction, etc. - Server now provides topic-specific encouragements (pneumatic, bicycle, car) - Better mechanical engineering focused feedback for students
This commit is contained in:
@@ -75,6 +75,16 @@ const AIResponses = {
|
||||
connectControl: "🔧 Excellent mechanical thinking! You understand that cars have systems that connect and control different parts!"
|
||||
},
|
||||
|
||||
// Pneumatic tools and compressed air
|
||||
pneumatic: {
|
||||
compressedAir: "🔧 Excellent! You understand that compressed air is the key! That's exactly right - pneumatic tools use compressed air as their power source!",
|
||||
airPressure: "💨 Perfect! Air pressure is exactly what makes pneumatic tools so powerful. You're thinking like an engineer!",
|
||||
direction: "🎯 Great reasoning! You understand that directing the compressed air in a specific direction creates the force. That's brilliant mechanical thinking!",
|
||||
balloon: "🎈 Fantastic connection! Just like a balloon, pneumatic tools use air pressure - but instead of inflating, they use that pressure to create powerful motion!",
|
||||
release: "⚡ Yes! The controlled release of compressed air is what creates the hammer's powerful strikes. You've got the concept!",
|
||||
general: "🔨 You're thinking about the mechanics of pneumatic tools - that's exactly the kind of engineering thinking we need!"
|
||||
},
|
||||
|
||||
// Generic responses based on answer quality (last resort)
|
||||
generic: {
|
||||
veryDetailed: "🌟 I appreciate your detailed explanation! You're really working through this systematically.",
|
||||
|
||||
@@ -671,6 +671,23 @@ class KidsAIExplorer {
|
||||
return AIResponses.mechanical.connectControl;
|
||||
}
|
||||
|
||||
// PNEUMATIC tools responses
|
||||
if (questionLower.includes('pneumatic') || questionLower.includes('compressed air') || questionLower.includes('air hammer')) {
|
||||
if (answerLower.includes('compress') && answerLower.includes('air')) {
|
||||
return AIResponses.pneumatic.compressedAir;
|
||||
} else if (answerLower.includes('air pressure') || answerLower.includes('pressure')) {
|
||||
return AIResponses.pneumatic.airPressure;
|
||||
} else if (answerLower.includes('direction') || answerLower.includes('releasing')) {
|
||||
return AIResponses.pneumatic.direction;
|
||||
} else if (answerLower.includes('balloon') || answerLower.includes('inflate')) {
|
||||
return AIResponses.pneumatic.balloon;
|
||||
} else if (answerLower.includes('release') || answerLower.includes('strikes')) {
|
||||
return AIResponses.pneumatic.release;
|
||||
} else {
|
||||
return AIResponses.pneumatic.general;
|
||||
}
|
||||
}
|
||||
|
||||
// Generic responses based on answer quality and engagement
|
||||
if (answer.length > 25) {
|
||||
return AIResponses.generic.veryDetailed;
|
||||
|
||||
@@ -157,7 +157,7 @@ async function getOpenAIGuidance(question, language) {
|
||||
return {
|
||||
type: 'ai-powered',
|
||||
steps: steps,
|
||||
encouragement: getRandomEncouragement(language),
|
||||
encouragement: getRandomEncouragement(language, question),
|
||||
source: 'OpenAI GPT-3.5'
|
||||
};
|
||||
|
||||
@@ -253,7 +253,7 @@ Format: 1. [question] 2. [question] 3. [question]`;
|
||||
return {
|
||||
type: 'ai-powered',
|
||||
steps: steps,
|
||||
encouragement: getRandomEncouragement(language),
|
||||
encouragement: getRandomEncouragement(language, question),
|
||||
source: `Hugging Face (${model.split('/')[1]})`
|
||||
};
|
||||
}
|
||||
@@ -339,7 +339,7 @@ function getFallbackGuidance(question, language) {
|
||||
return {
|
||||
type: 'topic-specific',
|
||||
steps: birdQuestions,
|
||||
encouragement: getRandomEncouragement(language),
|
||||
encouragement: getRandomEncouragement(language, question),
|
||||
source: 'Educational Framework'
|
||||
};
|
||||
}
|
||||
@@ -358,7 +358,7 @@ function getFallbackGuidance(question, language) {
|
||||
return {
|
||||
type: 'topic-specific',
|
||||
steps: skyQuestions,
|
||||
encouragement: getRandomEncouragement(language),
|
||||
encouragement: getRandomEncouragement(language, question),
|
||||
source: 'Educational Framework'
|
||||
};
|
||||
}
|
||||
@@ -379,24 +379,58 @@ function getFallbackGuidance(question, language) {
|
||||
return {
|
||||
type: 'rule-based',
|
||||
steps: fallbackSteps,
|
||||
encouragement: getRandomEncouragement(language),
|
||||
encouragement: getRandomEncouragement(language, question),
|
||||
source: 'Educational Framework'
|
||||
};
|
||||
}
|
||||
|
||||
// Get random encouragement
|
||||
function getRandomEncouragement(language) {
|
||||
const encouragements = language === 'de' ? [
|
||||
"Großartige Frage! Du denkst wie ein echter Forscher! 🔬",
|
||||
"Super! Lass uns das zusammen herausfinden! 🚀",
|
||||
"Wow, das ist eine kluge Frage! 🤔",
|
||||
"Du bist auf dem richtigen Weg! 🌟"
|
||||
] : [
|
||||
"Great question! You're thinking like a real scientist! 🔬",
|
||||
"Awesome! Let's figure this out together! 🚀",
|
||||
"Wow, that's a smart question! 🤔",
|
||||
"You're on the right track! 🌟"
|
||||
];
|
||||
// Get contextual encouragement based on question content
|
||||
function getRandomEncouragement(language, question = '') {
|
||||
const questionLower = question.toLowerCase();
|
||||
|
||||
// Contextual encouragements based on question topic
|
||||
let encouragements;
|
||||
|
||||
if (questionLower.includes('pneumatic') || questionLower.includes('air hammer')) {
|
||||
encouragements = language === 'de' ? [
|
||||
"Faszinierende Frage über pneumatische Werkzeuge! 🔧",
|
||||
"Du denkst wie ein Ingenieur! Lass uns das erforschen! ⚙️",
|
||||
"Großartig! Mechanische Systeme sind spannend! 🛠️"
|
||||
] : [
|
||||
"Fascinating question about pneumatic tools! 🔧",
|
||||
"You're thinking like an engineer! Let's explore this! ⚙️",
|
||||
"Great! Mechanical systems are exciting! 🛠️"
|
||||
];
|
||||
} else if (questionLower.includes('bicycle') || questionLower.includes('bike')) {
|
||||
encouragements = language === 'de' ? [
|
||||
"Perfekt! Fahrräder sind großartige Lernwerkzeuge! 🚴♂️",
|
||||
"Ausgezeichnet! Du verstehst mechanische Systeme! ⚙️"
|
||||
] : [
|
||||
"Perfect! Bicycles are great learning tools! 🚴♂️",
|
||||
"Excellent! You understand mechanical systems! ⚙️"
|
||||
];
|
||||
} else if (questionLower.includes('car') || questionLower.includes('automobile')) {
|
||||
encouragements = language === 'de' ? [
|
||||
"Interessant! Autos haben faszinierende Mechanismen! <20>",
|
||||
"Du erforschst komplexe Systeme! 🔧"
|
||||
] : [
|
||||
"Interesting! Cars have fascinating mechanisms! 🚗",
|
||||
"You're exploring complex systems! 🔧"
|
||||
];
|
||||
} else {
|
||||
// General encouragements (more varied and less generic)
|
||||
encouragements = language === 'de' ? [
|
||||
"Interessante Frage! Lass uns das erforschen! <20>",
|
||||
"Du denkst wie ein echter Forscher! 🔬",
|
||||
"Fantastisch! Lass uns das zusammen herausfinden! 🚀",
|
||||
"Neugier ist der Schlüssel zum Lernen! 🌟"
|
||||
] : [
|
||||
"Interesting question! Let's explore this! 🔍",
|
||||
"You're thinking like a real researcher! 🔬",
|
||||
"Fantastic! Let's figure this out together! 🚀",
|
||||
"Curiosity is the key to learning! 🌟"
|
||||
];
|
||||
}
|
||||
|
||||
return encouragements[Math.floor(Math.random() * encouragements.length)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user