Free chart summaries; password login off by default

- New analysis kind 'summary' (migration 0005): saving a chart queues a
  free 3-4 sentence summary written by SUMMARY_MODEL (default Sonnet
  5.5, about 1 cent; Haiku was tested too but chose weaker highlights).
  POST /v1/charts/{id}/summary returns it and re-queues a failed one.
- The chart page shows it in a "Röviden" card and polls until ready.
- PASSWORD_LOGIN (default false): register, login and password reset
  answer 403; only Google (later Apple, Facebook) logins remain.
- Prompt v2: Hungarian names for elements and modalities (an English
  "Fire" slipped into a summary); worker compare-models --summary.
- The worker also reads a lower-case openrouter_api_key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-16 17:12:17 +00:00
co-authored by Claude Opus 5.5
parent 269e3167e2
commit 450174c273
19 changed files with 339 additions and 38 deletions
+11
View File
@@ -112,6 +112,14 @@ pub async fn calculate(state: &AppState, birth: Value) -> Result<(Value, Value,
Ok((birth, result, hash))
}
/// Queues the free short summary; a failure here does not fail the save
/// (the chart page asks for the summary again).
async fn queue_summary(state: &AppState, auth: &AuthUser, chart: &ChartRow) {
if let Err(e) = super::analyses::ensure_summary(state, auth, chart).await {
tracing::warn!(chart = %chart.id, error = %e, "queueing the chart summary failed");
}
}
fn clean_birth(birth: Value) -> Result<Value, ApiError> {
let Value::Object(mut birth) = birth else {
return Err(ApiError::BadRequest("birth must be an object".into()));
@@ -150,8 +158,10 @@ pub async fn create(
.fetch_one(&mut *tx)
.await?;
tx.commit().await?;
queue_summary(&state, &auth, &row).await;
return Ok((StatusCode::OK, Json(row.owner_view())));
}
queue_summary(&state, &auth, &chart).await;
return Ok((StatusCode::OK, Json(chart.owner_view())));
}
let (count,): (i64,) =
@@ -185,6 +195,7 @@ pub async fn create(
.fetch_one(&mut *tx)
.await?;
tx.commit().await?;
queue_summary(&state, &auth, &row).await;
Ok((StatusCode::CREATED, Json(row.owner_view())))
}