Docfile commited on
Commit
fc4bc7e
·
verified ·
1 Parent(s): 9615dc9

Update templates/philosophie.html

Browse files
Files changed (1) hide show
  1. templates/philosophie.html +38 -8
templates/philosophie.html CHANGED
@@ -1,4 +1,3 @@
1
- --- START OF FILE philosophie (13).html ---
2
 
3
  <!DOCTYPE html>
4
  <html lang="fr">
@@ -58,7 +57,7 @@
58
  }
59
 
60
  .form-group {
61
- margin-bottom: 15px;
62
  }
63
 
64
  label {
@@ -73,8 +72,7 @@
73
  padding: 15px;
74
  border-radius: 8px;
75
  border: 1px solid var(--border-color);
76
- min-height: 58px; /* Hauteur standard pour select */
77
- margin-bottom: 15px;
78
  font-size: 16px;
79
  line-height: 1.6;
80
  transition: border-color 0.3s, box-shadow 0.3s;
@@ -82,6 +80,7 @@
82
  -webkit-appearance: none;
83
  -moz-appearance: none;
84
  appearance: none;
 
85
  }
86
 
87
  .form-select {
@@ -205,6 +204,17 @@
205
  <option value="type2">Type 2 (Introduction autour d'une citation)</option>
206
  </select>
207
  </div>
 
 
 
 
 
 
 
 
 
 
 
208
  <div class="form-group">
209
  <label for="question">Entrez votre sujet de dissertation</label>
210
  <textarea id="question" v-model="question" placeholder="Entrez votre sujet ou la citation à analyser ici..."></textarea>
@@ -246,13 +256,15 @@
246
  </div>
247
 
248
  <script>
249
- const { createApp, computed } = Vue;
250
 
251
  const app = createApp({
252
  data() {
253
  return {
254
  question: '',
255
- dissertationType: 'type1', // Nouvelle donnée pour le type
 
 
256
  isLoading: false,
257
  errorMessage: null,
258
  dissertation: null
@@ -263,7 +275,23 @@
263
  return this.dissertationType === 'type1' ? 'Type 1' : 'Type 2';
264
  }
265
  },
 
 
 
 
266
  methods: {
 
 
 
 
 
 
 
 
 
 
 
 
267
  async generateDissertation() {
268
  if (!this.question.trim()) {
269
  this.errorMessage = "Veuillez entrer un sujet de dissertation.";
@@ -276,10 +304,10 @@
276
  const response = await fetch('/api/generate_dissertation', {
277
  method: 'POST',
278
  headers: { 'Content-Type': 'application/json' },
279
- // Envoi du sujet ET du type
280
  body: JSON.stringify({
281
  question: this.question,
282
- type: this.dissertationType
 
283
  })
284
  });
285
  const data = await response.json();
@@ -328,7 +356,9 @@
328
  }
329
  });
330
 
 
331
  app.config.compilerOptions.delimiters = ['[[', ']]'];
 
332
  app.mount('#app');
333
  </script>
334
  </body>
 
 
1
 
2
  <!DOCTYPE html>
3
  <html lang="fr">
 
57
  }
58
 
59
  .form-group {
60
+ margin-bottom: 20px;
61
  }
62
 
63
  label {
 
72
  padding: 15px;
73
  border-radius: 8px;
74
  border: 1px solid var(--border-color);
75
+ min-height: 58px;
 
76
  font-size: 16px;
77
  line-height: 1.6;
78
  transition: border-color 0.3s, box-shadow 0.3s;
 
80
  -webkit-appearance: none;
81
  -moz-appearance: none;
82
  appearance: none;
83
+ box-sizing: border-box;
84
  }
85
 
86
  .form-select {
 
204
  <option value="type2">Type 2 (Introduction autour d'une citation)</option>
205
  </select>
206
  </div>
207
+
208
+ <div class="form-group">
209
+ <label for="course-context">Choisir un cours comme contexte (optionnel)</label>
210
+ <select id="course-context" v-model="selectedCourse" class="form-select">
211
+ <option value="">-- Aucun cours en contexte --</option>
212
+ <option v-for="course in courses" :key="course.id" :value="course.id">
213
+ [[ course.title ]]
214
+ </option>
215
+ </select>
216
+ </div>
217
+
218
  <div class="form-group">
219
  <label for="question">Entrez votre sujet de dissertation</label>
220
  <textarea id="question" v-model="question" placeholder="Entrez votre sujet ou la citation à analyser ici..."></textarea>
 
256
  </div>
257
 
258
  <script>
259
+ const { createApp } = Vue;
260
 
261
  const app = createApp({
262
  data() {
263
  return {
264
  question: '',
265
+ dissertationType: 'type1',
266
+ courses: [], // Pour stocker la liste des cours
267
+ selectedCourse: '', // Pour stocker l'ID du cours sélectionné
268
  isLoading: false,
269
  errorMessage: null,
270
  dissertation: null
 
275
  return this.dissertationType === 'type1' ? 'Type 1' : 'Type 2';
276
  }
277
  },
278
+ mounted() {
279
+ // Au chargement du composant, on récupère la liste des cours
280
+ this.fetchCourses();
281
+ },
282
  methods: {
283
+ async fetchCourses() {
284
+ try {
285
+ const response = await fetch('/api/philosophy/courses');
286
+ if (!response.ok) throw new Error('Impossible de charger les cours. Vérifiez la connexion à la base de données.');
287
+ const data = await response.json();
288
+ if (data.error) throw new Error(data.error);
289
+ this.courses = data;
290
+ } catch (error) {
291
+ this.errorMessage = error.message;
292
+ console.error("Erreur de chargement des cours:", error);
293
+ }
294
+ },
295
  async generateDissertation() {
296
  if (!this.question.trim()) {
297
  this.errorMessage = "Veuillez entrer un sujet de dissertation.";
 
304
  const response = await fetch('/api/generate_dissertation', {
305
  method: 'POST',
306
  headers: { 'Content-Type': 'application/json' },
 
307
  body: JSON.stringify({
308
  question: this.question,
309
+ type: this.dissertationType,
310
+ courseId: this.selectedCourse // On envoie l'ID du cours sélectionné
311
  })
312
  });
313
  const data = await response.json();
 
356
  }
357
  });
358
 
359
+ // ⚠️ Changer les délimiteurs pour éviter le conflit avec Jinja2
360
  app.config.compilerOptions.delimiters = ['[[', ']]'];
361
+
362
  app.mount('#app');
363
  </script>
364
  </body>