mirror of
https://github.com/Ladebeze66/projetcbaollm.git
synced 2025-12-16 10:07:49 +01:00
43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
import re
|
|
import html2text
|
|
from utils import save_json
|
|
|
|
def clean_ticket_data(ticket_data):
|
|
"""Version simplifiée de la fonction de nettoyage
|
|
À remplacer par l'import de votre fonction clean_ticket_data existante
|
|
"""
|
|
# En attendant, cette fonction de base retourne les données telles quelles
|
|
return ticket_data
|
|
|
|
def display_ticket_fields(ticket):
|
|
"""Affiche les champs d'un ticket et leurs valeurs"""
|
|
print("\n== DÉTAILS DU TICKET ==")
|
|
print(f"ID: {ticket['ID du Ticket']}")
|
|
print(f"Code: {ticket.get('Code', 'N/A')}")
|
|
print(f"Nom: {ticket['Nom']}")
|
|
print(f"Date Limite: {ticket['Date Limite']}")
|
|
|
|
print("\n== CHAMPS SIMPLES ==")
|
|
for field_name, value in ticket['Champs Simples'].items():
|
|
# Si la valeur est trop longue, on n'affiche que les 100 premiers caractères
|
|
if isinstance(value, str) and len(value) > 100:
|
|
display_value = f"{value[:100]}..."
|
|
else:
|
|
display_value = value
|
|
print(f"{field_name}: {display_value}")
|
|
|
|
print("\n== CHAMPS RELATIONNELS ==")
|
|
for field_name, value in ticket['Champs Relationnels'].items():
|
|
print(f"{field_name}: {value}")
|
|
|
|
print("\n== DISCUSSIONS ==")
|
|
if ticket['Discussions']:
|
|
for i, msg in enumerate(ticket['Discussions'], 1):
|
|
print(f"Message {i}:")
|
|
print(f" Auteur: {msg['Auteur']}")
|
|
print(f" Date: {msg['Date']}")
|
|
print(f" Sujet: {msg['Sujet']}")
|
|
print(f" Contenu: {msg['Contenu'][:100]}..." if len(msg['Contenu']) > 100 else f" Contenu: {msg['Contenu']}")
|
|
print()
|
|
else:
|
|
print("Aucune discussion trouvée.") |