diff --git a/frontend/src/components/PlaceholderPicker.jsx b/frontend/src/components/PlaceholderPicker.jsx index d143966..837f3fd 100644 --- a/frontend/src/components/PlaceholderPicker.jsx +++ b/frontend/src/components/PlaceholderPicker.jsx @@ -196,13 +196,8 @@ export default function PlaceholderPicker({ onSelect, onClose }) { e.currentTarget.style.background = 'var(--surface2)' }} > -
{item.example && (
+ Beispiel:
{item.example}
)}
diff --git a/frontend/src/pages/Analysis.jsx b/frontend/src/pages/Analysis.jsx
index f203294..3f7d1b0 100644
--- a/frontend/src/pages/Analysis.jsx
+++ b/frontend/src/pages/Analysis.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect } from 'react'
-import { Brain, Pencil, Trash2, ChevronDown, ChevronUp, Check, X } from 'lucide-react'
+import { Brain, Trash2, ChevronDown, ChevronUp } from 'lucide-react'
import { api } from '../utils/api'
import { useAuth } from '../context/AuthContext'
import Markdown from '../utils/Markdown'
@@ -8,19 +8,9 @@ import dayjs from 'dayjs'
import 'dayjs/locale/de'
dayjs.locale('de')
+// Legacy fallback labels (display_name takes precedence)
const SLUG_LABELS = {
- gesamt: '🔍 Gesamtanalyse',
- koerper: '🫧 Körperkomposition',
- ernaehrung: '🍽️ Ernährung',
- aktivitaet: '🏋️ Aktivität',
- gesundheit: '❤️ Gesundheitsindikatoren',
- ziele: '🎯 Zielfortschritt',
- pipeline: '🔬 Mehrstufige Gesamtanalyse',
- pipeline_body: '🔬 Pipeline: Körper-Analyse (JSON)',
- pipeline_nutrition: '🔬 Pipeline: Ernährungs-Analyse (JSON)',
- pipeline_activity: '🔬 Pipeline: Aktivitäts-Analyse (JSON)',
- pipeline_synthesis: '🔬 Pipeline: Synthese',
- pipeline_goals: '🔬 Pipeline: Zielabgleich',
+ pipeline: '🔬 Mehrstufige Gesamtanalyse'
}
function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
@@ -53,78 +43,16 @@ function InsightCard({ ins, onDelete, defaultOpen=false, prompts=[] }) {
)
}
-function PromptEditor({ prompt, onSave, onCancel }) {
- const [template, setTemplate] = useState(prompt.template)
- const [name, setName] = useState(prompt.name)
- const [desc, setDesc] = useState(prompt.description||'')
-
- const VARS = ['{{name}}','{{geschlecht}}','{{height}}','{{goal_weight}}','{{goal_bf_pct}}',
- '{{weight_trend}}','{{weight_aktuell}}','{{kf_aktuell}}','{{caliper_summary}}',
- '{{circ_summary}}','{{nutrition_summary}}','{{nutrition_detail}}',
- '{{protein_ziel_low}}','{{protein_ziel_high}}','{{activity_summary}}',
- '{{activity_kcal_summary}}','{{activity_detail}}',
- '{{sleep_summary}}','{{sleep_detail}}','{{sleep_avg_duration}}','{{sleep_avg_quality}}',
- '{{rest_days_summary}}','{{rest_days_count}}','{{rest_days_types}}',
- '{{vitals_summary}}','{{vitals_detail}}','{{vitals_avg_hr}}','{{vitals_avg_hrv}}',
- '{{vitals_avg_bp}}','{{vitals_vo2_max}}','{{bp_summary}}']
-
- return (
-
-
- Prompt bearbeiten
-
-
-
-
- setName(e.target.value)}/>
-
-
-
-
- setDesc(e.target.value)}/>
-
-
-
-
- Variablen (antippen zum EinfĂĽgen):
-
-
- {VARS.map(v=>(
-
- ))}
-
-
-
- )
-}
export default function Analysis() {
- const { canUseAI, isAdmin } = useAuth()
+ const { canUseAI } = useAuth()
const [prompts, setPrompts] = useState([])
const [allInsights, setAllInsights] = useState([])
const [loading, setLoading] = useState(null)
const [error, setError] = useState(null)
- const [editing, setEditing] = useState(null)
const [tab, setTab] = useState('run')
- const [newResult, setNewResult] = useState(null)
- const [pipelineLoading, setPipelineLoading] = useState(false)
- const [aiUsage, setAiUsage] = useState(null) // Phase 3: Usage badge
+ const [newResult, setNewResult] = useState(null)
+ const [aiUsage, setAiUsage] = useState(null)
const loadAll = async () => {
const [p, i] = await Promise.all([
@@ -144,40 +72,18 @@ export default function Analysis() {
}).catch(err => console.error('Failed to load usage:', err))
},[])
- const runPipeline = async () => {
- setPipelineLoading(true); setError(null); setNewResult(null)
- try {
- const result = await api.insightPipeline()
- setNewResult(result)
- await loadAll()
- setTab('run')
- } catch(e) {
- setError('Pipeline-Fehler: ' + e.message)
- } finally { setPipelineLoading(false) }
- }
-
const runPrompt = async (slug) => {
setLoading(slug); setError(null); setNewResult(null)
try {
const result = await api.runInsight(slug)
- setNewResult(result) // show immediately
- await loadAll() // refresh lists
- setTab('run') // stay on run tab to see result
+ setNewResult(result)
+ await loadAll()
+ setTab('run')
} catch(e) {
setError('Fehler: ' + e.message)
} finally { setLoading(null) }
}
- const savePrompt = async (promptId, data) => {
- const token = localStorage.getItem('bodytrack_token')||''
- await fetch(`/api/prompts/${promptId}`, {
- method:'PUT',
- headers:{'Content-Type':'application/json', 'X-Auth-Token': token},
- body:JSON.stringify(data)
- })
- setEditing(null); await loadAll()
- }
-
const deleteInsight = async (id) => {
if (!confirm('Analyse löschen?')) return
const pid = localStorage.getItem('bodytrack_active_profile')||''
@@ -196,11 +102,8 @@ export default function Analysis() {
grouped[key].push(ins)
})
- const activePrompts = prompts.filter(p=>p.active && !p.slug.startsWith('pipeline_') && p.slug !== 'pipeline')
-
- // Pipeline is available if the "pipeline" prompt is active
- const pipelinePrompt = prompts.find(p=>p.slug==='pipeline')
- const pipelineAvailable = pipelinePrompt?.active ?? true // Default to true if not found (backwards compatibility)
+ // Show only active pipeline-type prompts
+ const pipelinePrompts = prompts.filter(p => p.active && p.type === 'pipeline')
return (
@@ -213,7 +116,6 @@ export default function Analysis() {
{allInsights.length>0 && {allInsights.length}}
- {isAdmin && }
{error && (
@@ -245,52 +147,6 @@ export default function Analysis() {
- Oder wähle eine Einzelanalyse: -
} - {activePrompts.map(p => { - // Show latest existing insight for this prompt + {canUseAI && pipelinePrompts.length > 0 && ( ++ Wähle eine mehrstufige KI-Analyse: +
+ )} + + {pipelinePrompts.map(p => { const existing = allInsights.find(i=>i.scope===p.slug) return ( -Keine aktiven Prompts. Aktiviere im Tab "Prompts".
Keine aktiven Pipeline-Prompts verfĂĽgbar.
++ Erstelle Pipeline-Prompts im Admin-Bereich (Einstellungen → Admin → KI-Prompts). +
+
- Passe Prompts an. Variablen wie{' '}
- {'{{name}}'}{' '}
- werden automatisch mit deinen Daten befĂĽllt.
-