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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>AI Study Helper | Exam Question Generator</title>
|
7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
8 |
+
<style>
|
9 |
+
:root {
|
10 |
+
--primary-color: #4361ee;
|
11 |
+
--secondary-color: #3f37c9;
|
12 |
+
--accent-color: #4895ef;
|
13 |
+
--light-color: #f8f9fa;
|
14 |
+
--dark-color: #212529;
|
15 |
+
--success-color: #4cc9f0;
|
16 |
+
--warning-color: #f72585;
|
17 |
+
}
|
18 |
+
|
19 |
+
* {
|
20 |
+
margin: 0;
|
21 |
+
padding: 0;
|
22 |
+
box-sizing: border-box;
|
23 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
24 |
+
}
|
25 |
+
|
26 |
+
body {
|
27 |
+
background-color: #f5f7fa;
|
28 |
+
color: var(--dark-color);
|
29 |
+
line-height: 1.6;
|
30 |
+
display: flex;
|
31 |
+
flex-direction: column;
|
32 |
+
min-height: 100vh;
|
33 |
+
}
|
34 |
+
|
35 |
+
header {
|
36 |
+
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
|
37 |
+
color: white;
|
38 |
+
padding: 1.5rem 0;
|
39 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
40 |
+
}
|
41 |
+
|
42 |
+
.container {
|
43 |
+
width: 90%;
|
44 |
+
max-width: 1200px;
|
45 |
+
margin: 0 auto;
|
46 |
+
}
|
47 |
+
|
48 |
+
.header-content {
|
49 |
+
display: flex;
|
50 |
+
justify-content: space-between;
|
51 |
+
align-items: center;
|
52 |
+
}
|
53 |
+
|
54 |
+
.logo {
|
55 |
+
font-size: 1.8rem;
|
56 |
+
font-weight: 700;
|
57 |
+
display: flex;
|
58 |
+
align-items: center;
|
59 |
+
gap: 0.5rem;
|
60 |
+
}
|
61 |
+
|
62 |
+
.logo i {
|
63 |
+
color: var(--accent-color);
|
64 |
+
}
|
65 |
+
|
66 |
+
nav ul {
|
67 |
+
display: flex;
|
68 |
+
list-style: none;
|
69 |
+
gap: 1.5rem;
|
70 |
+
}
|
71 |
+
|
72 |
+
nav a {
|
73 |
+
color: white;
|
74 |
+
text-decoration: none;
|
75 |
+
font-weight: 500;
|
76 |
+
transition: all 0.3s ease;
|
77 |
+
padding: 0.5rem 1rem;
|
78 |
+
border-radius: 4px;
|
79 |
+
}
|
80 |
+
|
81 |
+
nav a:hover {
|
82 |
+
background-color: rgba(255, 255, 255, 0.2);
|
83 |
+
}
|
84 |
+
|
85 |
+
.mobile-menu-btn {
|
86 |
+
display: none;
|
87 |
+
background: none;
|
88 |
+
border: none;
|
89 |
+
color: white;
|
90 |
+
font-size: 1.5rem;
|
91 |
+
cursor: pointer;
|
92 |
+
}
|
93 |
+
|
94 |
+
main {
|
95 |
+
flex: 1;
|
96 |
+
padding: 2rem 0;
|
97 |
+
}
|
98 |
+
|
99 |
+
.hero {
|
100 |
+
text-align: center;
|
101 |
+
margin-bottom: 3rem;
|
102 |
+
}
|
103 |
+
|
104 |
+
.hero h1 {
|
105 |
+
font-size: 2.5rem;
|
106 |
+
margin-bottom: 1rem;
|
107 |
+
color: var(--dark-color);
|
108 |
+
}
|
109 |
+
|
110 |
+
.hero p {
|
111 |
+
font-size: 1.1rem;
|
112 |
+
color: #6c757d;
|
113 |
+
max-width: 700px;
|
114 |
+
margin: 0 auto 2rem;
|
115 |
+
}
|
116 |
+
|
117 |
+
.search-box {
|
118 |
+
background: white;
|
119 |
+
border-radius: 10px;
|
120 |
+
padding: 2rem;
|
121 |
+
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
|
122 |
+
max-width: 800px;
|
123 |
+
margin: 0 auto;
|
124 |
+
}
|
125 |
+
|
126 |
+
.input-group {
|
127 |
+
display: flex;
|
128 |
+
gap: 0.5rem;
|
129 |
+
margin-bottom: 1rem;
|
130 |
+
}
|
131 |
+
|
132 |
+
input[type="text"] {
|
133 |
+
flex: 1;
|
134 |
+
padding: 1rem;
|
135 |
+
border: 2px solid #e9ecef;
|
136 |
+
border-radius: 8px;
|
137 |
+
font-size: 1rem;
|
138 |
+
transition: all 0.3s ease;
|
139 |
+
}
|
140 |
+
|
141 |
+
input[type="text"]:focus {
|
142 |
+
outline: none;
|
143 |
+
border-color: var(--accent-color);
|
144 |
+
box-shadow: 0 0 0 3px rgba(72, 149, 239, 0.3);
|
145 |
+
}
|
146 |
+
|
147 |
+
button {
|
148 |
+
background-color: var(--primary-color);
|
149 |
+
color: white;
|
150 |
+
border: none;
|
151 |
+
padding: 1rem 1.5rem;
|
152 |
+
border-radius: 8px;
|
153 |
+
cursor: pointer;
|
154 |
+
font-size: 1rem;
|
155 |
+
font-weight: 600;
|
156 |
+
transition: all 0.3s ease;
|
157 |
+
display: flex;
|
158 |
+
align-items: center;
|
159 |
+
gap: 0.5rem;
|
160 |
+
}
|
161 |
+
|
162 |
+
button:hover {
|
163 |
+
background-color: var(--secondary-color);
|
164 |
+
transform: translateY(-2px);
|
165 |
+
}
|
166 |
+
|
167 |
+
button:disabled {
|
168 |
+
background-color: #adb5bd;
|
169 |
+
cursor: not-allowed;
|
170 |
+
transform: none;
|
171 |
+
}
|
172 |
+
|
173 |
+
.options {
|
174 |
+
display: flex;
|
175 |
+
justify-content: space-between;
|
176 |
+
margin-bottom: 1rem;
|
177 |
+
}
|
178 |
+
|
179 |
+
.select-group {
|
180 |
+
display: flex;
|
181 |
+
align-items: center;
|
182 |
+
gap: 0.5rem;
|
183 |
+
}
|
184 |
+
|
185 |
+
select {
|
186 |
+
padding: 0.5rem;
|
187 |
+
border-radius: 6px;
|
188 |
+
border: 2px solid #e9ecef;
|
189 |
+
background-color: white;
|
190 |
+
}
|
191 |
+
|
192 |
+
.results {
|
193 |
+
margin-top: 3rem;
|
194 |
+
display: none;
|
195 |
+
}
|
196 |
+
|
197 |
+
.results h2 {
|
198 |
+
margin-bottom: 1.5rem;
|
199 |
+
color: var(--dark-color);
|
200 |
+
display: flex;
|
201 |
+
align-items: center;
|
202 |
+
gap: 0.5rem;
|
203 |
+
}
|
204 |
+
|
205 |
+
.question-card {
|
206 |
+
background: white;
|
207 |
+
border-radius: 10px;
|
208 |
+
padding: 1.5rem;
|
209 |
+
margin-bottom: 1.5rem;
|
210 |
+
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
|
211 |
+
border-left: 4px solid var(--accent-color);
|
212 |
+
transition: all 0.3s ease;
|
213 |
+
}
|
214 |
+
|
215 |
+
.question-card:hover {
|
216 |
+
transform: translateY(-3px);
|
217 |
+
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
|
218 |
+
}
|
219 |
+
|
220 |
+
.question {
|
221 |
+
font-weight: 600;
|
222 |
+
margin-bottom: 1rem;
|
223 |
+
color: var(--dark-color);
|
224 |
+
}
|
225 |
+
|
226 |
+
.answer {
|
227 |
+
color: #495057;
|
228 |
+
padding-left: 1rem;
|
229 |
+
border-left: 2px solid #dee2e6;
|
230 |
+
}
|
231 |
+
|
232 |
+
.loading {
|
233 |
+
display: none;
|
234 |
+
text-align: center;
|
235 |
+
margin: 2rem 0;
|
236 |
+
}
|
237 |
+
|
238 |
+
.spinner {
|
239 |
+
border: 4px solid rgba(0, 0, 0, 0.1);
|
240 |
+
border-radius: 50%;
|
241 |
+
border-top: 4px solid var(--primary-color);
|
242 |
+
width: 40px;
|
243 |
+
height: 40px;
|
244 |
+
animation: spin 1s linear infinite;
|
245 |
+
margin: 0 auto 1rem;
|
246 |
+
}
|
247 |
+
|
248 |
+
@keyframes spin {
|
249 |
+
0% { transform: rotate(0deg); }
|
250 |
+
100% { transform: rotate(360deg); }
|
251 |
+
}
|
252 |
+
|
253 |
+
.error-message {
|
254 |
+
color: var(--warning-color);
|
255 |
+
text-align: center;
|
256 |
+
margin: 1rem 0;
|
257 |
+
display: none;
|
258 |
+
}
|
259 |
+
|
260 |
+
footer {
|
261 |
+
background-color: var(--dark-color);
|
262 |
+
color: white;
|
263 |
+
padding: 2rem 0;
|
264 |
+
margin-top: 3rem;
|
265 |
+
}
|
266 |
+
|
267 |
+
.footer-content {
|
268 |
+
display: flex;
|
269 |
+
flex-wrap: wrap;
|
270 |
+
justify-content: space-between;
|
271 |
+
gap: 2rem;
|
272 |
+
}
|
273 |
+
|
274 |
+
.footer-section {
|
275 |
+
flex: 1;
|
276 |
+
min-width: 200px;
|
277 |
+
}
|
278 |
+
|
279 |
+
.footer-section h3 {
|
280 |
+
margin-bottom: 1.5rem;
|
281 |
+
font-size: 1.2rem;
|
282 |
+
position: relative;
|
283 |
+
padding-bottom: 0.5rem;
|
284 |
+
}
|
285 |
+
|
286 |
+
.footer-section h3::after {
|
287 |
+
content: '';
|
288 |
+
position: absolute;
|
289 |
+
left: 0;
|
290 |
+
bottom: 0;
|
291 |
+
width: 50px;
|
292 |
+
height: 2px;
|
293 |
+
background-color: var(--accent-color);
|
294 |
+
}
|
295 |
+
|
296 |
+
.footer-section p {
|
297 |
+
margin-bottom: 1rem;
|
298 |
+
color: #adb5bd;
|
299 |
+
}
|
300 |
+
|
301 |
+
.footer-links {
|
302 |
+
list-style: none;
|
303 |
+
}
|
304 |
+
|
305 |
+
.footer-links li {
|
306 |
+
margin-bottom: 0.8rem;
|
307 |
+
}
|
308 |
+
|
309 |
+
.footer-links a {
|
310 |
+
color: #adb5bd;
|
311 |
+
text-decoration: none;
|
312 |
+
transition: all 0.3s ease;
|
313 |
+
}
|
314 |
+
|
315 |
+
.footer-links a:hover {
|
316 |
+
color: white;
|
317 |
+
padding-left: 5px;
|
318 |
+
}
|
319 |
+
|
320 |
+
.social-links {
|
321 |
+
display: flex;
|
322 |
+
gap: 1rem;
|
323 |
+
margin-top: 1rem;
|
324 |
+
}
|
325 |
+
|
326 |
+
.social-links a {
|
327 |
+
color: white;
|
328 |
+
background-color: #495057;
|
329 |
+
width: 40px;
|
330 |
+
height: 40px;
|
331 |
+
border-radius: 50%;
|
332 |
+
display: flex;
|
333 |
+
align-items: center;
|
334 |
+
justify-content: center;
|
335 |
+
transition: all 0.3s ease;
|
336 |
+
}
|
337 |
+
|
338 |
+
.social-links a:hover {
|
339 |
+
background-color: var(--accent-color);
|
340 |
+
transform: translateY(-3px);
|
341 |
+
}
|
342 |
+
|
343 |
+
.footer-bottom {
|
344 |
+
text-align: center;
|
345 |
+
padding-top: 2rem;
|
346 |
+
margin-top: 2rem;
|
347 |
+
border-top: 1px solid #495057;
|
348 |
+
color: #adb5bd;
|
349 |
+
font-size: 0.9rem;
|
350 |
+
}
|
351 |
+
|
352 |
+
@media (max-width: 768px) {
|
353 |
+
.header-content {
|
354 |
+
flex-direction: column;
|
355 |
+
gap: 1rem;
|
356 |
+
}
|
357 |
+
|
358 |
+
nav ul {
|
359 |
+
flex-direction: column;
|
360 |
+
gap: 0.5rem;
|
361 |
+
align-items: center;
|
362 |
+
}
|
363 |
+
|
364 |
+
.input-group {
|
365 |
+
flex-direction: column;
|
366 |
+
}
|
367 |
+
|
368 |
+
button {
|
369 |
+
width: 100%;
|
370 |
+
justify-content: center;
|
371 |
+
}
|
372 |
+
|
373 |
+
.options {
|
374 |
+
flex-direction: column;
|
375 |
+
gap: 1rem;
|
376 |
+
}
|
377 |
+
|
378 |
+
.select-group {
|
379 |
+
justify-content: space-between;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
@media (max-width: 480px) {
|
384 |
+
.hero h1 {
|
385 |
+
font-size: 2rem;
|
386 |
+
}
|
387 |
+
|
388 |
+
.hero p {
|
389 |
+
font-size: 1rem;
|
390 |
+
}
|
391 |
+
|
392 |
+
.search-box {
|
393 |
+
padding: 1.5rem;
|
394 |
+
}
|
395 |
+
|
396 |
+
.footer-content {
|
397 |
+
flex-direction: column;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
</style>
|
401 |
+
</head>
|
402 |
+
<body>
|
403 |
+
<header>
|
404 |
+
<div class="container">
|
405 |
+
<div class="header-content">
|
406 |
+
<div class="logo">
|
407 |
+
<i class="fas fa-brain"></i>
|
408 |
+
<span>AI Study Helper</span>
|
409 |
+
</div>
|
410 |
+
<nav>
|
411 |
+
<ul>
|
412 |
+
<li><a href="#"><i class="fas fa-home"></i> Home</a></li>
|
413 |
+
<li><a href="#"><i class="fas fa-book"></i> Subjects</a></li>
|
414 |
+
<li><a href="#"><i class="fas fa-graduation-cap"></i> Exam Prep</a></li>
|
415 |
+
<li><a href="#"><i class="fas fa-info-circle"></i> About</a></li>
|
416 |
+
</ul>
|
417 |
+
</nav>
|
418 |
+
<button class="mobile-menu-btn">
|
419 |
+
<i class="fas fa-bars"></i>
|
420 |
+
</button>
|
421 |
+
</div>
|
422 |
+
</div>
|
423 |
+
</header>
|
424 |
+
|
425 |
+
<main>
|
426 |
+
<div class="container">
|
427 |
+
<section class="hero">
|
428 |
+
<h1>AI-Powered Exam Question Generator</h1>
|
429 |
+
<p>Enter any topic or question below, and our AI will generate potential exam questions with detailed answers to help you prepare effectively.</p>
|
430 |
+
</section>
|
431 |
+
|
432 |
+
<section class="search-box">
|
433 |
+
<div class="input-group">
|
434 |
+
<input type="text" id="topicInput" placeholder="Enter a topic or question (e.g., 'Photosynthesis', 'Newton's Laws', 'World War II')">
|
435 |
+
<button id="generateBtn">
|
436 |
+
<i class="fas fa-magic"></i> Generate Questions
|
437 |
+
</button>
|
438 |
+
</div>
|
439 |
+
<div class="options">
|
440 |
+
<div class="select-group">
|
441 |
+
<label for="difficulty">Difficulty:</label>
|
442 |
+
<select id="difficulty">
|
443 |
+
<option value="easy">Easy</option>
|
444 |
+
<option value="medium" selected>Medium</option>
|
445 |
+
<option value="hard">Hard</option>
|
446 |
+
</select>
|
447 |
+
</div>
|
448 |
+
<div class="select-group">
|
449 |
+
<label for="questionType">Type:</label>
|
450 |
+
<select id="questionType">
|
451 |
+
<option value="mixed" selected>Mixed</option>
|
452 |
+
<option value="multiple_choice">Multiple Choice</option>
|
453 |
+
<option value="short_answer">Short Answer</option>
|
454 |
+
<option value="essay">Essay</option>
|
455 |
+
<option value="true_false">True/False</option>
|
456 |
+
</select>
|
457 |
+
</div>
|
458 |
+
<div class="select-group">
|
459 |
+
<label for="questionCount">Count:</label>
|
460 |
+
<select id="questionCount">
|
461 |
+
<option value="3">3</option>
|
462 |
+
<option value="5" selected>5</option>
|
463 |
+
<option value="10">10</option>
|
464 |
+
</select>
|
465 |
+
</div>
|
466 |
+
</div>
|
467 |
+
<div class="error-message" id="errorMessage"></div>
|
468 |
+
</section>
|
469 |
+
|
470 |
+
<div class="loading" id="loadingIndicator">
|
471 |
+
<div class="spinner"></div>
|
472 |
+
<p>Generating questions... This may take a moment.</p>
|
473 |
+
</div>
|
474 |
+
|
475 |
+
<section class="results" id="resultsSection">
|
476 |
+
<h2><i class="fas fa-list-ol"></i> Generated Questions</h2>
|
477 |
+
<div id="questionsContainer"></div>
|
478 |
+
</section>
|
479 |
+
</div>
|
480 |
+
</main>
|
481 |
+
|
482 |
+
<footer>
|
483 |
+
<div class="container">
|
484 |
+
<div class="footer-content">
|
485 |
+
<div class="footer-section">
|
486 |
+
<h3>About AI Study Helper</h3>
|
487 |
+
<p>Our mission is to empower students with AI-driven tools to enhance their learning experience and exam preparation.</p>
|
488 |
+
<div class="social-links">
|
489 |
+
<a href="#"><i class="fab fa-facebook-f"></i></a>
|
490 |
+
<a href="#"><i class="fab fa-twitter"></i></a>
|
491 |
+
<a href="#"><i class="fab fa-instagram"></i></a>
|
492 |
+
<a href="#"><i class="fab fa-linkedin-in"></i></a>
|
493 |
+
</div>
|
494 |
+
</div>
|
495 |
+
<div class="footer-section">
|
496 |
+
<h3>Quick Links</h3>
|
497 |
+
<ul class="footer-links">
|
498 |
+
<li><a href="#">Home</a></li>
|
499 |
+
<li><a href="#">Popular Subjects</a></li>
|
500 |
+
<li><a href="#">Exam Preparation</a></li>
|
501 |
+
<li><a href="#">Study Tips</a></li>
|
502 |
+
<li><a href="#">Contact Us</a></li>
|
503 |
+
</ul>
|
504 |
+
</div>
|
505 |
+
<div class="footer-section">
|
506 |
+
<h3>Resources</h3>
|
507 |
+
<ul class="footer-links">
|
508 |
+
<li><a href="#">Blog</a></li>
|
509 |
+
<li><a href="#">FAQ</a></li>
|
510 |
+
<li><a href="#">Privacy Policy</a></li>
|
511 |
+
<li><a href="#">Terms of Service</a></li>
|
512 |
+
<li><a href="#">API Documentation</a></li>
|
513 |
+
</ul>
|
514 |
+
</div>
|
515 |
+
<div class="footer-section">
|
516 |
+
<h3>Newsletter</h3>
|
517 |
+
<p>Subscribe to get updates on new features and study resources.</p>
|
518 |
+
<div class="input-group">
|
519 |
+
<input type="email" placeholder="Your email">
|
520 |
+
<button><i class="fas fa-paper-plane"></i></button>
|
521 |
+
</div>
|
522 |
+
</div>
|
523 |
+
</div>
|
524 |
+
<div class="footer-bottom">
|
525 |
+
<p>© 2023 AI Study Helper. All rights reserved.</p>
|
526 |
+
</div>
|
527 |
+
</div>
|
528 |
+
</footer>
|
529 |
+
|
530 |
+
<script>
|
531 |
+
document.addEventListener('DOMContentLoaded', function() {
|
532 |
+
// DOM Elements
|
533 |
+
const topicInput = document.getElementById('topicInput');
|
534 |
+
const generateBtn = document.getElementById('generateBtn');
|
535 |
+
const difficultySelect = document.getElementById('difficulty');
|
536 |
+
const questionTypeSelect = document.getElementById('questionType');
|
537 |
+
const questionCountSelect = document.getElementById('questionCount');
|
538 |
+
const loadingIndicator = document.getElementById('loadingIndicator');
|
539 |
+
const resultsSection = document.getElementById('resultsSection');
|
540 |
+
const questionsContainer = document.getElementById('questionsContainer');
|
541 |
+
const errorMessage = document.getElementById('errorMessage');
|
542 |
+
|
543 |
+
// Event Listeners
|
544 |
+
generateBtn.addEventListener('click', generateQuestions);
|
545 |
+
topicInput.addEventListener('keypress', function(e) {
|
546 |
+
if (e.key === 'Enter') {
|
547 |
+
generateQuestions();
|
548 |
+
}
|
549 |
+
});
|
550 |
+
|
551 |
+
// Mobile menu toggle
|
552 |
+
const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
|
553 |
+
const nav = document.querySelector('nav ul');
|
554 |
+
|
555 |
+
mobileMenuBtn.addEventListener('click', function() {
|
556 |
+
nav.style.display = nav.style.display === 'flex' ? 'none' : 'flex';
|
557 |
+
});
|
558 |
+
|
559 |
+
// Adjust for mobile on resize
|
560 |
+
window.addEventListener('resize', function() {
|
561 |
+
if (window.innerWidth > 768) {
|
562 |
+
nav.style.display = 'flex';
|
563 |
+
} else {
|
564 |
+
nav.style.display = 'none';
|
565 |
+
}
|
566 |
+
});
|
567 |
+
|
568 |
+
// Initialize mobile menu
|
569 |
+
if (window.innerWidth <= 768) {
|
570 |
+
nav.style.display = 'none';
|
571 |
+
}
|
572 |
+
|
573 |
+
// Generate Questions Function
|
574 |
+
async function generateQuestions() {
|
575 |
+
const topic = topicInput.value.trim();
|
576 |
+
const difficulty = difficultySelect.value;
|
577 |
+
const questionType = questionTypeSelect.value;
|
578 |
+
const questionCount = questionCountSelect.value;
|
579 |
+
|
580 |
+
// Validate input
|
581 |
+
if (!topic) {
|
582 |
+
showError('Please enter a topic or question');
|
583 |
+
return;
|
584 |
+
}
|
585 |
+
|
586 |
+
// Clear previous results and errors
|
587 |
+
questionsContainer.innerHTML = '';
|
588 |
+
hideError();
|
589 |
+
resultsSection.style.display = 'none';
|
590 |
+
|
591 |
+
// Show loading indicator
|
592 |
+
loadingIndicator.style.display = 'block';
|
593 |
+
generateBtn.disabled = true;
|
594 |
+
|
595 |
+
try {
|
596 |
+
// Generate prompt for the AI
|
597 |
+
const prompt = `Generate ${questionCount} ${difficulty}-level ${questionType} exam questions with answers about ${topic}.
|
598 |
+
Format each question as "Question: [question text]" followed by "Answer: [answer text]".
|
599 |
+
Make sure the questions are relevant and likely to appear in an exam.`;
|
600 |
+
|
601 |
+
// Call Hugging Face API
|
602 |
+
const response = await callHuggingFaceAPI(prompt);
|
603 |
+
|
604 |
+
// Process the response
|
605 |
+
if (response && response.generated_text) {
|
606 |
+
const questionsAndAnswers = parseQuestionsAndAnswers(response.generated_text);
|
607 |
+
displayQuestions(questionsAndAnswers);
|
608 |
+
} else {
|
609 |
+
showError('Failed to generate questions. Please try again.');
|
610 |
+
}
|
611 |
+
} catch (error) {
|
612 |
+
console.error('Error:', error);
|
613 |
+
showError('An error occurred. Please check your connection and try again.');
|
614 |
+
} finally {
|
615 |
+
loadingIndicator.style.display = 'none';
|
616 |
+
generateBtn.disabled = false;
|
617 |
+
}
|
618 |
+
}
|
619 |
+
|
620 |
+
// Call Hugging Face API
|
621 |
+
async function callHuggingFaceAPI(prompt) {
|
622 |
+
// Replace with your actual Hugging Face API token
|
623 |
+
const API_TOKEN = "YOUR_HUGGING_FACE_API_TOKEN";
|
624 |
+
const API_URL = "https://api-inference.huggingface.co/models/google/flan-t5-xxl";
|
625 |
+
|
626 |
+
try {
|
627 |
+
const response = await fetch(API_URL, {
|
628 |
+
method: "POST",
|
629 |
+
headers: {
|
630 |
+
"Authorization": `Bearer ${API_TOKEN}`,
|
631 |
+
"Content-Type": "application/json"
|
632 |
+
},
|
633 |
+
body: JSON.stringify({ inputs: prompt })
|
634 |
+
});
|
635 |
+
|
636 |
+
if (!response.ok) {
|
637 |
+
throw new Error(`API request failed with status ${response.status}`);
|
638 |
+
}
|
639 |
+
|
640 |
+
return await response.json();
|
641 |
+
} catch (error) {
|
642 |
+
console.error("API call error:", error);
|
643 |
+
throw error;
|
644 |
+
}
|
645 |
+
}
|
646 |
+
|
647 |
+
// Parse Questions and Answers from the AI response
|
648 |
+
function parseQuestionsAndAnswers(text) {
|
649 |
+
const qaPairs = [];
|
650 |
+
const lines = text.split('\n');
|
651 |
+
let currentQuestion = null;
|
652 |
+
|
653 |
+
for (const line of lines) {
|
654 |
+
if (line.startsWith('Question:')) {
|
655 |
+
if (currentQuestion) {
|
656 |
+
qaPairs.push(currentQuestion);
|
657 |
+
}
|
658 |
+
currentQuestion = {
|
659 |
+
question: line.replace('Question:', '').trim(),
|
660 |
+
answer: ''
|
661 |
+
};
|
662 |
+
} else if (line.startsWith('Answer:')) {
|
663 |
+
if (currentQuestion) {
|
664 |
+
currentQuestion.answer = line.replace('Answer:', '').trim();
|
665 |
+
qaPairs.push(currentQuestion);
|
666 |
+
currentQuestion = null;
|
667 |
+
}
|
668 |
+
} else if (currentQuestion && currentQuestion.answer === '') {
|
669 |
+
// Handle multi-line answers
|
670 |
+
currentQuestion.answer += line.trim() + '\n';
|
671 |
+
}
|
672 |
+
}
|
673 |
+
|
674 |
+
// Add the last question if it exists
|
675 |
+
if (currentQuestion) {
|
676 |
+
qaPairs.push(currentQuestion);
|
677 |
+
}
|
678 |
+
|
679 |
+
return qaPairs;
|
680 |
+
}
|
681 |
+
|
682 |
+
// Display Questions and Answers
|
683 |
+
function displayQuestions(qaPairs) {
|
684 |
+
if (qaPairs.length === 0) {
|
685 |
+
showError('No questions were generated. Please try a different topic or prompt.');
|
686 |
+
return;
|
687 |
+
}
|
688 |
+
|
689 |
+
qaPairs.forEach((qa, index) => {
|
690 |
+
const card = document.createElement('div');
|
691 |
+
card.className = 'question-card';
|
692 |
+
card.innerHTML = `
|
693 |
+
<div class="question">Q${index + 1}: ${qa.question}</div>
|
694 |
+
<div class="answer">${qa.answer}</div>
|
695 |
+
`;
|
696 |
+
questionsContainer.appendChild(card);
|
697 |
+
});
|
698 |
+
|
699 |
+
resultsSection.style.display = 'block';
|
700 |
+
}
|
701 |
+
|
702 |
+
// Error Handling
|
703 |
+
function showError(message) {
|
704 |
+
errorMessage.textContent = message;
|
705 |
+
errorMessage.style.display = 'block';
|
706 |
+
}
|
707 |
+
|
708 |
+
function hideError() {
|
709 |
+
errorMessage.style.display = 'none';
|
710 |
+
}
|
711 |
+
});
|
712 |
+
</script>
|
713 |
+
</body>
|
714 |
+
</html>
|