feat: Enhance placeholder system with AI context support
Deploy Development / deploy (push) Successful in 48s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 16s

- Introduced `build_ai_placeholder_caption` function in `placeholder_registry.py` to generate AI context captions based on placeholder metadata.
- Updated `resolve_placeholders` in `placeholder_resolver.py` to support modifiers for AI context, allowing for enhanced descriptions when placeholders are resolved.
- Modified `get_placeholder_catalog` to include AI captions in the output, improving the metadata available for placeholders.
- Adjusted `export_placeholder_values` to include AI captions in the exported data, enhancing the information provided to users.

These changes improve the flexibility and functionality of the placeholder system, enabling richer context generation for dynamic content.
This commit is contained in:
Lars committed 2026-04-11 21:36:29 +02:00
1 parent 41bf593d4c
commit baeddd7c13
5 files changed
+146 -27

No files matched your search

+6 -6
View File
@@ -19,7 +19,7 @@ def resolve_placeholders(template: str, variables: Dict[str, Any], debug_info: O
Replace {{placeholder}} with values from variables dict.
Supports modifiers:
- {{key|d}} - Include description in parentheses (requires catalog)
- {{key|d}} — angehängter KI-Kontext (ai_caption aus Katalog, sonst description; Katalog nötig)
Args:
template: String with {{key}} or {{key|modifiers}} placeholders
@@ -52,16 +52,16 @@ def resolve_placeholders(template: str, variables: Dict[str, Any], debug_info: O
# Apply modifiers
if 'd' in modifiers:
if catalog:
# Add description from catalog
description = None
caption = None
for cat_items in catalog.values():
matching = [item for item in cat_items if item['key'] == key]
if matching:
description = matching[0].get('description', '')
row = matching[0]
caption = (row.get('ai_caption') or row.get('description') or '').strip()
break
if description:
resolved_value = f"{resolved_value} ({description})"
if caption:
resolved_value = f"{resolved_value} — {caption}"
else:
# Catalog not available - log warning in debug
if debug_info is not None: