Update app.py
Browse files
app.py
CHANGED
|
@@ -638,6 +638,8 @@ def clear_all_tasks():
|
|
| 638 |
return jsonify({'success': True})
|
| 639 |
|
| 640 |
|
|
|
|
|
|
|
| 641 |
# Ajouter cette route dans votre fichier app.py
|
| 642 |
|
| 643 |
@app.route('/stats')
|
|
@@ -682,6 +684,15 @@ def system_stats():
|
|
| 682 |
GROUP BY source_type
|
| 683 |
''').fetchall()
|
| 684 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
conn.close()
|
| 686 |
|
| 687 |
# Créer le HTML minimaliste
|
|
@@ -727,15 +738,40 @@ def system_stats():
|
|
| 727 |
|
| 728 |
html += ''' </ul>
|
| 729 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 730 |
<p><a href="/">Retour à l'accueil</a></p>
|
| 731 |
</body>
|
| 732 |
</html>'''
|
| 733 |
|
| 734 |
return html
|
| 735 |
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
| 739 |
# =======================
|
| 740 |
# Initialisation
|
| 741 |
# =======================
|
|
|
|
| 638 |
return jsonify({'success': True})
|
| 639 |
|
| 640 |
|
| 641 |
+
# Ajouter cette route dans votre fichier app.py
|
| 642 |
+
|
| 643 |
# Ajouter cette route dans votre fichier app.py
|
| 644 |
|
| 645 |
@app.route('/stats')
|
|
|
|
| 684 |
GROUP BY source_type
|
| 685 |
''').fetchall()
|
| 686 |
|
| 687 |
+
# Récupérer tous les résumés complétés (limité aux 50 derniers)
|
| 688 |
+
all_summaries = conn.execute('''
|
| 689 |
+
SELECT task_id, filename, summary_type, summary, created_at, completed_at, source_type
|
| 690 |
+
FROM tasks
|
| 691 |
+
WHERE status = 'completed'
|
| 692 |
+
ORDER BY completed_at DESC
|
| 693 |
+
LIMIT 50
|
| 694 |
+
''').fetchall()
|
| 695 |
+
|
| 696 |
conn.close()
|
| 697 |
|
| 698 |
# Créer le HTML minimaliste
|
|
|
|
| 738 |
|
| 739 |
html += ''' </ul>
|
| 740 |
|
| 741 |
+
<hr>
|
| 742 |
+
|
| 743 |
+
<h2>Résumés des utilisateurs (50 derniers)</h2>
|
| 744 |
+
'''
|
| 745 |
+
|
| 746 |
+
if not all_summaries:
|
| 747 |
+
html += ' <p>Aucun résumé disponible</p>\n'
|
| 748 |
+
else:
|
| 749 |
+
for i, summary in enumerate(all_summaries, 1):
|
| 750 |
+
source_name = 'Fichier' if summary['source_type'] == 'file' else 'YouTube'
|
| 751 |
+
created = summary['created_at'][:19] if summary['created_at'] else 'N/A'
|
| 752 |
+
completed = summary['completed_at'][:19] if summary['completed_at'] else 'N/A'
|
| 753 |
+
|
| 754 |
+
html += f'''
|
| 755 |
+
<h3>Résumé #{i}</h3>
|
| 756 |
+
<ul>
|
| 757 |
+
<li>Fichier : {summary["filename"]}</li>
|
| 758 |
+
<li>Type : {summary["summary_type"].capitalize()}</li>
|
| 759 |
+
<li>Source : {source_name}</li>
|
| 760 |
+
<li>Créé le : {created}</li>
|
| 761 |
+
<li>Complété le : {completed}</li>
|
| 762 |
+
</ul>
|
| 763 |
+
<p><strong>Résumé :</strong></p>
|
| 764 |
+
<pre>{summary["summary"]}</pre>
|
| 765 |
+
<hr>
|
| 766 |
+
'''
|
| 767 |
+
|
| 768 |
+
html += '''
|
| 769 |
<p><a href="/">Retour à l'accueil</a></p>
|
| 770 |
</body>
|
| 771 |
</html>'''
|
| 772 |
|
| 773 |
return html
|
| 774 |
|
|
|
|
|
|
|
|
|
|
| 775 |
# =======================
|
| 776 |
# Initialisation
|
| 777 |
# =======================
|