🎯 Fix conversational flow and remove redundant encouragements
- Enhanced 'I don't know' detection to include German variants (ich weiß es nicht, warum, etc.)
- When child says 'I don't know', system now directly provides Socratic guidance instead of asking for deeper exploration
- Removed redundant phrases like 'Danke, dass du deine Gedanken geteilt hast' for obvious interactions
- Improved fallback responses to be more concise and natural ('Perfekt! Lass uns das gemeinsam herausfinden.')
- Updated both chat mode and step-by-step mode to have consistent behavior
- System now automatically continues to next question for 'don't know' responses, only shows choice buttons for substantial answers
This creates a smoother, more natural learning flow without interrupting the Socratic discovery process.
This commit is contained in:
@@ -418,7 +418,11 @@ class KidsAIExplorer {
|
|||||||
// Analyze the answer to determine the appropriate response type
|
// Analyze the answer to determine the appropriate response type
|
||||||
const answerLower = answer.toLowerCase().trim();
|
const answerLower = answer.toLowerCase().trim();
|
||||||
const isNegative = answerLower === 'no' || answerLower === 'nein' || answerLower === 'nope' || answerLower === 'nei';
|
const isNegative = answerLower === 'no' || answerLower === 'nein' || answerLower === 'nope' || answerLower === 'nei';
|
||||||
const isDontKnow = answerLower.includes("don't know") || answerLower.includes('weiß nicht') || answerLower.includes('keine ahnung') || answer.trim().length < 3;
|
const isDontKnow = answerLower.includes("don't know") || answerLower.includes('weiß nicht') || answerLower.includes('keine ahnung') ||
|
||||||
|
answerLower.includes('ich weiß es nicht') || answerLower.includes('weis es nicht') || answerLower.includes('weiss es nicht') ||
|
||||||
|
answerLower.includes('i dont know') || answerLower.includes("i don't know") ||
|
||||||
|
answerLower === 'warum' || answerLower === 'why' || answerLower === 'warum?' || answerLower === 'why?' ||
|
||||||
|
(answer.trim().length < 5 && (answerLower.includes('weiß') || answerLower.includes('know')));
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
@@ -427,8 +431,8 @@ class KidsAIExplorer {
|
|||||||
console.log('📤 Sending guidance request to /api/ask for Socratic questioning');
|
console.log('📤 Sending guidance request to /api/ask for Socratic questioning');
|
||||||
|
|
||||||
const guidancePrompt = this.currentLanguage === 'de'
|
const guidancePrompt = this.currentLanguage === 'de'
|
||||||
? `Ein Kind hat "${answer}" geantwortet auf die Frage "${currentQuestion}". Führe es durch Socratic Fragen zur Entdeckung, ohne direkte Antworten zu geben.`
|
? `Ein Kind hat "${answer}" geantwortet auf die Frage "${currentQuestion}". Das Kind weiß die Antwort nicht. Führe es durch 2-3 aufbauende Socratic Fragen zur Entdeckung, ohne direkte Antworten zu geben. Beginne mit einfachen Beobachtungen, die das Kind kennt.`
|
||||||
: `A child answered "${answer}" to the question "${currentQuestion}". Guide them through Socratic questions to discovery without giving direct answers.`;
|
: `A child answered "${answer}" to the question "${currentQuestion}". The child doesn't know the answer. Guide them through 2-3 building Socratic questions to discovery without giving direct answers. Start with simple observations the child would know.`;
|
||||||
|
|
||||||
response = await fetch('/api/ask', {
|
response = await fetch('/api/ask', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -557,7 +561,11 @@ class KidsAIExplorer {
|
|||||||
// Analyze the answer to determine the appropriate response type
|
// Analyze the answer to determine the appropriate response type
|
||||||
const answerLower = answer.toLowerCase().trim();
|
const answerLower = answer.toLowerCase().trim();
|
||||||
const isNegative = answerLower === 'no' || answerLower === 'nein' || answerLower === 'nope' || answerLower === 'nei';
|
const isNegative = answerLower === 'no' || answerLower === 'nein' || answerLower === 'nope' || answerLower === 'nei';
|
||||||
const isDontKnow = answerLower.includes("don't know") || answerLower.includes('weiß nicht') || answerLower.includes('keine ahnung') || answer.trim().length < 3;
|
const isDontKnow = answerLower.includes("don't know") || answerLower.includes('weiß nicht') || answerLower.includes('keine ahnung') ||
|
||||||
|
answerLower.includes('ich weiß es nicht') || answerLower.includes('weis es nicht') || answerLower.includes('weiss es nicht') ||
|
||||||
|
answerLower.includes('i dont know') || answerLower.includes("i don't know") ||
|
||||||
|
answerLower === 'warum' || answerLower === 'why' || answerLower === 'warum?' || answerLower === 'why?' ||
|
||||||
|
(answer.trim().length < 5 && (answerLower.includes('weiß') || answerLower.includes('know')));
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
|
|
||||||
@@ -566,8 +574,8 @@ class KidsAIExplorer {
|
|||||||
console.log('📤 Sending guidance request to /api/ask for Socratic questioning');
|
console.log('📤 Sending guidance request to /api/ask for Socratic questioning');
|
||||||
|
|
||||||
const guidancePrompt = this.currentLanguage === 'de'
|
const guidancePrompt = this.currentLanguage === 'de'
|
||||||
? `Ein Kind hat "${answer}" geantwortet auf die Frage "${currentQuestion}" über das Thema "${originalQuestion}". Führe es durch Socratic Fragen zur Entdeckung, ohne direkte Antworten zu geben.`
|
? `Ein Kind hat "${answer}" geantwortet auf die Frage "${currentQuestion}" über das Thema "${originalQuestion}". Das Kind weiß die Antwort nicht. Führe es durch 2-3 aufbauende Socratic Fragen zur Entdeckung, ohne direkte Antworten zu geben. Beginne mit einfachen Beobachtungen, die das Kind kennt.`
|
||||||
: `A child answered "${answer}" to the question "${currentQuestion}" about the topic "${originalQuestion}". Guide them through Socratic questions to discovery without giving direct answers.`;
|
: `A child answered "${answer}" to the question "${currentQuestion}" about the topic "${originalQuestion}". The child doesn't know the answer. Guide them through 2-3 building Socratic questions to discovery without giving direct answers. Start with simple observations the child would know.`;
|
||||||
|
|
||||||
response = await fetch('/api/ask', {
|
response = await fetch('/api/ask', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -647,9 +655,15 @@ class KidsAIExplorer {
|
|||||||
this.scrollToBottomSmoothly();
|
this.scrollToBottomSmoothly();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
// Add choice buttons after AI response
|
// Determine next action based on response type
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.addContinueChoiceButtons();
|
if (data.guidance && data.guidance.steps && (isNegative || isDontKnow)) {
|
||||||
|
// For "don't know" responses with Socratic guidance, continue to next question immediately
|
||||||
|
this.continueToNextQuestion();
|
||||||
|
} else {
|
||||||
|
// For substantial answers, show choice buttons
|
||||||
|
this.addContinueChoiceButtons();
|
||||||
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(data.error || 'Failed to generate response');
|
throw new Error(data.error || 'Failed to generate response');
|
||||||
|
|||||||
@@ -626,18 +626,19 @@ IMPORTANT:
|
|||||||
const answerLower = answer.toLowerCase();
|
const answerLower = answer.toLowerCase();
|
||||||
let fallbackResponse;
|
let fallbackResponse;
|
||||||
|
|
||||||
if (answerLower.includes("don't know") || answerLower.includes("no idea") || answer.trim().length < 3) {
|
if (answerLower.includes("don't know") || answerLower.includes("weiß nicht") || answerLower.includes("keine ahnung") ||
|
||||||
|
answerLower.includes("ich weiß es nicht") || answerLower === "warum" || answerLower === "why" || answer.trim().length < 5) {
|
||||||
fallbackResponse = isGerman ?
|
fallbackResponse = isGerman ?
|
||||||
"🌟 Das ist völlig in Ordnung! Nicht zu wissen bedeutet, dass wir zusammen etwas Neues entdecken können." :
|
"🌟 Perfekt! Lass uns das gemeinsam herausfinden." :
|
||||||
"🌟 That's completely okay! Not knowing means we get to discover something new together.";
|
"🌟 Perfect! Let's figure this out together.";
|
||||||
} else if (answer.length < 15) {
|
} else if (answer.length < 15) {
|
||||||
fallbackResponse = isGerman ?
|
fallbackResponse = isGerman ?
|
||||||
`💡 Interessante Überlegung zu "${answer}"! Du denkst in die richtige Richtung.` :
|
`💡 Guter Gedanke! Du bist auf dem richtigen Weg.` :
|
||||||
`💡 Interesting thinking about "${answer}"! You're on the right track.`;
|
`💡 Good thinking! You're on the right track.`;
|
||||||
} else {
|
} else {
|
||||||
fallbackResponse = isGerman ?
|
fallbackResponse = isGerman ?
|
||||||
`🎯 Ausgezeichnete Antwort! Du denkst wirklich gut über "${answer}" nach. Das zeigt, dass du das Konzept verstehst.` :
|
`🎯 Ausgezeichnet! Du denkst wirklich wissenschaftlich.` :
|
||||||
`🎯 Excellent answer! You're really thinking well about "${answer}". This shows you understand the concept.`;
|
`🎯 Excellent! You're thinking like a real scientist.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
|
|||||||
Reference in New Issue
Block a user