correction main.py
Build and Push Docker Image / build-and-push (push) Successful in 36s

This commit is contained in:
xavier committed 2026-10-06 00:49:55 +02:00
1 parent 2c78b671cd
commit c24d337670
1 file changed
+14 -4
+14 -4
View File
@@ -347,7 +347,8 @@ def post_delete(sid: str):
return render_history_list()
@rt('/export_models')
def get():
def get(session):
if not session.get("authenticated"): return RedirectResponse('/login')
log_event("system", "SYSTEM", "Demande d'exportation du catalogue de modèles.")
now = datetime.now()
txt_content = f"=== CATALOGUE COMPLET DES MODÈLES (Généré le {now.strftime('%d/%m/%Y à %H:%M:%S')}) ===\n\n"
@@ -401,10 +402,19 @@ def get():
if not desc_fr: desc_fr = "Aucune description fournie."
txt_content += f"Nom : {name}\nID : {m_id}\nTarif : {cout}\nSpécialité : {usage}\nDescription : {desc_fr}\n{'-'*60}\n"
return Response(txt_content, media_type="text/plain")
# SÉCURITÉ DOCKER : Découpage propre de la chaîne pour éviter le crash f-string
txt_content += (
f"Nom : {name}\n"
f"ID : {m_id}\n"
f"Tarif : {cout}\n"
f"Spécialité : {usage}\n"
f"Description : {desc_fr}\n"
f"{'-'*60}\n"
)
# Forcer le téléchargement du fichier TXT
filename = f"modeles_ia_{datetime.now().strftime('%Y%m%d_%H%M')}.txt"
return Response(txt_content, media_type="text/plain", headers={"Content-Disposition": f"attachment; filename={filename}"})
@rt('/')
def get():