Spaces:
Running
Running
Update templates/philosophie.html
Browse files- templates/philosophie.html +210 -130
templates/philosophie.html
CHANGED
@@ -4,14 +4,10 @@
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Mariam AI - Assistant Philosophique</title>
|
7 |
-
<!-- Import des bibliothèques nécessaires -->
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.min.js"></script>
|
10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
|
11 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prismjs/1.29.0/prism.min.js"></script>
|
12 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/prismjs/1.29.0/components/prism-markdown.min.js"></script>
|
13 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css" rel="stylesheet">
|
14 |
-
<link href="https://cdnjs.cloudflare.com/ajax/libs/prismjs/1.29.0/themes/prism.min.css" rel="stylesheet">
|
15 |
<script src="https://cdn.tailwindcss.com"></script>
|
16 |
</head>
|
17 |
<body class="bg-gradient-to-br from-violet-50 to-indigo-50 min-h-screen">
|
@@ -19,192 +15,276 @@
|
|
19 |
<nav class="bg-white/80 backdrop-blur-md border-b border-gray-200 fixed w-full z-50">
|
20 |
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
21 |
<div class="flex justify-between items-center h-16">
|
22 |
-
<div class="
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
</div>
|
25 |
-
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-violet-100 text-violet-800">
|
26 |
-
<span class="w-2 h-2 bg-violet-400 rounded-full animate-pulse mr-2"></span>
|
27 |
-
Assistant Philosophique
|
28 |
-
</span>
|
29 |
</div>
|
30 |
</div>
|
31 |
</nav>
|
32 |
|
33 |
-
<!--
|
34 |
<div class="pt-24 pb-12 px-4 sm:px-6 lg:px-8">
|
35 |
<div class="max-w-4xl mx-auto">
|
|
|
36 |
<div class="bg-white/80 backdrop-blur-md rounded-2xl shadow-xl border border-gray-100 overflow-hidden">
|
37 |
-
<!--
|
38 |
<div class="bg-gradient-to-r from-violet-600 to-indigo-600 p-6 text-white">
|
39 |
<h2 class="text-2xl font-bold">Générateur de Dissertation</h2>
|
40 |
<p class="mt-2 opacity-90">Créez des dissertations philosophiques pertinentes et structurées</p>
|
41 |
</div>
|
42 |
|
43 |
-
<!-- Section
|
44 |
<div class="p-8 space-y-8">
|
45 |
-
<!--
|
46 |
<div class="space-y-3">
|
47 |
<label class="block text-sm font-medium text-gray-700">Type de dissertation</label>
|
48 |
-
<
|
49 |
-
<
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
<div id="current-type-label" class="inline-flex px-4 py-2 rounded-xl text-sm font-medium bg-gradient-to-r from-violet-50 to-indigo-50 text-violet-700 border border-violet-200">
|
53 |
Sujet de type 1
|
54 |
</div>
|
55 |
</div>
|
56 |
|
57 |
-
<!--
|
58 |
<div class="space-y-3">
|
59 |
<label class="block text-sm font-medium text-gray-700">Sélection du cours</label>
|
60 |
-
<
|
61 |
-
<
|
62 |
-
|
63 |
-
|
64 |
-
<div class="flex
|
65 |
-
<
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
</div>
|
68 |
</div>
|
69 |
</div>
|
70 |
|
71 |
-
<!--
|
72 |
<div class="space-y-3">
|
73 |
<label class="block text-sm font-medium text-gray-700">Sujet de dissertation</label>
|
74 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
</div>
|
76 |
|
77 |
-
<!--
|
78 |
-
<button id="submit-btn" class="w-full py-4 px-6 rounded-xl bg-gradient-to-r from-violet-600 to-indigo-600 text-white font-medium shadow-lg">
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
80 |
</button>
|
81 |
|
82 |
-
<!--
|
83 |
-
<div id="response" class="hidden mt-8">
|
84 |
-
<div class="
|
85 |
-
|
86 |
-
<button id="markdown-tab" class="text-gray-500 hover:text-violet-600 px-4 py-2">Markdown</button>
|
87 |
-
</div>
|
88 |
-
<div id="preview-content" class="prose prose-violet max-w-none">
|
89 |
-
<!-- Réponse HTML -->
|
90 |
-
</div>
|
91 |
-
<div id="markdown-content" class="hidden bg-gray-900 text-white p-4 rounded-xl overflow-auto">
|
92 |
-
<pre><code class="language-markdown"></code></pre>
|
93 |
</div>
|
94 |
</div>
|
95 |
|
96 |
-
<!--
|
97 |
-
<button id="copy-btn" class="hidden w-full py-3 px-6 rounded-xl bg-gray-50 text-gray-700 border hover:bg-gray-100">
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
99 |
</button>
|
100 |
</div>
|
101 |
</div>
|
102 |
</div>
|
103 |
</div>
|
104 |
|
105 |
-
<!-- Scripts -->
|
106 |
<script>
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
115 |
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
-
|
|
|
|
|
|
|
123 |
$.ajax({
|
124 |
-
url:
|
125 |
method: 'GET',
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
});
|
130 |
},
|
131 |
error: function() {
|
132 |
-
Toast.fire({
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
if (!question) {
|
140 |
-
$('#question').addClass('border-red-300 animate-shake');
|
141 |
-
setTimeout(() => $('#question').removeClass('border-red-300 animate-shake'), 1000);
|
142 |
-
return;
|
143 |
-
}
|
144 |
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
contentType: 'application/json',
|
151 |
-
data: JSON.stringify({ question, type: $('#type-select').val(), courseId: $('#course-select').val() }),
|
152 |
-
success: function(data) {
|
153 |
-
Swal.close();
|
154 |
-
$('#preview-content').html(marked.parse(data.response));
|
155 |
-
$('#markdown-content code').text(data.response);
|
156 |
-
Prism.highlightAll();
|
157 |
-
$('#response').removeClass('hidden');
|
158 |
-
$('#copy-btn').removeClass('hidden');
|
159 |
-
Toast.fire({ icon: 'success', title: 'Dissertation générée' });
|
160 |
-
},
|
161 |
-
error: function() {
|
162 |
-
Swal.fire({ icon: 'error', title: 'Erreur', text: 'Une erreur est survenue.' });
|
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 |
-
Toast.fire({ icon: 'success', title: 'Contenu copié dans le presse-papiers' });
|
188 |
-
})
|
189 |
-
.catch(() => {
|
190 |
-
Toast.fire({ icon: 'error', title: 'Erreur lors de la copie' });
|
191 |
-
});
|
192 |
-
});
|
193 |
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
});
|
|
|
|
|
|
|
208 |
</script>
|
209 |
</body>
|
210 |
</html>
|
|
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>Mariam AI - Assistant Philosophique</title>
|
|
|
7 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.all.min.js"></script>
|
9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/4.3.0/marked.min.js"></script>
|
|
|
|
|
10 |
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.7.3/sweetalert2.min.css" rel="stylesheet">
|
|
|
11 |
<script src="https://cdn.tailwindcss.com"></script>
|
12 |
</head>
|
13 |
<body class="bg-gradient-to-br from-violet-50 to-indigo-50 min-h-screen">
|
|
|
15 |
<nav class="bg-white/80 backdrop-blur-md border-b border-gray-200 fixed w-full z-50">
|
16 |
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
17 |
<div class="flex justify-between items-center h-16">
|
18 |
+
<div class="flex items-center">
|
19 |
+
<div class="text-2xl font-bold bg-gradient-to-r from-violet-600 to-indigo-600 text-transparent bg-clip-text">
|
20 |
+
Mariam AI
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
<div class="flex items-center space-x-4">
|
24 |
+
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-violet-100 text-violet-800">
|
25 |
+
<span class="w-2 h-2 bg-violet-400 rounded-full animate-pulse mr-2"></span>
|
26 |
+
Assistant Philosophique
|
27 |
+
</span>
|
28 |
</div>
|
|
|
|
|
|
|
|
|
29 |
</div>
|
30 |
</div>
|
31 |
</nav>
|
32 |
|
33 |
+
<!-- Main Content -->
|
34 |
<div class="pt-24 pb-12 px-4 sm:px-6 lg:px-8">
|
35 |
<div class="max-w-4xl mx-auto">
|
36 |
+
<!-- Main Card -->
|
37 |
<div class="bg-white/80 backdrop-blur-md rounded-2xl shadow-xl border border-gray-100 overflow-hidden">
|
38 |
+
<!-- Header Section -->
|
39 |
<div class="bg-gradient-to-r from-violet-600 to-indigo-600 p-6 text-white">
|
40 |
<h2 class="text-2xl font-bold">Générateur de Dissertation</h2>
|
41 |
<p class="mt-2 opacity-90">Créez des dissertations philosophiques pertinentes et structurées</p>
|
42 |
</div>
|
43 |
|
44 |
+
<!-- Content Section -->
|
45 |
<div class="p-8 space-y-8">
|
46 |
+
<!-- Type Selection -->
|
47 |
<div class="space-y-3">
|
48 |
<label class="block text-sm font-medium text-gray-700">Type de dissertation</label>
|
49 |
+
<div class="relative">
|
50 |
+
<select id="type-select" class="w-full rounded-xl border-gray-200 shadow-sm focus:border-violet-500 focus:ring-violet-500 appearance-none bg-white py-3 px-4 pr-10">
|
51 |
+
<option value="1">Type 1 - Dissertation classique</option>
|
52 |
+
<option value="2">Type 2 - Analyse comparative</option>
|
53 |
+
</select>
|
54 |
+
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none">
|
55 |
+
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
56 |
+
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
57 |
+
</svg>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
<div id="current-type-label" class="inline-flex px-4 py-2 rounded-xl text-sm font-medium bg-gradient-to-r from-violet-50 to-indigo-50 text-violet-700 border border-violet-200">
|
61 |
Sujet de type 1
|
62 |
</div>
|
63 |
</div>
|
64 |
|
65 |
+
<!-- Course Selection -->
|
66 |
<div class="space-y-3">
|
67 |
<label class="block text-sm font-medium text-gray-700">Sélection du cours</label>
|
68 |
+
<div class="relative">
|
69 |
+
<select id="course-select" class="w-full rounded-xl border-gray-200 shadow-sm focus:border-violet-500 focus:ring-violet-500 appearance-none bg-white py-3 px-4 pr-10">
|
70 |
+
<option value="">Choisir un cours...</option>
|
71 |
+
</select>
|
72 |
+
<div class="absolute inset-y-0 right-0 flex items-center px-4 pointer-events-none">
|
73 |
+
<svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
74 |
+
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
75 |
+
</svg>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
<div class="course-meta hidden">
|
79 |
+
<div class="bg-gradient-to-r from-gray-50 to-white rounded-xl p-4 border border-gray-100">
|
80 |
+
<div class="flex justify-between items-center">
|
81 |
+
<span id="course-author" class="flex items-center space-x-2">
|
82 |
+
<svg class="h-5 w-5 text-violet-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
83 |
+
<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" />
|
84 |
+
</svg>
|
85 |
+
<span class="text-gray-600"></span>
|
86 |
+
</span>
|
87 |
+
<span id="course-date" class="flex items-center space-x-2">
|
88 |
+
<svg class="h-5 w-5 text-violet-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
89 |
+
<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" />
|
90 |
+
</svg>
|
91 |
+
<span class="text-gray-600"></span>
|
92 |
+
</span>
|
93 |
+
</div>
|
94 |
</div>
|
95 |
</div>
|
96 |
</div>
|
97 |
|
98 |
+
<!-- Question Input -->
|
99 |
<div class="space-y-3">
|
100 |
<label class="block text-sm font-medium text-gray-700">Sujet de dissertation</label>
|
101 |
+
<div class="relative">
|
102 |
+
<textarea id="question" rows="4"
|
103 |
+
class="w-full rounded-xl border-gray-200 shadow-sm focus:border-violet-500 focus:ring-violet-500 resize-none bg-white py-3 px-4"
|
104 |
+
placeholder="Saisissez votre sujet de dissertation..."></textarea>
|
105 |
+
<div class="absolute bottom-3 right-3 flex items-center space-x-2 text-gray-400">
|
106 |
+
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
107 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
|
108 |
+
</svg>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
</div>
|
112 |
|
113 |
+
<!-- Submit Button -->
|
114 |
+
<button id="submit-btn" class="w-full py-4 px-6 rounded-xl bg-gradient-to-r from-violet-600 to-indigo-600 text-white font-medium shadow-lg shadow-violet-200 hover:shadow-xl hover:shadow-violet-300 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-violet-500 focus:ring-offset-2">
|
115 |
+
<span class="flex items-center justify-center space-x-2">
|
116 |
+
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
117 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" />
|
118 |
+
</svg>
|
119 |
+
<span>Générer la dissertation</span>
|
120 |
+
</span>
|
121 |
</button>
|
122 |
|
123 |
+
<!-- Response Section -->
|
124 |
+
<div id="response" class="hidden mt-8 prose prose-violet max-w-none">
|
125 |
+
<div class="bg-gradient-to-r from-gray-50 to-white rounded-xl p-6 border border-gray-100">
|
126 |
+
<!-- La réponse sera insérée ici -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
</div>
|
128 |
</div>
|
129 |
|
130 |
+
<!-- Copy Button -->
|
131 |
+
<button id="copy-btn" class="hidden w-full py-3 px-6 rounded-xl bg-gray-50 text-gray-700 font-medium border border-gray-200 hover:bg-gray-100 transform hover:-translate-y-0.5 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2">
|
132 |
+
<span class="flex items-center justify-center space-x-2">
|
133 |
+
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
134 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
135 |
+
</svg>
|
136 |
+
<span>Copier la dissertation</span>
|
137 |
+
</span>
|
138 |
</button>
|
139 |
</div>
|
140 |
</div>
|
141 |
</div>
|
142 |
</div>
|
143 |
|
|
|
144 |
<script>
|
145 |
+
|
146 |
+
|
147 |
+
$(document).ready(function() {
|
148 |
+
// Configuration de marked avec support de la syntaxe GFM
|
149 |
+
marked.setOptions({
|
150 |
+
breaks: true,
|
151 |
+
gfm: true,
|
152 |
+
headerIds: true,
|
153 |
+
langPrefix: 'language-',
|
154 |
+
smartLists: true,
|
155 |
+
smartypants: true
|
156 |
+
});
|
157 |
|
158 |
+
// Configuration des notifications
|
159 |
+
const Toast = Swal.mixin({
|
160 |
+
toast: true,
|
161 |
+
position: 'top-end',
|
162 |
+
showConfirmButton: false,
|
163 |
+
timer: 3000,
|
164 |
+
timerProgressBar: true,
|
165 |
+
customClass: {
|
166 |
+
popup: 'rounded-lg shadow-xl border border-gray-100'
|
167 |
+
}
|
168 |
+
});
|
169 |
|
170 |
+
// Gestion du changement de cours
|
171 |
+
$('#course-select').change(function() {
|
172 |
+
const courseId = $(this).val();
|
173 |
+
if (courseId) {
|
174 |
$.ajax({
|
175 |
+
url: `/api/philosophy/courses/${courseId}`,
|
176 |
method: 'GET',
|
177 |
+
beforeSend: function() {
|
178 |
+
$('.course-meta').addClass('animate-pulse');
|
179 |
+
},
|
180 |
+
success: function(course) {
|
181 |
+
$('.course-meta').removeClass('hidden animate-pulse')
|
182 |
+
.addClass('animate-fadeIn');
|
183 |
+
$('#course-author span').text(`Pr. ${course.author}`);
|
184 |
+
$('#course-date span').text(new Date(course.updated_at).toLocaleDateString('fr-FR', {
|
185 |
+
day: 'numeric',
|
186 |
+
month: 'long',
|
187 |
+
year: 'numeric' }));
|
188 |
+
|
189 |
+
// Afficher une notification de succès
|
190 |
+
Toast.fire({
|
191 |
+
icon: 'success',
|
192 |
+
title: 'Cours chargé avec succès'
|
193 |
});
|
194 |
},
|
195 |
error: function() {
|
196 |
+
Toast.fire({
|
197 |
+
icon: 'error',
|
198 |
+
title: 'Erreur',
|
199 |
+
text: 'Impossible de charger les détails du cours'
|
200 |
+
});
|
201 |
}
|
202 |
});
|
203 |
+
} else {
|
204 |
+
$('.course-meta').addClass('animate-fadeOut').on('animationend', function() {
|
205 |
+
$(this).addClass('hidden').removeClass('animate-fadeOut');
|
206 |
+
});
|
207 |
+
}
|
208 |
+
});
|
209 |
|
210 |
+
// Gestion de la soumission avec conversion en Markdown
|
211 |
+
$('#submit-btn').click(function() {
|
212 |
+
const question = $('#question').val().trim();
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
+
if (!question) {
|
215 |
+
$('#question').addClass('animate-shake border-red-300');
|
216 |
+
setTimeout(() => {
|
217 |
+
$('#question').removeClass('animate-shake border-red-300');
|
218 |
+
}, 1000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
+
Swal.fire({
|
221 |
+
icon: 'warning',
|
222 |
+
title: 'Champ requis',
|
223 |
+
text: 'Veuillez saisir votre sujet de dissertation',
|
224 |
+
showClass: {
|
225 |
+
popup: 'animate__animated animate__fadeInDown'
|
226 |
+
},
|
227 |
+
hideClass: {
|
228 |
+
popup: 'animate__animated animate__fadeOutUp'
|
229 |
+
},
|
230 |
+
customClass: {
|
231 |
+
popup: 'rounded-2xl',
|
232 |
+
confirmButton: 'bg-violet-600 hover:bg-violet-700 text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200'
|
233 |
+
}
|
234 |
});
|
235 |
+
return;
|
236 |
+
}
|
237 |
|
238 |
+
Swal.fire({
|
239 |
+
title: 'Génération en cours',
|
240 |
+
html: `<div class="animate-pulse">Veuillez patienter quelques instants...</div>`,
|
241 |
+
allowOutsideClick: false,
|
242 |
+
showConfirmButton: false
|
243 |
+
});
|
244 |
|
245 |
+
const data = {
|
246 |
+
question: question,
|
247 |
+
type: $('#type-select').val(),
|
248 |
+
courseId: $('#course-select').val() || null
|
249 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
|
251 |
+
$.ajax({
|
252 |
+
url: '/submit_philo',
|
253 |
+
method: 'POST',
|
254 |
+
contentType: 'application/json',
|
255 |
+
data: JSON.stringify(data),
|
256 |
+
success: function(data) {
|
257 |
+
Swal.close();
|
258 |
+
|
259 |
+
// Conversion et affichage en Markdown
|
260 |
+
const htmlContent = marked.parse(data.response);
|
261 |
+
$('#response > div').html(htmlContent);
|
262 |
+
$('#response').removeClass('hidden').addClass('animate-fadeIn');
|
263 |
+
|
264 |
+
Toast.fire({
|
265 |
+
icon: 'success',
|
266 |
+
title: 'Dissertation générée avec succès',
|
267 |
+
timer: 2000
|
268 |
+
});
|
269 |
+
|
270 |
+
// Afficher le bouton de copie
|
271 |
+
$('#copy-btn').removeClass('hidden').addClass('animate-slideUp');
|
272 |
+
},
|
273 |
+
error: function() {
|
274 |
+
Swal.fire({
|
275 |
+
icon: 'error',
|
276 |
+
title: 'Erreur de génération',
|
277 |
+
text: 'Une erreur est survenue lors de la génération de votre dissertation.',
|
278 |
+
customClass: {
|
279 |
+
popup: 'rounded-2xl',
|
280 |
+
confirmButton: 'bg-violet-600 hover:bg-violet-700 text-white font-medium py-2 px-4 rounded-lg transition-colors duration-200'
|
281 |
+
}
|
282 |
+
});
|
283 |
+
}
|
284 |
});
|
285 |
+
});
|
286 |
+
});
|
287 |
+
|
288 |
</script>
|
289 |
</body>
|
290 |
</html>
|