feat: show all stage outputs as collapsible JSON in expert mode
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:
parent
159fcab17a
commit
f37936c84d
|
|
@ -900,6 +900,20 @@ async def execute_unified_prompt(
|
||||||
'category': category
|
'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)
|
# Collect all resolved placeholders from prompts (input placeholders)
|
||||||
for stage_debug in stages_debug:
|
for stage_debug in stages_debug:
|
||||||
for prompt_debug in stage_debug.get('prompts', []):
|
for prompt_debug in stage_debug.get('prompts', []):
|
||||||
|
|
@ -912,33 +926,23 @@ async def execute_unified_prompt(
|
||||||
|
|
||||||
for key in resolved_keys:
|
for key in resolved_keys:
|
||||||
if key not in metadata['placeholders']: # Avoid duplicates
|
if key not in metadata['placeholders']: # Avoid duplicates
|
||||||
# Get value: first try stage outputs, then cleaned_values
|
# Get value from cleaned_values
|
||||||
value = stage_outputs.get(key, cleaned_values.get(key, ''))
|
value = cleaned_values.get(key, '')
|
||||||
|
|
||||||
# For stage output placeholders (raw JSON), add special description
|
# Find description and category in catalog
|
||||||
if key.startswith('stage_'):
|
desc = None
|
||||||
stage_parts = key.split('_')
|
category = 'Sonstiges'
|
||||||
stage_num = stage_parts[1] if len(stage_parts) > 1 else '?'
|
for cat_name, cat_items in catalog.items():
|
||||||
desc = f"Rohdaten Stage {stage_num} (Basis-Analyse JSON)"
|
matching = [item for item in cat_items if item['key'] == key]
|
||||||
category = f"Stage {stage_num} - Rohdaten"
|
if matching:
|
||||||
is_stage_raw = True
|
desc = matching[0].get('description', '')
|
||||||
else:
|
category = cat_name
|
||||||
# Find description and category in catalog
|
break
|
||||||
desc = None
|
desc = desc or ''
|
||||||
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
|
|
||||||
|
|
||||||
metadata['placeholders'][key] = {
|
metadata['placeholders'][key] = {
|
||||||
'value': value if isinstance(value, str) else json.dumps(value, ensure_ascii=False),
|
'value': value if isinstance(value, str) else json.dumps(value, ensure_ascii=False),
|
||||||
'description': desc,
|
'description': desc,
|
||||||
'is_stage_raw': is_stage_raw, # Mark raw stage outputs for expert mode
|
|
||||||
'category': category
|
'category': category
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,29 @@ function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
|
||||||
fontSize: isStageRaw ? 9 : 11,
|
fontSize: isStageRaw ? 9 : 11,
|
||||||
color: isStageRaw ? 'var(--text3)' : 'var(--text1)'
|
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>
|
||||||
<td style={{
|
<td style={{
|
||||||
padding: '6px 8px',
|
padding: '6px 8px',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user