feat: Add Placeholder Metadata Export to Admin Panel
Adds download functionality for complete placeholder metadata catalog. Backend: - Fix: None-template handling in placeholder_metadata_extractor.py - Prevents TypeError when template is None in ai_prompts - New endpoint: GET /api/prompts/placeholders/export-catalog-zip - Generates ZIP with 4 files: JSON catalog, Markdown catalog, Gap Report, Export Spec - Admin-only endpoint with on-the-fly generation - Returns streaming ZIP download Frontend: - Admin Panel: New "Placeholder Metadata Export" section - Button: "Complete JSON exportieren" - Downloads extended JSON - Button: "Complete ZIP" - Downloads all 4 catalog files as ZIP - Displays file descriptions - api.js: Added exportPlaceholdersExtendedJson() function Features: - Non-breaking: Existing endpoints unchanged - In-memory ZIP generation (no temp files) - Formatted filenames with date - Admin-only access for ZIP download - JSON download available for all authenticated users Use Cases: - Backup/archiving of placeholder metadata - Offline documentation access - Import into other tools - Compliance reporting Files in ZIP: 1. PLACEHOLDER_CATALOG_EXTENDED.json - Machine-readable metadata 2. PLACEHOLDER_CATALOG_EXTENDED.md - Human-readable catalog 3. PLACEHOLDER_GAP_REPORT.md - Unresolved fields analysis 4. PLACEHOLDER_EXPORT_SPEC.md - API specification Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7afa98639
commit
087e8dd885
4 files changed
+215
-9
No files matched your search
@@ -460,21 +460,24 @@ def analyze_placeholder_usage(profile_id: str) -> Dict[str, UsedBy]:
|
||||
# Analyze each prompt
|
||||
for prompt in prompts:
|
||||
# Check template
|
||||
template = prompt.get('template', '')
|
||||
found_placeholders = re.findall(r'\{\{(\w+)\}\}', template)
|
||||
template = prompt.get('template') or ''
|
||||
if template: # Only process if template is not empty/None
|
||||
found_placeholders = re.findall(r'\{\{(\w+)\}\}', template)
|
||||
|
||||
for ph_key in found_placeholders:
|
||||
if ph_key not in usage_map:
|
||||
usage_map[ph_key] = UsedBy()
|
||||
if prompt['name'] not in usage_map[ph_key].prompts:
|
||||
usage_map[ph_key].prompts.append(prompt['name'])
|
||||
for ph_key in found_placeholders:
|
||||
if ph_key not in usage_map:
|
||||
usage_map[ph_key] = UsedBy()
|
||||
if prompt['name'] not in usage_map[ph_key].prompts:
|
||||
usage_map[ph_key].prompts.append(prompt['name'])
|
||||
|
||||
# Check stages (pipeline prompts)
|
||||
stages = prompt.get('stages')
|
||||
if stages:
|
||||
for stage in stages:
|
||||
for stage_prompt in stage.get('prompts', []):
|
||||
template = stage_prompt.get('template', '')
|
||||
template = stage_prompt.get('template') or ''
|
||||
if not template: # Skip if template is None/empty
|
||||
continue
|
||||
found_placeholders = re.findall(r'\{\{(\w+)\}\}', template)
|
||||
|
||||
for ph_key in found_placeholders:
|
||||
|
||||
Reference in new issue
Block a user