🔧 FIX: Remove duplicate questions from AI responses

PROBLEM: AI was generating follow-up questions AND system was asking pre-programmed questions
RESULT: Confusing double questions like 'Now, can you think about...' + '1) Do you know...'

SOLUTION:
- Modified AI prompt to NOT include follow-up questions
- AI now only provides encouragement and validation
- System handles question flow with pre-programmed sequence
- Cleaner, less cluttered conversation experience

BEFORE: 'Great thinking! Now, what do you think happens next? 🤖 1) Do you know...'
AFTER: 'Great thinking! You understand the concept perfectly! 🤖 1) Do you know...'
This commit is contained in:
root
2025-06-29 17:45:35 +02:00
parent 071916877c
commit 6a26fb7db4
2 changed files with 15 additions and 17 deletions

View File

@@ -176,9 +176,9 @@
}, 100);
</script>
<script src="translations.js?v=20250629173500"></script>
<script src="ai-responses.js?v=20250629173500"></script>
<script src="script-new.js?v=20250629173500"></script>
<script src="translations.js?v=20250629174500"></script>
<script src="ai-responses.js?v=20250629174500"></script>
<script src="script-new.js?v=20250629174500"></script>
<!-- Inline debugging script -->
<script>

View File

@@ -569,11 +569,10 @@ ANTWORT DES KINDES: "${answer}"
Deine Aufgabe ist es, eine ermutigende, pädagogische Antwort zu geben, die:
1. Das Kind für seine Antwort ermutigt (egal ob richtig oder falsch)
2. Auf ihrer spezifischen Antwort aufbaut
3. Ihr Denken erweitert, ohne die Antwort direkt zu verraten
4. Eine weitere durchdachte Frage stellt, um ihr Denken zu vertiefen
5. Verwende Emojis sparsam und altersgerecht
3. Ihr Denken würdigt und erweitert
4. Verwende Emojis sparsam und altersgerecht
Antworte in 2-3 Sätzen mit einer Folgefrage.` :
WICHTIG: Stelle KEINE Folgefragen - antworte nur mit Ermutigung und Bestätigung in 1-2 Sätzen.` :
`You are an educational AI assistant for children. A child just answered a question.
QUESTION: "${question}"
@@ -582,11 +581,10 @@ CHILD'S ANSWER: "${answer}"
Your task is to provide an encouraging, educational response that:
1. Encourages the child for their answer (regardless of right or wrong)
2. Builds on their specific answer
3. Expands their thinking without giving away the answer directly
4. Asks a thoughtful follow-up question to deepen their thinking
5. Use emojis sparingly and age-appropriately
3. Acknowledges and expands their thinking
4. Use emojis sparingly and age-appropriately
Respond in 2-3 sentences with a follow-up question.`;
IMPORTANT: Do NOT ask follow-up questions - only respond with encouragement and validation in 1-2 sentences.`;
// Try OpenAI first
if (process.env.OPENAI_API_KEY) {
@@ -624,16 +622,16 @@ Respond in 2-3 sentences with a follow-up question.`;
if (answerLower.includes("don't know") || answerLower.includes("no idea") || answer.trim().length < 3) {
fallbackResponse = isGerman ?
"🌟 Das ist völlig in Ordnung! Nicht zu wissen bedeutet, dass wir zusammen etwas Neues entdecken können. Wenn du raten müsstest, was denkst du könnte wichtig sein?" :
"🌟 That's completely okay! Not knowing means we get to discover something new together. If you had to guess, what do you think might be important?";
"🌟 Das ist völlig in Ordnung! Nicht zu wissen bedeutet, dass wir zusammen etwas Neues entdecken können." :
"🌟 That's completely okay! Not knowing means we get to discover something new together.";
} else if (answer.length < 15) {
fallbackResponse = isGerman ?
`💡 Interessante Überlegung zu "${answer}"! Du denkst in die richtige Richtung. Kannst du mir mehr darüber erzählen, wie das funktionieren könnte?` :
`💡 Interesting thinking about "${answer}"! You're on the right track. Can you tell me more about how that might work?`;
`💡 Interessante Überlegung zu "${answer}"! Du denkst in die richtige Richtung.` :
`💡 Interesting thinking about "${answer}"! You're on the right track.`;
} else {
fallbackResponse = isGerman ?
`🎯 Ausgezeichnete Antwort! Du denkst wirklich gut über "${answer}" nach. Das zeigt, dass du das Konzept verstehst. Was denkst du passiert als nächstes?` :
`🎯 Excellent answer! You're really thinking well about "${answer}". This shows you understand the concept. What do you think happens next?`;
`🎯 Ausgezeichnete Antwort! Du denkst wirklich gut über "${answer}" nach. Das zeigt, dass du das Konzept verstehst.` :
`🎯 Excellent answer! You're really thinking well about "${answer}". This shows you understand the concept.`;
}
res.json({