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