diff --git a/html/kidsai/script-new.js b/html/kidsai/script-new.js index 0fa31e5..cfc591d 100644 --- a/html/kidsai/script-new.js +++ b/html/kidsai/script-new.js @@ -687,8 +687,16 @@ class KidsAIExplorer { // For pure "don't know" responses with Socratic guidance, continue to next question immediately this.continueToNextQuestion(); } else { - // For substantial answers, show choice buttons - this.addContinueChoiceButtons(); + // Check if AI response contains a question that needs answering + const hasQuestion = data.response && data.response.includes('?'); + + if (hasQuestion) { + // AI asked a follow-up question, provide input area + this.addUserInputArea(); + } else { + // No question in response, show choice buttons + this.addContinueChoiceButtons(); + } } }, 1500); } else { @@ -1100,6 +1108,13 @@ class KidsAIExplorer { // Add input area for user to respond addUserInputArea() { + // Remove any existing input areas to avoid duplicates + const existingInputs = this.conversationContainer.querySelectorAll('.user-input-container'); + existingInputs.forEach(input => input.remove()); + + // Generate unique ID for this input + const inputId = `chat-input-${Date.now()}`; + const inputContainer = document.createElement('div'); inputContainer.className = 'user-input-container'; inputContainer.innerHTML = ` @@ -1107,9 +1122,9 @@ class KidsAIExplorer {
💭 ${this.getTranslation('share-thoughts') || (this.currentLanguage === 'de' ? 'Teile deine Gedanken mit:' : 'Share your thoughts:')}