Docfile commited on
Commit
4d3627a
·
verified ·
1 Parent(s): 73dff44

Delete templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +0 -385
templates/index.html DELETED
@@ -1,385 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="fr">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Mariam M-0 | Solution Mathématique</title>
7
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
8
- <script>
9
- window.MathJax = {
10
- tex: {
11
- inlineMath: [['$', '$'], ['\\(', '\\)']],
12
- displayMath: [['$$', '$$'], ['\\[', '\\]']],
13
- processEscapes: true,
14
- packages: ['base', 'ams', 'noerrors', 'noundefined']
15
- },
16
- options: {
17
- ignoreHtmlClass: 'tex2jax_ignore',
18
- processHtmlClass: 'tex2jax_process'
19
- },
20
- svg: {
21
- fontCache: 'global'
22
- }
23
- };
24
- </script>
25
- <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
26
- <style>
27
- @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');
28
-
29
- body {
30
- font-family: 'Space Grotesk', sans-serif;
31
- background: linear-gradient(135deg, #F0F8FF 0%, #FFFFFF 100%);
32
- min-height: 100vh;
33
- color: #1e3a8a;
34
- }
35
-
36
- .glass-card {
37
- background: rgba(255, 255, 255, 0.95);
38
- backdrop-filter: blur(10px);
39
- border: 1px solid rgba(0, 0, 0, 0.1);
40
- box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
41
- }
42
-
43
- .uploadArea {
44
- background: linear-gradient(145deg, rgba(219, 234, 254, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
45
- border: 2px dashed #3b82f6;
46
- }
47
-
48
- .uploadArea:hover {
49
- border-color: #2563eb;
50
- transform: translateY(-2px);
51
- }
52
-
53
- .neon-button {
54
- background: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%);
55
- box-shadow: 0 0 15px rgba(37, 99, 235, 0.3);
56
- transition: all 0.3s ease;
57
- color: white;
58
- }
59
-
60
- .neon-button:hover {
61
- box-shadow: 0 0 25px rgba(37, 99, 235, 0.5);
62
- transform: translateY(-2px);
63
- }
64
-
65
- .loader {
66
- width: 48px;
67
- height: 48px;
68
- border: 3px solid #3b82f6;
69
- border-bottom-color: transparent;
70
- border-radius: 50%;
71
- display: inline-block;
72
- box-sizing: border-box;
73
- animation: rotation 1s linear infinite;
74
- }
75
-
76
- @keyframes rotation {
77
- 0% { transform: rotate(0deg); }
78
- 100% { transform: rotate(360deg); }
79
- }
80
-
81
- .thought-box {
82
- transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
83
- max-height: 0;
84
- overflow: hidden;
85
- }
86
-
87
- .thought-box.open {
88
- max-height: 1000px;
89
- }
90
-
91
- .preview-container {
92
- display: flex;
93
- justify-content: center;
94
- align-items: center;
95
- margin-top: 20px;
96
- }
97
-
98
- .preview-image {
99
- max-width: 100%; /* Image responsive */
100
- max-height: 300px;
101
- border-radius: 8px;
102
- border: 2px solid #bfdbfe;
103
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
104
- }
105
-
106
- #thoughtsContent, #answerContent {
107
- max-height: 500px;
108
- overflow-y: auto;
109
- color: #1e3a8a;
110
- }
111
-
112
- .timestamp {
113
- color: #3b82f6;
114
- margin-left: 10px;
115
- font-size: 0.9em;
116
- }
117
-
118
- /* Pleine largeur pour les zones de réponse */
119
- #solution {
120
- width: 100%;
121
- padding-left: 1rem;
122
- padding-right: 1rem;
123
- box-sizing: border-box;
124
- }
125
-
126
- .solution-card {
127
- width: 95%;
128
- margin: 0 auto;
129
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
130
- }
131
-
132
- @media (min-width: 768px) {
133
- .solution-card {
134
- width: 85%;
135
- }
136
- }
137
- </style>
138
- </head>
139
- <body class="p-4 md:p-8 bg-gray-100">
140
- <div class="container mx-auto px-4 md:px-8 max-w-4xl">
141
- <div class="glass-card rounded-3xl p-8 md:p-12">
142
- <div class="text-center mb-12">
143
- <h1 class="text-3xl md:text-5xl font-bold text-blue-900 mb-4">Mariam M-0</h1>
144
- <p class="text-blue-600 text-base md:text-lg">Solution Mathématique Intelligente</p>
145
- </div>
146
-
147
- <form id="problemForm" class="space-y-8" enctype="multipart/form-data">
148
- <div class="relative">
149
- <div class="uploadArea rounded-2xl p-8 md:p-12 text-center transition-all duration-300 cursor-pointer flex flex-col items-center justify-center">
150
- <input type="file" id="imageInput" name="image" accept="image/*" class="absolute inset-0 w-full h-full opacity-0 cursor-pointer">
151
- <div class="space-y-4">
152
- <div class="w-20 h-20 mx-auto border-2 border-blue-400 rounded-full flex items-center justify-center">
153
- <svg class="w-10 h-10 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
154
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" />
155
- </svg>
156
- </div>
157
- <div class="text-blue-600 text-base md:text-lg font-medium">Déposez votre image ici</div>
158
- <div class="text-blue-400 text-sm">ou cliquez pour sélectionner</div>
159
- </div>
160
- </div>
161
- <div id="imagePreview" class="preview-container hidden mt-4">
162
- <img id="previewImage" src="#" alt="Prévisualisation de l'image" class="preview-image">
163
- </div>
164
- </div>
165
-
166
- <button type="submit" class="neon-button w-full py-4 rounded-xl font-medium text-lg transition-all duration-300">
167
- Résoudre le problème
168
- </button>
169
- </form>
170
-
171
- <div id="loader" class="hidden mt-12">
172
- <div class="flex flex-col items-center justify-center space-y-4">
173
- <span class="loader"></span>
174
- <div class="text-blue-600 text-lg">Analyse en cours...</div>
175
- </div>
176
- </div>
177
-
178
- <div id="solution" class="hidden mt-12 space-y-8">
179
- <div class="glass-card solution-card rounded-2xl p-6">
180
- <button id="thoughtsToggle" class="w-full flex justify-between items-center text-left text-lg font-medium text-blue-900 hover:text-blue-600 transition-colors">
181
- <div class="flex items-center">
182
- <span>Processus de Réflexion</span>
183
- <span id="timestamp" class="timestamp"></span>
184
- </div>
185
- <svg class="w-6 h-6 transform transition-transform duration-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
186
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
187
- </svg>
188
- </button>
189
- <div id="thoughtsBox" class="thought-box">
190
- <div id="thoughtsContent" class="prose max-w-none mt-4"></div>
191
- </div>
192
- </div>
193
-
194
- <div class="glass-card solution-card rounded-2xl p-8">
195
- <h3 class="text-2xl font-bold text-blue-900 mb-6">Solution</h3>
196
- <div id="answerContent" class="prose max-w-none"></div>
197
- </div>
198
- </div>
199
- </div>
200
- </div>
201
-
202
- <script>
203
- document.addEventListener('DOMContentLoaded', () => {
204
- const form = document.getElementById('problemForm');
205
- const imageInput = document.getElementById('imageInput');
206
- const loader = document.getElementById('loader');
207
- const solutionDiv = document.getElementById('solution');
208
- const thoughtsContent = document.getElementById('thoughtsContent');
209
- const answerContent = document.getElementById('answerContent');
210
- const thoughtsToggle = document.getElementById('thoughtsToggle');
211
- const thoughtsBox = document.getElementById('thoughtsBox');
212
- const imagePreview = document.getElementById('imagePreview');
213
- const previewImage = document.getElementById('previewImage');
214
- const timestamp = document.getElementById('timestamp');
215
-
216
- let startTime = null;
217
- let timerInterval = null;
218
-
219
- function updateTimestamp() {
220
- if (startTime) {
221
- const elapsed = Math.floor((Date.now() - startTime) / 1000);
222
- timestamp.textContent = elapsed + "s";
223
- }
224
- }
225
-
226
- function startTimer() {
227
- startTime = Date.now();
228
- timerInterval = setInterval(updateTimestamp, 1000);
229
- updateTimestamp();
230
- }
231
-
232
- function stopTimer() {
233
- if (timerInterval) {
234
- clearInterval(timerInterval);
235
- timerInterval = null;
236
- }
237
- startTime = null;
238
- timestamp.textContent = "";
239
- }
240
-
241
- thoughtsToggle.addEventListener('click', () => {
242
- thoughtsBox.classList.toggle('open');
243
- thoughtsToggle.querySelector('svg').classList.toggle('rotate-180');
244
- });
245
-
246
- imageInput.addEventListener('change', function(e) {
247
- const file = this.files[0];
248
- if (file) {
249
- const reader = new FileReader();
250
- reader.onload = function(e) {
251
- previewImage.src = e.target.result;
252
- imagePreview.classList.remove('hidden');
253
- }
254
- reader.readAsDataURL(file);
255
- } else {
256
- previewImage.src = "";
257
- imagePreview.classList.add('hidden');
258
- }
259
- });
260
-
261
- const dropZone = document.querySelector('.uploadArea');
262
-
263
- ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
264
- dropZone.addEventListener(eventName, preventDefaults, false);
265
- });
266
-
267
- function preventDefaults(e) {
268
- e.preventDefault();
269
- e.stopPropagation();
270
- }
271
-
272
- ['dragenter', 'dragover'].forEach(eventName => {
273
- dropZone.addEventListener(eventName, highlight, false);
274
- });
275
-
276
- ['dragleave', 'drop'].forEach(eventName => {
277
- dropZone.addEventListener(eventName, unhighlight, false);
278
- });
279
-
280
- function highlight(e) {
281
- dropZone.classList.add('border-blue-600');
282
- }
283
-
284
- function unhighlight(e) {
285
- dropZone.classList.remove('border-blue-600');
286
- }
287
-
288
- dropZone.addEventListener('drop', handleDrop, false);
289
-
290
- function handleDrop(e) {
291
- const dt = e.dataTransfer;
292
- const files = dt.files;
293
-
294
- if (files.length) {
295
- imageInput.files = files;
296
- const file = files[0];
297
- const reader = new FileReader();
298
- reader.onload = function(e) {
299
- previewImage.src = e.target.result;
300
- imagePreview.classList.remove('hidden');
301
- }
302
- reader.readAsDataURL(file);
303
- }
304
- }
305
-
306
- form.addEventListener('submit', async (event) => {
307
- event.preventDefault();
308
- const file = imageInput.files[0];
309
- if (!file) {
310
- alert('Veuillez sélectionner une image.');
311
- return;
312
- }
313
-
314
- startTimer();
315
-
316
- loader.classList.remove('hidden');
317
- solutionDiv.classList.add('hidden');
318
- thoughtsContent.innerHTML = '';
319
- answerContent.innerHTML = '';
320
- thoughtsBox.classList.add('open');
321
-
322
- const formData = new FormData();
323
- formData.append('image', file);
324
-
325
- try {
326
- let currentMode = null;
327
- const response = await fetch('/solve', {
328
- method: 'POST',
329
- body: formData
330
- });
331
-
332
- const reader = response.body.getReader();
333
- const decoder = new TextDecoder();
334
- let buffer = '';
335
-
336
- while (true) {
337
- const { done, value } = await reader.read();
338
- if (done) {
339
- stopTimer();
340
- break;
341
- }
342
-
343
- buffer += decoder.decode(value, { stream: true });
344
- let eolIndex;
345
-
346
- while ((eolIndex = buffer.indexOf('\n\n')) >= 0) {
347
- const line = buffer.slice(0, eolIndex).trim();
348
- buffer = buffer.slice(eolIndex + 2);
349
-
350
- if (line.startsWith('data:')) {
351
- const data = JSON.parse(line.slice(5));
352
-
353
- if (data.mode) {
354
- currentMode = data.mode;
355
- loader.classList.add('hidden');
356
- solutionDiv.classList.remove('hidden');
357
- }
358
-
359
- if (data.content) {
360
- const content = data.content;
361
- if (currentMode === 'thinking') {
362
- thoughtsContent.innerHTML += `<p>${content}</p>`;
363
- thoughtsContent.scrollTop = thoughtsContent.scrollHeight;
364
- } else if (currentMode === 'answering') {
365
- answerContent.innerHTML += content;
366
- if (window.MathJax) {
367
- MathJax.typesetPromise([answerContent]).catch((err) => console.log('MathJax error:', err));
368
- }
369
- }
370
- }
371
- }
372
- }
373
- }
374
-
375
- } catch (error) {
376
- console.error('Erreur:', error);
377
- alert('Une erreur est survenue lors du traitement de la requête.');
378
- loader.classList.add('hidden');
379
- stopTimer();
380
- }
381
- });
382
- });
383
- </script>
384
- </body>
385
- </html>