🎯 Add Interactive AI Conversation System
Features added: - AI conversation detection when AI asks questions - Reply interface for children to respond to AI questions - Real-time conversational flow with chat bubbles - Natural conversation continuation until completion - Enhanced user engagement and learning interaction The system now detects when AI feedback contains questions and automatically provides a reply interface, creating true two-way educational conversations.
This commit is contained in:
@@ -1061,6 +1061,8 @@ class KidsAIExplorer {
|
||||
|
||||
// Check if AI is asking a question (contains question mark)
|
||||
const isAIQuestion = feedback.response.includes('?');
|
||||
console.log('AI Response:', feedback.response);
|
||||
console.log('Contains question?', isAIQuestion);
|
||||
|
||||
feedbackDiv.innerHTML = `
|
||||
<div class="ai-feedback ${feedbackClass}">
|
||||
@@ -1100,6 +1102,7 @@ class KidsAIExplorer {
|
||||
|
||||
// If AI asked a question, set up the reply functionality
|
||||
if (isAIQuestion) {
|
||||
console.log('Setting up AI conversation...');
|
||||
this.setupAIConversation(feedbackDiv);
|
||||
}
|
||||
|
||||
@@ -1119,9 +1122,12 @@ class KidsAIExplorer {
|
||||
}
|
||||
|
||||
setupAIConversation(feedbackDiv) {
|
||||
console.log('setupAIConversation called');
|
||||
const replyInput = feedbackDiv.querySelector('.ai-reply-input');
|
||||
const replyButton = feedbackDiv.querySelector('.reply-to-ai-btn');
|
||||
const conversationDiv = feedbackDiv.querySelector('.ai-conversation');
|
||||
|
||||
console.log('Reply elements:', { replyInput, replyButton, conversationDiv });
|
||||
|
||||
const handleReply = async () => {
|
||||
const userReply = replyInput.value.trim();
|
||||
|
||||
@@ -1561,6 +1561,9 @@ body {
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.2);
|
||||
padding-top: 15px;
|
||||
margin-top: 15px;
|
||||
/* Debug: make sure it's visible */
|
||||
min-height: 50px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.reply-input-section {
|
||||
|
||||
Reference in New Issue
Block a user