Fix critical chat mode confusion detection bug

CRITICAL FIXES:
- Fixed isPureDontKnow logic in chat mode to properly exclude confusion/help requests
- Added detection for repetition frustration: 'hab ich doch schon gesagt', 'already said that'
- Enhanced confusion detection in both chat and step-by-step modes
- Added topic-specific fallback explanations for bird flight questions
- Ensures confused/frustrated children get explanations instead of more questions

This resolves the issue where children expressing confusion in chat mode were still getting Socratic questions instead of helpful explanations.
This commit is contained in:
root
2025-06-30 15:28:06 +02:00
parent fe8209427d
commit 7e8ab4bae1
2 changed files with 9 additions and 1 deletions

View File

@@ -442,6 +442,8 @@ class KidsAIExplorer {
answerLower.includes('verstehe den zusammenhang nicht') || answerLower.includes("don't understand the connection") || answerLower.includes('verstehe den zusammenhang nicht') || answerLower.includes("don't understand the connection") ||
answerLower.includes('das erklärt nicht') || answerLower.includes("that doesn't explain") || answerLower.includes('das erklärt nicht') || answerLower.includes("that doesn't explain") ||
answerLower.includes('das beantwortet nicht') || answerLower.includes("that doesn't answer") || answerLower.includes('das beantwortet nicht') || answerLower.includes("that doesn't answer") ||
answerLower.includes('hab ich doch schon gesagt') || answerLower.includes('already said that') ||
answerLower.includes('schon gesagt') || answerLower.includes('already told you') ||
answerLower.includes('fällt mir nicht ein') || answerLower.includes("can't think of") || answerLower.includes('fällt mir nicht ein') || answerLower.includes("can't think of") ||
answerLower.includes('mehr fällt mir nicht ein') || isAskingForHelp; answerLower.includes('mehr fällt mir nicht ein') || isAskingForHelp;
@@ -639,6 +641,8 @@ class KidsAIExplorer {
answerLower.includes('verstehe den zusammenhang nicht') || answerLower.includes("don't understand the connection") || answerLower.includes('verstehe den zusammenhang nicht') || answerLower.includes("don't understand the connection") ||
answerLower.includes('das erklärt nicht') || answerLower.includes("that doesn't explain") || answerLower.includes('das erklärt nicht') || answerLower.includes("that doesn't explain") ||
answerLower.includes('das beantwortet nicht') || answerLower.includes("that doesn't answer") || answerLower.includes('das beantwortet nicht') || answerLower.includes("that doesn't answer") ||
answerLower.includes('hab ich doch schon gesagt') || answerLower.includes('already said that') ||
answerLower.includes('schon gesagt') || answerLower.includes('already told you') ||
answerLower.includes('fällt mir nicht ein') || answerLower.includes("can't think of") || answerLower.includes('fällt mir nicht ein') || answerLower.includes("can't think of") ||
answerLower.includes('mehr fällt mir nicht ein') || isAskingForHelp; answerLower.includes('mehr fällt mir nicht ein') || isAskingForHelp;
@@ -651,7 +655,7 @@ class KidsAIExplorer {
); );
// Pure "don't know" without additional thinking // Pure "don't know" without additional thinking
const isPureDontKnow = (hasDontKnowPhrase || isOnlyWhyQuestion || answer.trim().length < 5) && !hasSubstantialThinking; const isPureDontKnow = (hasDontKnowPhrase || isOnlyWhyQuestion || answer.trim().length < 5) && !hasSubstantialThinking && !isExpressingConfusion && !isAskingForHelp;
// Check if child is asking for a definition or explanation // Check if child is asking for a definition or explanation
const isAskingForDefinition = answerLower.startsWith('was ist') || answerLower.startsWith('what is') || const isAskingForDefinition = answerLower.startsWith('was ist') || answerLower.startsWith('what is') ||

View File

@@ -608,6 +608,10 @@ The child is expressing confusion and needs help understanding. Provide a clear,
confusionFallback = isGerman ? confusionFallback = isGerman ?
'Wasser ist "nass", weil es eine Flüssigkeit ist, die an anderen Oberflächen haftet und sie benetzt. Wenn Wassermoleküle auf deine Haut oder andere Materialien treffen, bleiben sie dort haften und fühlen sich feucht an. Das ist das Gefühl, das wir "nass" nennen! Du kannst das ausprobieren: Tropfe etwas Wasser auf verschiedene Materialien und schau, wie es sich verhält. 💧' : 'Wasser ist "nass", weil es eine Flüssigkeit ist, die an anderen Oberflächen haftet und sie benetzt. Wenn Wassermoleküle auf deine Haut oder andere Materialien treffen, bleiben sie dort haften und fühlen sich feucht an. Das ist das Gefühl, das wir "nass" nennen! Du kannst das ausprobieren: Tropfe etwas Wasser auf verschiedene Materialien und schau, wie es sich verhält. 💧' :
'Water is "wet" because it\'s a liquid that sticks to other surfaces and makes them moist. When water molecules touch your skin or other materials, they stay there and feel damp. That\'s the feeling we call "wet"! You can try this: drop some water on different materials and see how it behaves. 💧'; 'Water is "wet" because it\'s a liquid that sticks to other surfaces and makes them moist. When water molecules touch your skin or other materials, they stay there and feel damp. That\'s the feeling we call "wet"! You can try this: drop some water on different materials and see how it behaves. 💧';
} else if (topicLower.includes('vögel') || topicLower.includes('birds') || topicLower.includes('fliegen') || topicLower.includes('fly') || topicLower.includes('flügel') || topicLower.includes('wings')) {
confusionFallback = isGerman ?
'Vögel können fliegen, weil sie besondere Körperteile haben! Ihre Flügel sind leicht aber stark, ihre Knochen sind hohl (wie Strohhalme), und sie haben kräftige Brustmuskeln, die die Flügel bewegen. Wenn sie die Flügel auf und ab schlagen, drücken sie die Luft nach unten, und das hebt sie nach oben - wie beim Schwimmen, aber in der Luft! Du kannst das ausprobieren: Wedel mit den Armen und spür, wie du die Luft bewegst! 🐦' :
'Birds can fly because they have special body parts! Their wings are light but strong, their bones are hollow (like straws), and they have powerful chest muscles that move the wings. When they flap their wings up and down, they push air downward, and that lifts them up - like swimming, but in the air! You can try this: wave your arms and feel how you move the air! 🐦';
} else if (topicLower.includes('regenbogen') || topicLower.includes('rainbow') || topicLower.includes('farben') || topicLower.includes('colors')) { } else if (topicLower.includes('regenbogen') || topicLower.includes('rainbow') || topicLower.includes('farben') || topicLower.includes('colors')) {
confusionFallback = isGerman ? confusionFallback = isGerman ?
'Das passiert, weil Sonnenlicht aus vielen verschiedenen Farben besteht! Wenn Licht durch Regentropfen geht, werden diese Farben getrennt - wie bei einem Prisma. Du kannst das selbst ausprobieren: Halte ein Glas Wasser ins Sonnenlicht und schau, welche Farben entstehen! 🌈' : 'Das passiert, weil Sonnenlicht aus vielen verschiedenen Farben besteht! Wenn Licht durch Regentropfen geht, werden diese Farben getrennt - wie bei einem Prisma. Du kannst das selbst ausprobieren: Halte ein Glas Wasser ins Sonnenlicht und schau, welche Farben entstehen! 🌈' :