From 84b6bdb3283fad18a6f95b12c2bec3e06ef4960e Mon Sep 17 00:00:00 2001 From: Ladebeze66 Date: Thu, 3 Apr 2025 14:42:56 +0200 Subject: [PATCH] 14:42 --- .../ticket_manager.cpython-312.pyc | Bin 3609 -> 3610 bytes utils/data_extractor.py | 75 ------------------ utils/notes | 3 + utils/ticket_manager.py | 2 +- 4 files changed, 4 insertions(+), 76 deletions(-) delete mode 100644 utils/data_extractor.py create mode 100644 utils/notes diff --git a/utils/__pycache__/ticket_manager.cpython-312.pyc b/utils/__pycache__/ticket_manager.cpython-312.pyc index 6ced2bee2307fd0c10c2026b6bf016d479f2f290..5a78ce51a631c4d4ddefbc608721703e028332e9 100644 GIT binary patch delta 47 zcmbO!GfRf|G%qg~0}zNczDvKmk=KZoi8Fq(1M5W|or{7x7j&Hugk2W&*(}TUhaCV# C(GK1K delta 46 zcmbOwGgF55G%qg~0}xEEf0uq|Bd-xFBgbS%){8va7X`I1=r|p4yDaFvS&r=wI{-!Z B4&(p; diff --git a/utils/data_extractor.py b/utils/data_extractor.py deleted file mode 100644 index 793a6c0..0000000 --- a/utils/data_extractor.py +++ /dev/null @@ -1,75 +0,0 @@ -import os -from datetime import datetime -from typing import Dict, Any -from .auth_manager import AuthManager -from .message_manager import MessageManager -from .attachment_manager import AttachmentManager -from .utils import save_json - -class DataExtractor: - def __init__(self, auth_manager: AuthManager): - self.auth_manager = auth_manager - self.message_manager = MessageManager(auth_manager) - self.attachment_manager = AttachmentManager(auth_manager) - self.model_name = "project.task" - - def get_ticket_by_code(self, ticket_code: str) -> Dict[str, Any]: - params = { - "model": self.model_name, - "method": "search_read", - "args": [[["code", "=", ticket_code]], - ["id", "name", "description", "stage_id", "project_id", "partner_id", - "user_id", "date_start", "date_end", "create_date", "write_date", - "message_ids", "message_follower_ids", "attachment_ids", "timesheet_ids"]], - "kwargs": {"limit": 1} - } - result = self.auth_manager.rpc_call("/web/dataset/call_kw", params) - - if isinstance(result, list) and len(result) > 0: - return result[0] - else: - print(f"Aucun ticket trouvé avec le code {ticket_code}") - return {} - - def extract_ticket_data(self, ticket_code: str, output_dir: str): - os.makedirs(output_dir, exist_ok=True) - - ticket_data = self.get_ticket_by_code(ticket_code) - - if not ticket_data or "id" not in ticket_data: - print(f"Erreur: Ticket non trouvé.") - return None - - # Sauvegarder ticket_info.json - ticket_info_path = os.path.join(output_dir, "ticket_info.json") - save_json(ticket_data, ticket_info_path) - - # Sauvegarde des messages - messages_data = self.message_manager.get_ticket_messages(ticket_data["id"]) - all_messages_path = os.path.join(output_dir, "all_messages.json") - save_json(messages_data, all_messages_path) - - # Sauvegarde des pièces jointes - attachments_data = self.attachment_manager.get_ticket_attachments(ticket_data["id"], output_dir) - attachments_path = os.path.join(output_dir, "attachments_info.json") - save_json(attachments_data, attachments_path) - - # Génération de structure.json - structure = { - "date_extraction": datetime.now().isoformat(), - "ticket_dir": output_dir, - "fichiers_json": [ - "ticket_info.json", - "all_messages.json", - "attachments_info.json" - ] - } - structure_path = os.path.join(output_dir, "structure.json") - save_json(structure, structure_path) - - return { - "ticket_info": ticket_info_path, - "messages_file": all_messages_path, - "ticket_data_file": structure_path, - "attachments": attachments_path - } diff --git a/utils/notes b/utils/notes new file mode 100644 index 0000000..9e491a3 --- /dev/null +++ b/utils/notes @@ -0,0 +1,3 @@ +rappel dépôt: https://github.com/Ladebeze66/llm_ticket3 branch "update" +dossier uils/ fichiers gestion des ticket +racine retrieve_ticket.py \ No newline at end of file diff --git a/utils/ticket_manager.py b/utils/ticket_manager.py index 5727d08..ce30900 100644 --- a/utils/ticket_manager.py +++ b/utils/ticket_manager.py @@ -24,7 +24,7 @@ class TicketManager: "message_ids", "message_follower_ids", "attachment_ids", "timesheet_ids"]], "kwargs": {"limit": 1} } - result = self.auth_manager.rpc_call("/web/dataset/call_kw", params) + result = self.auth_manager._rpc_call("/web/dataset/call_kw", params) if isinstance(result, list) and len(result) > 0: return result[0]