feat: extract individual values from stage outputs (Issue #47)
FEATURE: Basis-Analysen Einzelwerte
Vorher: stage_1_body → {"bmi": 26.6, "weight": "85.2kg"} (1 Zeile)
Jetzt: bmi → 26.6 (eigene Zeile)
weight → 85.2kg (eigene Zeile)
BACKEND: JSON-Extraktion
- Stage outputs (JSON) → extract individual fields
- extracted_values dict sammelt alle Einzelwerte
- Deduplizierung: Gleiche Keys nur einmal
- Flags:
- is_extracted: true → Wert aus Stage-Output extrahiert
- is_stage_raw: true → Rohdaten (JSON) nur Experten-Modus
BEISPIEL Stage 1 Output:
{
"stage_1_body": {
"bmi": 26.6,
"weight": "85.2 kg",
"trend": "sinkend"
}
}
→ Metadata:
{
"bmi": {
value: "26.6",
description: "Aus Stage 1 (stage_1_body)",
is_extracted: true
},
"weight": {
value: "85.2 kg",
description: "Aus Stage 1 (stage_1_body)",
is_extracted: true
},
"stage_1_body": {
value: "{\"bmi\": 26.6, ...}",
description: "Rohdaten Stage 1 (Basis-Analyse JSON)",
is_stage_raw: true
}
}
FRONTEND: Smart Filtering
Normal-Modus:
- Zeigt: Einzelwerte (bmi, weight, trend)
- Versteckt: Rohdaten (stage_1_body JSON)
- Filter: is_stage_raw === false
Experten-Modus:
- Zeigt: Alles (Einzelwerte + Rohdaten)
- Rohdaten: Grauer Hintergrund + 🔬 Icon
VISUAL Indicators:
↳ bmi → Extrahierter Wert (grün)
weight → Normaler Platzhalter (accent)
🔬 stage_1_* → Rohdaten JSON (grau, klein, nur Experten)
ERGEBNIS:
┌──────────────────────────────────────────┐
│ 📊 Verwendete Werte (8) (+2 ausgeblendet)│
│ ┌────────────────────────────────────────┐│
│ │ weight_aktuell │ 85.2 kg │ Gewicht ││ ← Normal
│ │ ↳ bmi │ 26.6 │ Aus St..││ ← Extrahiert
│ │ ↳ trend │ sinkend │ Aus St..││ ← Extrahiert
│ └────────────────────────────────────────┘│
└──────────────────────────────────────────┘
Experten-Modus zusätzlich:
│ 🔬 stage_1_body │ {"bmi":...│ Rohdaten││ ← JSON
version: 9.9.0 (feature)
module: prompts 2.4.0, insights 1.7.0
This commit is contained in:
1 parent
e799edbae4
commit
da803da816
2 files changed
+81
-36
No files matched your search
@@ -34,11 +34,15 @@ function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
|
||||
const metadata = metadataRaw
|
||||
const allPlaceholders = placeholdersRaw
|
||||
|
||||
// Filter placeholders: In normal mode, hide empty values
|
||||
// Filter placeholders: In normal mode, hide empty values and raw stage outputs
|
||||
const placeholders = expertMode
|
||||
? allPlaceholders
|
||||
: Object.fromEntries(
|
||||
Object.entries(allPlaceholders).filter(([key, data]) => {
|
||||
// Hide raw stage outputs (JSON) in normal mode
|
||||
if (data.is_stage_raw) return false
|
||||
|
||||
// Hide empty values
|
||||
const val = data.value || ''
|
||||
return val.trim() !== '' && val !== 'nicht verfügbar' && val !== '[Nicht verfügbar]'
|
||||
})
|
||||
@@ -148,36 +152,50 @@ function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.entries(placeholders).map(([key, data]) => (
|
||||
<tr key={key} style={{ borderBottom: '1px solid var(--border)' }}>
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
fontFamily: 'monospace',
|
||||
color: 'var(--accent)',
|
||||
whiteSpace: 'nowrap',
|
||||
verticalAlign: 'top'
|
||||
{Object.entries(placeholders).map(([key, data]) => {
|
||||
const isExtracted = data.is_extracted
|
||||
const isStageRaw = data.is_stage_raw
|
||||
|
||||
return (
|
||||
<tr key={key} style={{
|
||||
borderBottom: '1px solid var(--border)',
|
||||
background: isStageRaw && expertMode ? 'var(--surface)' : 'transparent'
|
||||
}}>
|
||||
{key}
|
||||
</td>
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
fontFamily: 'monospace',
|
||||
wordBreak: 'break-word',
|
||||
maxWidth: '400px',
|
||||
verticalAlign: 'top'
|
||||
}}>
|
||||
{data.value}
|
||||
</td>
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
color: 'var(--text3)',
|
||||
fontSize: 10,
|
||||
verticalAlign: 'top'
|
||||
}}>
|
||||
{data.description || '—'}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
fontFamily: 'monospace',
|
||||
color: isStageRaw ? 'var(--text3)' : (isExtracted ? '#6B8E23' : 'var(--accent)'),
|
||||
whiteSpace: 'nowrap',
|
||||
verticalAlign: 'top',
|
||||
fontSize: isStageRaw ? 10 : 11
|
||||
}}>
|
||||
{isExtracted && '↳ '}
|
||||
{isStageRaw && '🔬 '}
|
||||
{key}
|
||||
</td>
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
fontFamily: 'monospace',
|
||||
wordBreak: 'break-word',
|
||||
maxWidth: '400px',
|
||||
verticalAlign: 'top',
|
||||
fontSize: isStageRaw ? 9 : 11,
|
||||
color: isStageRaw ? 'var(--text3)' : 'var(--text1)'
|
||||
}}>
|
||||
{data.value}
|
||||
</td>
|
||||
<td style={{
|
||||
padding: '6px 8px',
|
||||
color: 'var(--text3)',
|
||||
fontSize: 10,
|
||||
verticalAlign: 'top',
|
||||
fontStyle: isExtracted ? 'italic' : 'normal'
|
||||
}}>
|
||||
{data.description || '—'}
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user