Update templates/gere.html
Browse files- templates/gere.html +193 -45
templates/gere.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
background-color: #f8f9fa;
|
| 12 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 13 |
}
|
| 14 |
-
|
| 15 |
.container {
|
| 16 |
max-width: 1200px;
|
| 17 |
margin: 0 auto;
|
|
@@ -163,7 +163,7 @@
|
|
| 163 |
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
| 164 |
{{ message }}
|
| 165 |
<button type="button" class="close" data-dismiss="alert" aria-label="Fermer">
|
| 166 |
-
<span aria-hidden="true"
|
| 167 |
</button>
|
| 168 |
</div>
|
| 169 |
{% endfor %}
|
|
@@ -250,7 +250,7 @@
|
|
| 250 |
<li class="list-group-item">
|
| 251 |
<div class="d-flex justify-content-between align-items-center">
|
| 252 |
<span class="display-mode">
|
| 253 |
-
{{ sous_categorie.nom }}
|
| 254 |
<small class="text-muted">
|
| 255 |
<i class="fas fa-book mr-1"></i>{{ sous_categorie.matiere.nom }}
|
| 256 |
</small>
|
|
@@ -316,7 +316,7 @@
|
|
| 316 |
<strong>{{ texte.titre }}</strong>
|
| 317 |
<br>
|
| 318 |
<small class="text-muted">
|
| 319 |
-
<i class="fas fa-list mr-1"></i>{{ texte.sous_categorie.nom }}
|
| 320 |
<i class="fas fa-book ml-2 mr-1"></i>{{ texte.sous_categorie.matiere.nom }}
|
| 321 |
</small>
|
| 322 |
</span>
|
|
@@ -418,51 +418,119 @@
|
|
| 418 |
</div>
|
| 419 |
</div>
|
| 420 |
|
| 421 |
-
<!-- Formulaire d'ajout d'un texte avec IA -->
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
</div>
|
| 426 |
-
<div class="
|
| 427 |
-
<
|
| 428 |
-
|
| 429 |
-
<div class="form-group">
|
| 430 |
-
<label for="titre_texte">Titre du Texte</label>
|
| 431 |
-
<input type="text" id="titre_texte" name="titre_texte" class="form-control" required>
|
| 432 |
-
</div>
|
| 433 |
-
<div class="form-group">
|
| 434 |
-
<label for="sous_categorie_id">Sous-Catégorie</label>
|
| 435 |
-
<select id="sous_categorie_id" name="sous_categorie_id" class="form-control" required>
|
| 436 |
-
{% for sous_categorie in sous_categories %}
|
| 437 |
-
<option value="{{ sous_categorie.id }}">{{ sous_categorie.nom }} ({{ sous_categorie.matiere.nom }})</option>
|
| 438 |
-
{% endfor %}
|
| 439 |
-
</select>
|
| 440 |
-
</div>
|
| 441 |
-
<div class="form-group">
|
| 442 |
-
<label for="youtube_url">URL de la vidéo YouTube</label>
|
| 443 |
-
<input type="text" id="youtube_url" name="youtube_url" class="form-control" placeholder="https://www.youtube.com/watch?v=..." required>
|
| 444 |
-
</div>
|
| 445 |
-
<div class="form-group">
|
| 446 |
-
<label for="prompt">Prompt pour l'IA</label>
|
| 447 |
-
<textarea id="prompt" name="prompt" class="form-control" rows="3" placeholder="Entrez votre question ou instruction pour l'IA (ex. : 'Résumer la vidéo' ou 'Extraire les points clés')" required></textarea>
|
| 448 |
-
</div>
|
| 449 |
-
<div class="form-group">
|
| 450 |
-
<label for="model">Modèle Gemini</label>
|
| 451 |
-
<select id="model" name="model" class="form-control">
|
| 452 |
-
<option value="gemini-2.5-pro-exp-03-25">gemini-2.5-pro-exp-03-25</option>
|
| 453 |
-
<option value="gemini-1.5-pro">gemini-1.5-pro</option>
|
| 454 |
-
<option value="gemini-1.5-flash">gemini-1.5-flash</option>
|
| 455 |
-
</select>
|
| 456 |
-
</div>
|
| 457 |
-
<button type="submit" class="btn btn-primary btn-icon">
|
| 458 |
-
<i class="fas fa-plus"></i> Générer et Ajouter
|
| 459 |
-
</button>
|
| 460 |
-
</form>
|
| 461 |
</div>
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
</script>
|
| 504 |
-
<!-- The problematic Cloudflare script has been removed from here -->
|
| 505 |
</body>
|
| 506 |
</html>
|
|
|
|
| 11 |
background-color: #f8f9fa;
|
| 12 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 13 |
}
|
| 14 |
+
|
| 15 |
.container {
|
| 16 |
max-width: 1200px;
|
| 17 |
margin: 0 auto;
|
|
|
|
| 163 |
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
| 164 |
{{ message }}
|
| 165 |
<button type="button" class="close" data-dismiss="alert" aria-label="Fermer">
|
| 166 |
+
<span aria-hidden="true">×</span>
|
| 167 |
</button>
|
| 168 |
</div>
|
| 169 |
{% endfor %}
|
|
|
|
| 250 |
<li class="list-group-item">
|
| 251 |
<div class="d-flex justify-content-between align-items-center">
|
| 252 |
<span class="display-mode">
|
| 253 |
+
{{ sous_categorie.nom }}
|
| 254 |
<small class="text-muted">
|
| 255 |
<i class="fas fa-book mr-1"></i>{{ sous_categorie.matiere.nom }}
|
| 256 |
</small>
|
|
|
|
| 316 |
<strong>{{ texte.titre }}</strong>
|
| 317 |
<br>
|
| 318 |
<small class="text-muted">
|
| 319 |
+
<i class="fas fa-list mr-1"></i>{{ texte.sous_categorie.nom }}
|
| 320 |
<i class="fas fa-book ml-2 mr-1"></i>{{ texte.sous_categorie.matiere.nom }}
|
| 321 |
</small>
|
| 322 |
</span>
|
|
|
|
| 418 |
</div>
|
| 419 |
</div>
|
| 420 |
|
| 421 |
+
<!-- Formulaire d'ajout d'un texte avec module IA -->
|
| 422 |
+
<div class="card mt-3">
|
| 423 |
+
<div class="card-header">
|
| 424 |
+
<i class="fas fa-plus-circle mr-2"></i>Ajouter un Texte
|
| 425 |
+
</div>
|
| 426 |
+
<div class="card-body">
|
| 427 |
+
<ul class="nav nav-tabs" id="textInputTabs" role="tablist">
|
| 428 |
+
<li class="nav-item">
|
| 429 |
+
<a class="nav-link active" id="manual-tab" data-toggle="tab" href="#manual-input" role="tab">
|
| 430 |
+
<i class="fas fa-edit"></i> Saisie Manuelle
|
| 431 |
+
</a>
|
| 432 |
+
</li>
|
| 433 |
+
<li class="nav-item">
|
| 434 |
+
<a class="nav-link" id="ia-tab" data-toggle="tab" href="#ia-input" role="tab">
|
| 435 |
+
<i class="fas fa-robot"></i> Génération IA
|
| 436 |
+
</a>
|
| 437 |
+
</li>
|
| 438 |
+
</ul>
|
| 439 |
+
|
| 440 |
+
<div class="tab-content mt-3" id="textInputTabContent">
|
| 441 |
+
<!-- Onglet Saisie Manuelle -->
|
| 442 |
+
<div class="tab-pane fade show active" id="manual-input" role="tabpanel">
|
| 443 |
+
<form method="post">
|
| 444 |
+
<input type="hidden" name="action" value="add_texte">
|
| 445 |
+
<div class="form-group">
|
| 446 |
+
<label for="titre_texte">Titre du Texte</label>
|
| 447 |
+
<input type="text" id="titre_texte" name="titre_texte" class="form-control" required>
|
| 448 |
</div>
|
| 449 |
+
<div class="form-group">
|
| 450 |
+
<label for="contenu_texte">Contenu du Texte</label>
|
| 451 |
+
<textarea id="contenu_texte" name="contenu_texte" class="form-control" rows="5" required></textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 452 |
</div>
|
| 453 |
+
<div class="form-group">
|
| 454 |
+
<label for="sous_categorie_id">Sous-Catégorie</label>
|
| 455 |
+
<select id="sous_categorie_id" name="sous_categorie_id" class="form-control" required>
|
| 456 |
+
{% for sous_categorie in sous_categories %}
|
| 457 |
+
<option value="{{ sous_categorie.id }}">{{ sous_categorie.nom }} ({{ sous_categorie.matiere.nom }})</option>
|
| 458 |
+
{% endfor %}
|
| 459 |
+
</select>
|
| 460 |
+
</div>
|
| 461 |
+
<button type="submit" class="btn btn-primary btn-icon">
|
| 462 |
+
<i class="fas fa-plus"></i> Ajouter
|
| 463 |
+
</button>
|
| 464 |
+
</form>
|
| 465 |
+
</div>
|
| 466 |
+
|
| 467 |
+
<!-- Onglet Génération IA -->
|
| 468 |
+
<div class="tab-pane fade" id="ia-input" role="tabpanel">
|
| 469 |
+
<form method="post" id="ia-generation-form">
|
| 470 |
+
<input type="hidden" name="action" value="generate_ia_content">
|
| 471 |
+
<div class="form-group">
|
| 472 |
+
<label for="ia_titre_texte">Titre du Texte</label>
|
| 473 |
+
<input type="text" id="ia_titre_texte" name="ia_titre_texte" class="form-control" required>
|
| 474 |
+
</div>
|
| 475 |
+
<div class="form-group">
|
| 476 |
+
<label for="youtube_url">URL de la vidéo YouTube</label>
|
| 477 |
+
<input type="url" id="youtube_url" name="youtube_url" class="form-control" placeholder="https://www.youtube.com/watch?v=..." required>
|
| 478 |
+
</div>
|
| 479 |
+
<div class="form-group">
|
| 480 |
+
<label for="ia_prompt">Prompt pour l'IA</label>
|
| 481 |
+
<textarea id="ia_prompt" name="ia_prompt" class="form-control" rows="3" placeholder="Exemple: Faire un résumé détaillé de cette vidéo avec les points clés" required></textarea>
|
| 482 |
+
</div>
|
| 483 |
+
<div class="form-group">
|
| 484 |
+
<label for="ia_model">Modèle Gemini</label>
|
| 485 |
+
<select id="ia_model" name="ia_model" class="form-control">
|
| 486 |
+
<option value="gemini-2.5-pro-exp-03-25">gemini-2.5-pro-exp-03-25</option>
|
| 487 |
+
<option value="gemini-1.5-pro">gemini-1.5-pro</option>
|
| 488 |
+
<option value="gemini-1.5-flash">gemini-1.5-flash</option>
|
| 489 |
+
</select>
|
| 490 |
+
</div>
|
| 491 |
+
<div class="form-group">
|
| 492 |
+
<label for="ia_sous_categorie_id">Sous-Catégorie</label>
|
| 493 |
+
<select id="ia_sous_categorie_id" name="ia_sous_categorie_id" class="form-control" required>
|
| 494 |
+
{% for sous_categorie in sous_categories %}
|
| 495 |
+
<option value="{{ sous_categorie.id }}">{{ sous_categorie.nom }} ({{ sous_categorie.matiere.nom }})</option>
|
| 496 |
+
{% endfor %}
|
| 497 |
+
</select>
|
| 498 |
+
</div>
|
| 499 |
+
<button type="submit" id="generate-content-btn" class="btn btn-info btn-icon">
|
| 500 |
+
<i class="fas fa-magic"></i> Générer le Contenu
|
| 501 |
+
</button>
|
| 502 |
+
<div id="ia-loading" class="mt-3 d-none">
|
| 503 |
+
<div class="spinner-border text-primary" role="status">
|
| 504 |
+
<span class="sr-only">Génération en cours...</span>
|
| 505 |
+
</div>
|
| 506 |
+
<span class="ml-2">Analyse de la vidéo en cours, veuillez patienter...</span>
|
| 507 |
+
</div>
|
| 508 |
+
<div id="ia-result-container" class="mt-3 d-none">
|
| 509 |
+
<div class="form-group">
|
| 510 |
+
<label for="ia_generated_content">Contenu Généré</label>
|
| 511 |
+
<textarea id="ia_generated_content" name="ia_generated_content" class="form-control" rows="10" readonly></textarea>
|
| 512 |
+
</div>
|
| 513 |
+
<button type="button" id="use-content-btn" class="btn btn-success btn-icon">
|
| 514 |
+
<i class="fas fa-check"></i> Utiliser ce Contenu
|
| 515 |
+
</button>
|
| 516 |
+
<button type="button" id="modify-content-btn" class="btn btn-warning btn-icon ml-2">
|
| 517 |
+
<i class="fas fa-edit"></i> Modifier avant Utilisation
|
| 518 |
+
</button>
|
| 519 |
+
</div>
|
| 520 |
+
</form>
|
| 521 |
+
<form method="post" id="submit-ia-content-form" class="d-none">
|
| 522 |
+
<input type="hidden" name="action" value="add_texte">
|
| 523 |
+
<input type="hidden" id="final_titre_texte" name="titre_texte">
|
| 524 |
+
<input type="hidden" id="final_contenu_texte" name="contenu_texte">
|
| 525 |
+
<input type="hidden" id="final_sous_categorie_id" name="sous_categorie_id">
|
| 526 |
+
</form>
|
| 527 |
</div>
|
| 528 |
</div>
|
| 529 |
</div>
|
| 530 |
+
</div>
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
|
| 534 |
|
| 535 |
<!-- Scripts -->
|
| 536 |
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
|
|
|
|
| 568 |
}
|
| 569 |
});
|
| 570 |
});
|
| 571 |
+
|
| 572 |
+
// Ajouter ce code à la fin de votre script existant dans gere.html (avant la balise </script> finale)
|
| 573 |
+
|
| 574 |
+
// Fonctionnalité pour la génération de contenu IA
|
| 575 |
+
$(document).ready(function() {
|
| 576 |
+
// Gestionnaire pour le formulaire de génération IA
|
| 577 |
+
$('#ia-generation-form').on('submit', function(e) {
|
| 578 |
+
e.preventDefault();
|
| 579 |
+
|
| 580 |
+
const youtubeUrl = $('#youtube_url').val();
|
| 581 |
+
const prompt = $('#ia_prompt').val();
|
| 582 |
+
const model = $('#ia_model').val();
|
| 583 |
+
|
| 584 |
+
if (!youtubeUrl || !prompt) {
|
| 585 |
+
alert('Veuillez remplir tous les champs requis.');
|
| 586 |
+
return;
|
| 587 |
+
}
|
| 588 |
+
|
| 589 |
+
// Afficher l'indicateur de chargement
|
| 590 |
+
$('#generate-content-btn').prop('disabled', true);
|
| 591 |
+
$('#ia-loading').removeClass('d-none');
|
| 592 |
+
$('#ia-result-container').addClass('d-none');
|
| 593 |
+
|
| 594 |
+
// Appel AJAX pour générer le contenu
|
| 595 |
+
$.ajax({
|
| 596 |
+
url: '/generate-content',
|
| 597 |
+
type: 'POST',
|
| 598 |
+
contentType: 'application/json',
|
| 599 |
+
data: JSON.stringify({
|
| 600 |
+
youtube_url: youtubeUrl,
|
| 601 |
+
prompt: prompt,
|
| 602 |
+
model: model
|
| 603 |
+
}),
|
| 604 |
+
success: function(response) {
|
| 605 |
+
$('#generate-content-btn').prop('disabled', false);
|
| 606 |
+
$('#ia-loading').addClass('d-none');
|
| 607 |
+
|
| 608 |
+
if (response.success) {
|
| 609 |
+
// Afficher le résultat
|
| 610 |
+
$('#ia_generated_content').val(response.text);
|
| 611 |
+
$('#ia-result-container').removeClass('d-none');
|
| 612 |
+
} else {
|
| 613 |
+
alert('Erreur lors de la génération du contenu: ' + response.error);
|
| 614 |
+
}
|
| 615 |
+
},
|
| 616 |
+
error: function(xhr, status, error) {
|
| 617 |
+
$('#generate-content-btn').prop('disabled', false);
|
| 618 |
+
$('#ia-loading').addClass('d-none');
|
| 619 |
+
alert('Erreur lors de la communication avec le serveur: ' + error);
|
| 620 |
+
}
|
| 621 |
+
});
|
| 622 |
+
});
|
| 623 |
+
|
| 624 |
+
// Utiliser le contenu généré tel quel
|
| 625 |
+
$('#use-content-btn').on('click', function() {
|
| 626 |
+
const titre = $('#ia_titre_texte').val();
|
| 627 |
+
const contenu = $('#ia_generated_content').val();
|
| 628 |
+
const sousCategorie = $('#ia_sous_categorie_id').val();
|
| 629 |
+
|
| 630 |
+
// Remplir le formulaire caché et le soumettre
|
| 631 |
+
$('#final_titre_texte').val(titre);
|
| 632 |
+
$('#final_contenu_texte').val(contenu);
|
| 633 |
+
$('#final_sous_categorie_id').val(sousCategorie);
|
| 634 |
+
$('#submit-ia-content-form').submit();
|
| 635 |
+
});
|
| 636 |
+
|
| 637 |
+
// Modifier le contenu avant utilisation
|
| 638 |
+
$('#modify-content-btn').on('click', function() {
|
| 639 |
+
const titre = $('#ia_titre_texte').val();
|
| 640 |
+
const contenu = $('#ia_generated_content').val();
|
| 641 |
+
const sousCategorie = $('#ia_sous_categorie_id').val();
|
| 642 |
+
|
| 643 |
+
// Basculer vers l'onglet manuel et préremplir les champs
|
| 644 |
+
$('#titre_texte').val(titre);
|
| 645 |
+
$('#contenu_texte').val(contenu);
|
| 646 |
+
$('#sous_categorie_id').val(sousCategorie);
|
| 647 |
+
$('#manual-tab').tab('show');
|
| 648 |
+
});
|
| 649 |
+
});
|
| 650 |
+
|
| 651 |
+
|
| 652 |
</script>
|
|
|
|
| 653 |
</body>
|
| 654 |
</html>
|