feat: show all stage outputs as collapsible JSON in expert mode
All checks were successful
Deploy Development / deploy (push) Successful in 43s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s

Backend:
- Add ALL stage outputs to metadata (not just referenced ones)
- Format JSON with indent for readability
- Description: 'Zwischenergebnis aus Stage X'

Frontend:
- Stage raw values shown in collapsible <details> element
- JSON formatted in <pre> tag with syntax highlighting
- 'JSON anzeigen ▼' summary for better UX

Fixes: Stage X - Rohdaten now shows intermediate results
This commit is contained in:
Lars 2026-03-26 13:17:58 +01:00
parent 159fcab17a
commit f37936c84d
2 changed files with 49 additions and 23 deletions

View File

@ -900,6 +900,20 @@ async def execute_unified_prompt(
'category': category
}
# Add all stage outputs (raw JSON) for expert mode - regardless of whether referenced
for stage_key, stage_value in stage_outputs.items():
if stage_key not in metadata['placeholders']:
stage_parts = stage_key.split('_')
stage_num = stage_parts[1] if len(stage_parts) > 1 else '?'
output_name = '_'.join(stage_parts[2:]) if len(stage_parts) > 2 else 'output'
metadata['placeholders'][stage_key] = {
'value': json.dumps(stage_value, ensure_ascii=False, indent=2) if isinstance(stage_value, dict) else str(stage_value),
'description': f"Zwischenergebnis aus Stage {stage_num} ({output_name})",
'is_stage_raw': True,
'category': f"Stage {stage_num} - Rohdaten"
}
# Collect all resolved placeholders from prompts (input placeholders)
for stage_debug in stages_debug:
for prompt_debug in stage_debug.get('prompts', []):
@ -912,33 +926,23 @@ async def execute_unified_prompt(
for key in resolved_keys:
if key not in metadata['placeholders']: # Avoid duplicates
# Get value: first try stage outputs, then cleaned_values
value = stage_outputs.get(key, cleaned_values.get(key, ''))
# Get value from cleaned_values
value = cleaned_values.get(key, '')
# For stage output placeholders (raw JSON), add special description
if key.startswith('stage_'):
stage_parts = key.split('_')
stage_num = stage_parts[1] if len(stage_parts) > 1 else '?'
desc = f"Rohdaten Stage {stage_num} (Basis-Analyse JSON)"
category = f"Stage {stage_num} - Rohdaten"
is_stage_raw = True
else:
# Find description and category in catalog
desc = None
category = 'Sonstiges'
for cat_name, cat_items in catalog.items():
matching = [item for item in cat_items if item['key'] == key]
if matching:
desc = matching[0].get('description', '')
category = cat_name
break
desc = desc or ''
is_stage_raw = False
# Find description and category in catalog
desc = None
category = 'Sonstiges'
for cat_name, cat_items in catalog.items():
matching = [item for item in cat_items if item['key'] == key]
if matching:
desc = matching[0].get('description', '')
category = cat_name
break
desc = desc or ''
metadata['placeholders'][key] = {
'value': value if isinstance(value, str) else json.dumps(value, ensure_ascii=False),
'description': desc,
'is_stage_raw': is_stage_raw, # Mark raw stage outputs for expert mode
'category': category
}

View File

@ -224,7 +224,29 @@ function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
fontSize: isStageRaw ? 9 : 11,
color: isStageRaw ? 'var(--text3)' : 'var(--text1)'
}}>
{data.value}
{isStageRaw ? (
<details style={{ cursor: 'pointer' }}>
<summary style={{
fontWeight: 600,
color: 'var(--accent)',
fontSize: 10,
marginBottom: '4px'
}}>
JSON anzeigen
</summary>
<pre style={{
background: 'var(--surface2)',
padding: '8px',
borderRadius: '4px',
fontSize: 9,
overflow: 'auto',
maxHeight: '300px',
margin: 0
}}>
{data.value}
</pre>
</details>
) : data.value}
</td>
<td style={{
padding: '6px 8px',