From 9f6b6630cec9b0bb44992f941dcfe6fa0e4fddf4 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 10 Jul 2025 21:30:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A8=A1=E6=9D=BF=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_core/services/template_manager.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/python_core/services/template_manager.py b/python_core/services/template_manager.py index 0bd672e..aa7ad9c 100644 --- a/python_core/services/template_manager.py +++ b/python_core/services/template_manager.py @@ -191,9 +191,17 @@ class TemplateManager: # Load and parse draft content with open(draft_file, 'r', encoding='utf-8') as f: draft_content = json.load(f) - - # Generate template ID - template_id = str(uuid.uuid4()) + + # Use the original template ID from draft_content.json + template_id = draft_content.get('id') + if not template_id: + logger.warning(f"No 'id' field found in draft_content.json for {template_path}") + return None + + # Check if template already exists + if template_id in self.templates_metadata: + logger.info(f"Template {template_id} already exists, skipping import") + return None # Create template directory template_dir = self.templates_dir / template_id