Spaces:
Running
Running
File size: 15,856 Bytes
03084ff 0e1f4a8 c721805 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 c721805 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 c721805 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 c721805 0e1f4a8 1c71f62 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 03084ff c721805 0e1f4a8 c721805 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 1c71f62 0e1f4a8 03084ff 0e1f4a8 03084ff 0e1f4a8 03084ff c721805 03084ff c721805 0e1f4a8 c721805 03084ff c721805 0e1f4a8 c721805 1c71f62 c721805 0e1f4a8 c721805 03084ff c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 03084ff 1c71f62 03084ff c721805 03084ff c721805 0e1f4a8 c721805 1c71f62 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 1c71f62 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 0e1f4a8 c721805 03084ff 0e1f4a8 03084ff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mariam AI | Dissertation Philosophique</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
:root {
--primary-color: #7C3AED;
--primary-dark: #6D28D9;
--secondary-color: #10B981;
--accent-color: #F59E0B;
--background-color: #F3F4F8;
--text-primary: #1F2937;
--text-secondary: #6B7280;
}
body {
font-family: 'Poppins', sans-serif;
background-color: var(--background-color);
color: var(--text-primary);
}
.mariam-container {
max-width: 1000px;
margin: 2rem auto;
padding: 0 1rem;
}
.mariam-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 2rem;
padding: 1rem;
background: white;
border-radius: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.mariam-logo {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary-color);
display: flex;
align-items: center;
gap: 0.5rem;
}
.mariam-card {
background: white;
border-radius: 1rem;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
padding: 2rem;
border-top: 4px solid var(--primary-color);
}
.mariam-input {
width: 100%;
padding: 0.75rem;
border: 2px solid #E5E7EB;
border-radius: 0.5rem;
transition: all 0.3s;
font-size: 1rem;
}
.mariam-input:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.mariam-select {
width: 100%;
padding: 0.75rem;
border: 2px solid #E5E7EB;
border-radius: 0.5rem;
background-color: white;
transition: all 0.3s;
}
.mariam-select:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.mariam-btn {
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
font-weight: 600;
transition: all 0.3s;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.mariam-btn-primary {
background-color: var(--primary-color);
color: white;
}
.mariam-btn-primary:hover {
background-color: var(--primary-dark);
}
.mariam-btn-secondary {
background-color: white;
color: var(--primary-color);
border: 2px solid var(--primary-color);
}
.mariam-btn-secondary:hover {
background-color: var(--primary-color);
color: white;
}
.mariam-badge {
display: inline-block;
padding: 0.25rem 0.75rem;
background-color: var(--primary-color);
color: white;
border-radius: 9999px;
font-size: 0.875rem;
font-weight: 500;
margin-bottom: 1.5rem;
}
.mariam-meta {
background-color: #F9FAFB;
border-radius: 0.5rem;
padding: 1rem;
margin-top: 0.5rem;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.875rem;
color: var(--text-secondary);
border-left: 4px solid var(--secondary-color);
}
.mariam-response {
margin-top: 2rem;
padding: 1.5rem;
background-color: #F9FAFB;
border-radius: 0.5rem;
line-height: 1.75;
border-left: 4px solid var(--primary-color);
}
.mariam-form-group {
margin-bottom: 1.5rem;
}
.mariam-label {
display: block;
font-weight: 500;
margin-bottom: 0.5rem;
color: var(--text-primary);
}
.mariam-loading {
border: 3px solid #f3f3f3;
border-radius: 50%;
border-top: 3px solid var(--primary-color);
width: 24px;
height: 24px;
animation: mariam-spin 1s linear infinite;
margin: 0 auto;
}
@keyframes mariam-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.mariam-button-group {
display: flex;
gap: 1rem;
margin-top: 1.5rem;
}
/* Style des alertes SweetAlert2 personnalisé */
.swal2-popup {
font-family: 'Poppins', sans-serif;
}
</style>
</head>
<body>
<div class="mariam-container">
<header class="mariam-header">
<div class="mariam-logo">
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"/>
<path d="M12 16v-4"/>
<path d="M12 8h.01"/>
</svg>
Mariam AI
</div>
<span class="text-sm text-gray-500">Module de Philosophie</span>
</header>
<div class="mariam-card">
<h1 class="text-2xl font-bold mb-6">Assistant de Dissertation</h1>
<div class="mariam-form-group">
<label class="mariam-label" for="type-select">Type de dissertation</label>
<select id="type-select" class="mariam-select">
<option value="1">Dissertation type 1</option>
<option value="2">Dissertation type 2</option>
</select>
</div>
<div class="mariam-badge" id="current-type-label">Dissertation type 1</div>
<div class="mariam-form-group">
<label class="mariam-label" for="course-select">Cours de référence</label>
<select id="course-select" class="mariam-select">
<option value="">Sélectionner un cours...</option>
</select>
<div class="mariam-meta hidden" id="course-info">
<span id="course-author" class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
</svg>
<span></span>
</span>
<span id="course-date" class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
<span></span>
</span>
</div>
</div>
<div class="mariam-form-group">
<label class="mariam-label" for="question">Sujet de dissertation</label>
<textarea
id="question"
rows="4"
class="mariam-input"
placeholder="Saisissez votre sujet de dissertation ici..."
></textarea>
</div>
<button id="submit-btn" class="mariam-btn mariam-btn-primary">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
Générer avec Mariam AI
</button>
<div id="response" class="mariam-response hidden"></div>
<div class="mariam-button-group hidden" id="action-buttons">
<button id="copy-btn" class="mariam-btn mariam-btn-secondary">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"/>
</svg>
Copier
</button>
<button id="new-btn" class="mariam-btn mariam-btn-secondary">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
</svg>
Nouvelle dissertation
</button>
</div>
</div>
</div>
<script>
$(document).ready(function() {
marked.setOptions({
breaks: true,
gfm: true,
headerIds: true,
langPrefix: 'language-'
});
const Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
});
$('#type-select').change(function() {
const type = $(this).val();
$('#current-type-label').text(`Dissertation type ${type}`);
});
$.ajax({
url: '/api/philosophy/courses',
method: 'GET',
success: function(courses) {
const select = $('#course-select');
courses.forEach(course => {
select.append(`<option value="${course.id}">${course.title}</option>`);
});
},
error: function() {
Toast.fire({
icon: 'error',
title: 'Erreur de chargement des cours'
});
}
});
$('#course-select').change(function() {
const courseId = $(this).val();
if (courseId) {
$.ajax({
url: `/api/philosophy/courses/${courseId}`,
method: 'GET',
success: function(course) {
$('#course-info').removeClass('hidden');
$('#course-author span').text(`Prof. ${course.author}`);
$('#course-date span').text(`Mis à jour le ${new Date(course.updated_at).toLocaleDateString()}`);
},
error: function() {
Toast.fire({
icon: 'error',
title: 'Erreur de chargement des détails du cours'
});
}
});
} else {
$('#course-info').addClass('hidden');
}
});
$('#submit-btn').click(function() {
const question = $('#question').val().trim();
const type = $('#type-select').val();
if (!question) {
Swal.fire({
icon: 'warning',
title: 'Champ requis',
text: 'Veuillez saisir un sujet de dissertation.' });
return;
}
$(this).html('<div class="mariam-loading"></div>').prop('disabled', true);
$.ajax({
url: '/api/philosophy/dissertation',
method: 'POST',
contentType: 'application/json',
data: JSON.stringify({ question: question, type: type, course_id: $('#course-select').val() }),
success: function(response) {
$('#submit-btn').html(`
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
Générer avec Mariam AI`).prop('disabled', false);
$('#response').html(marked.parse(response.answer)).removeClass('hidden');
$('#action-buttons').removeClass('hidden');
},
error: function() {
$('#submit-btn').html(`
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
Générer avec Mariam AI`).prop('disabled', false);
Swal.fire({
icon: 'error',
title: 'Erreur',
text: 'Une erreur est survenue lors de la génération de la dissertation.'
});
}
});
});
$('#copy-btn').click(function() {
const textToCopy = $('#response').text();
navigator.clipboard.writeText(textToCopy).then(function() {
Toast.fire({
icon: 'success',
title: 'Copié dans le presse-papiers!'
});
}, function() {
Swal.fire({
icon: 'error',
title: 'Erreur',
text: 'Impossible de copier le texte.'
});
});
});
$('#new-btn').click(function() {
$('#question').val('');
$('#response').html('').addClass('hidden');
$('#action-buttons').addClass('hidden');
$('#course-info').addClass('hidden');
$('#course-select').val('');
});
});
</script>
</body>
</html> |