|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SmartLearn - Personalized Study Plan</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
|
<style>
|
|
body, html {
|
|
margin: 0;
|
|
padding: 0;
|
|
font-family: 'Poppins', sans-serif;
|
|
background: url('https://wallpapercave.com/wp/ew0V5jf.jpg') no-repeat center center fixed;
|
|
background-size: cover;
|
|
position: relative;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
body::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.2);
|
|
z-index: 1;
|
|
}
|
|
.container {
|
|
position: relative;
|
|
z-index: 2;
|
|
background-color: rgba(241, 241, 241, 0.2);
|
|
border-radius: 20px;
|
|
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
|
padding: 40px;
|
|
width: 90%;
|
|
max-width: 800px;
|
|
}
|
|
.back-button {
|
|
position: absolute;
|
|
top: 20px;
|
|
left: 20px;
|
|
background-color: #007bff;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
cursor: pointer;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-size: 18px;
|
|
transition: background-color 0.3s;
|
|
z-index: 3;
|
|
}
|
|
.back-button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
h1 {
|
|
text-align: center;
|
|
color: #333;
|
|
margin-bottom: 30px;
|
|
font-weight: 600;
|
|
}
|
|
.study-plan-form {
|
|
display: grid;
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
.form-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
label {
|
|
margin-bottom: 5px;
|
|
font-weight: 500;
|
|
color: white;
|
|
}
|
|
input, select {
|
|
padding: 10px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 5px;
|
|
font-size: 16px;
|
|
}
|
|
button {
|
|
background-color: #28a745;
|
|
color: white;
|
|
border: none;
|
|
padding: 12px 20px;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 16px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
button:hover {
|
|
background-color: #218838;
|
|
}
|
|
.chat-container {
|
|
background-color: #f8f9fa;
|
|
border-radius: 10px;
|
|
padding: 20px;
|
|
max-height: 300px;
|
|
overflow-y: auto;
|
|
}
|
|
.chat-messages {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.message {
|
|
margin-bottom: 15px;
|
|
padding: 10px;
|
|
border-radius: 10px;
|
|
max-width: 80%;
|
|
}
|
|
.user-message {
|
|
align-self: flex-end;
|
|
background-color: #007bff;
|
|
color: white;
|
|
}
|
|
.ai-message {
|
|
align-self: flex-start;
|
|
background-color: #e9ecef;
|
|
color: #333;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<button class="back-button" onclick="goBack()"><i class="fas fa-arrow-left"></i></button>
|
|
<h1><i class="fas fa-graduation-cap"></i> Personalized Study Plan</h1>
|
|
<div class="study-plan-form">
|
|
<div class="form-group">
|
|
<label for="subjects"><i class="fas fa-book"></i> Subjects (comma-separated):</label>
|
|
<input type="text" id="subjects" placeholder="Math, Science, History">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="available-time"><i class="fas fa-clock"></i> Available study time per day (hours):</label>
|
|
<input type="number" id="available-time" min="1" max="24" value="2">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="goal"><i class="fas fa-bullseye"></i> Study goal:</label>
|
|
<input type="text" id="goal" placeholder="Prepare for final exams">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="area-lag"><i class="fas fa-exclamation-triangle"></i> Areas of Lag (comma-separated):</label>
|
|
<input type="text" id="area-lag" placeholder="Algebra, Thermodynamics">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="learning-style"><i class="fas fa-brain"></i> Preferred learning style:</label>
|
|
<select id="learning-style">
|
|
<option value="visual">Visual</option>
|
|
<option value="auditory">Auditory</option>
|
|
<option value="reading">Reading/Writing</option>
|
|
<option value="kinesthetic">Kinesthetic</option>
|
|
</select>
|
|
</div>
|
|
<button onclick="generateStudyPlan()"><i class="fas fa-magic"></i> Generate Study Plan</button>
|
|
</div>
|
|
<div class="chat-container">
|
|
<div id="chat-messages" class="chat-messages"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const chatMessages = document.getElementById('chat-messages');
|
|
|
|
function addMessage(content, isUser) {
|
|
const messageDiv = document.createElement('div');
|
|
messageDiv.className = `message ${isUser ? 'user-message' : 'ai-message'}`;
|
|
messageDiv.innerHTML = content;
|
|
chatMessages.appendChild(messageDiv);
|
|
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
}
|
|
|
|
function generateStudyPlan() {
|
|
const subjects = document.getElementById('subjects').value;
|
|
const availableTime = document.getElementById('available-time').value;
|
|
const goal = document.getElementById('goal').value;
|
|
const areaLag = document.getElementById('area-lag').value;
|
|
const learningStyle = document.getElementById('learning-style').value;
|
|
|
|
const userInput = `Subjects: ${subjects}, Available time: ${availableTime} hours, Goal: ${goal}, Areas of Lag: ${areaLag}, Learning style: ${learningStyle}`;
|
|
addMessage(`Generating study plan for: ${userInput}`, true);
|
|
|
|
|
|
fetch('/generate_study_plan', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({
|
|
subjects: subjects,
|
|
hours: availableTime,
|
|
areaLag: areaLag,
|
|
goal: goal,
|
|
learningStyle: learningStyle
|
|
})
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
addMessage(data.study_plan, false);
|
|
})
|
|
.catch(error => {
|
|
addMessage('Error generating study plan. Please try again.', false);
|
|
console.error('Error:', error);
|
|
});
|
|
}
|
|
|
|
|
|
addMessage("Welcome! Fill out the form above to generate your personalized study plan.", false);
|
|
|
|
function goBack() {
|
|
window.history.back();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|