fix: Workflow placeholder resolution + complete catalog display
Backend workflow_executor.py: - load_prompt_template() now uses modern resolve_placeholders() from prompt_executor - Calls get_placeholder_example_values() to populate ALL registered placeholders - Passes catalog for |d modifier support - Fixes issue where basis prompts had empty/null placeholder values in workflows Backend placeholder_resolver.py: - get_placeholder_catalog() now includes ALL placeholders from PLACEHOLDER_MAP - Uncategorized placeholders added to "Sonstiges" category - Fixes discrepancy: 111 total placeholders but only ~30 shown in picker Root Cause: - Workflow used old resolve_placeholders() (only PLACEHOLDER_MAP, no variables) - Isolated execution used modern resolve_placeholders() (full variables dict) - Catalog excluded non-registry placeholders from PLACEHOLDER_MAP Impact: - All placeholders now resolve correctly in workflow execution - PlaceholderPicker shows all 111+ placeholders (not just registry ones) Version: 0.9p (workflow module) Part 3: End Node Template Engine - Bug Fixes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
1a9fb99411
commit
857c55aeb8
2 files changed
+58
-4
No files matched your search
@@ -766,7 +766,8 @@ async def load_prompt_template(prompt_slug: str, context: Dict[str, Any]) -> str
|
||||
>>> "{{name}}" not in template
|
||||
True
|
||||
"""
|
||||
from placeholder_resolver import resolve_placeholders
|
||||
from placeholder_resolver import get_placeholder_example_values, get_placeholder_catalog
|
||||
from prompt_executor import resolve_placeholders
|
||||
|
||||
with get_db() as conn:
|
||||
cur = get_cursor(conn)
|
||||
@@ -780,13 +781,37 @@ async def load_prompt_template(prompt_slug: str, context: Dict[str, Any]) -> str
|
||||
|
||||
template = row['template']
|
||||
|
||||
# Resolve Placeholders
|
||||
# Resolve Placeholders using modern prompt_executor method
|
||||
profile_id = context.get("profile_id")
|
||||
|
||||
# Build variables dict with ALL registered placeholders
|
||||
variables = {}
|
||||
|
||||
try:
|
||||
# Get all placeholder values from registry
|
||||
processed_placeholders = get_placeholder_example_values(profile_id)
|
||||
# Remove {{ }} from keys (placeholder_resolver returns them with wrappers)
|
||||
cleaned_placeholders = {
|
||||
key.replace('{{', '').replace('}}', ''): value
|
||||
for key, value in processed_placeholders.items()
|
||||
}
|
||||
variables.update(cleaned_placeholders)
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to load placeholders for workflow: {e}")
|
||||
|
||||
# Load catalog for |d modifier support
|
||||
try:
|
||||
catalog = get_placeholder_catalog(profile_id)
|
||||
except Exception as e:
|
||||
catalog = None
|
||||
logger.warning(f"Failed to load placeholder catalog for workflow: {e}")
|
||||
|
||||
# Resolve with modern executor
|
||||
resolved = resolve_placeholders(
|
||||
template=template,
|
||||
profile_id=profile_id
|
||||
variables=variables,
|
||||
catalog=catalog
|
||||
)
|
||||
# TODO Phase 3: Support custom variables from workflow context
|
||||
|
||||
return resolved
|
||||
|
||||
|
||||
Reference in new issue
Block a user