Membership-System und Bug Fixing (inkl. Nutrition) #8

Merged
Lars merged 56 commits from develop into main 2026-03-21 08:48:57 +01:00
2 changed files with 5 additions and 7 deletions
Showing only changes of commit e4f49c0351 - Show all commits

View File

@ -294,10 +294,9 @@ async def analyze_with_prompt(slug: str, x_profile_id: Optional[str]=Header(defa
else:
raise HTTPException(500, "Keine KI-API konfiguriert")
# Save insight
# Save insight (with history - no DELETE)
with get_db() as conn:
cur = get_cursor(conn)
cur.execute("DELETE FROM ai_insights WHERE profile_id=%s AND scope=%s", (pid, slug))
cur.execute("INSERT INTO ai_insights (id, profile_id, scope, content, created) VALUES (%s,%s,%s,%s,CURRENT_TIMESTAMP)",
(str(uuid.uuid4()), pid, slug, content))
@ -431,15 +430,14 @@ async def analyze_pipeline(x_profile_id: Optional[str]=Header(default=None), ses
if goals_text:
final_content += "\n\n" + goals_text
# Save as 'gesamt' scope
# Save as 'pipeline' scope (with history - no DELETE)
with get_db() as conn:
cur = get_cursor(conn)
cur.execute("DELETE FROM ai_insights WHERE profile_id=%s AND scope='gesamt'", (pid,))
cur.execute("INSERT INTO ai_insights (id, profile_id, scope, content, created) VALUES (%s,%s,'gesamt',%s,CURRENT_TIMESTAMP)",
cur.execute("INSERT INTO ai_insights (id, profile_id, scope, content, created) VALUES (%s,%s,'pipeline',%s,CURRENT_TIMESTAMP)",
(str(uuid.uuid4()), pid, final_content))
inc_ai_usage(pid)
return {"scope": "gesamt", "content": final_content, "stage1": stage1_results}
return {"scope": "pipeline", "content": final_content, "stage1": stage1_results}
@router.get("/ai/usage")

View File

@ -177,7 +177,7 @@ export default function Analysis() {
grouped[key].push(ins)
})
const activePrompts = prompts.filter(p=>p.active && !p.slug.startsWith('pipeline_'))
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')