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
+12 -2
View File
@@ -72,6 +72,9 @@ pub struct Config {
pub cookie_domain: Option<String>,
/// `SESSION_TTL_DAYS` (default 30).
pub session_ttl_days: i64,
/// `PASSWORD_LOGIN` (default `false`): e-mail and password registration and
/// login. Off in production, where only Google, Apple and Facebook are offered.
pub password_login: bool,
/// `GOOGLE_CLIENT_IDS`: comma-separated OAuth client ids accepted as the
/// ID token audience; empty disables Google login.
pub google_client_ids: Vec<String>,
@@ -89,7 +92,10 @@ pub struct Config {
/// Credits default to `ANALYSIS_COST` (default 1). Default:
/// [`DEFAULT_LLM_MODELS`].
pub llm_models: Vec<LlmModel>,
/// `ANALYSIS_PROMPT_VERSION` (default `v1`); part of the analysis cache key.
/// `SUMMARY_MODEL`: writes the free short summary of every saved chart
/// (default `anthropic/claude-sonnet-5.5`, about 1 US cent each).
pub summary_model: String,
/// `ANALYSIS_PROMPT_VERSION` (default `v2`); part of the analysis cache key.
pub prompt_version: String,
/// `MAX_CHARTS_PER_USER` (default 50).
pub max_charts_per_user: i64,
@@ -147,6 +153,7 @@ impl Config {
cookie_secure: parsed("COOKIE_SECURE", true)?,
cookie_domain: var("COOKIE_DOMAIN"),
session_ttl_days: parsed("SESSION_TTL_DAYS", 30)?,
password_login: parsed("PASSWORD_LOGIN", false)?,
google_client_ids: list("GOOGLE_CLIENT_IDS"),
google_jwks_url: var("GOOGLE_JWKS_URL")
.unwrap_or_else(|| "https://www.googleapis.com/oauth2/v3/certs".into()),
@@ -154,7 +161,8 @@ impl Config {
supported_locales,
monthly_free_credits: parsed("MONTHLY_FREE_CREDITS", 10)?,
llm_models,
prompt_version: var("ANALYSIS_PROMPT_VERSION").unwrap_or_else(|| "v1".into()),
summary_model: var("SUMMARY_MODEL").unwrap_or_else(|| "anthropic/claude-sonnet-5.5".into()),
prompt_version: var("ANALYSIS_PROMPT_VERSION").unwrap_or_else(|| "v2".into()),
max_charts_per_user: parsed("MAX_CHARTS_PER_USER", 50)?,
};
if config.session_ttl_days < 1 {
@@ -177,6 +185,7 @@ impl Config {
cookie_secure: true,
cookie_domain: None,
session_ttl_days: 30,
password_login: true,
google_client_ids: vec!["test-client.apps.googleusercontent.com".into()],
google_jwks_url,
bootstrap_admin_emails: vec!["admin@example.com".into()],
@@ -187,6 +196,7 @@ impl Config {
1,
)
.unwrap(),
summary_model: "anthropic/claude-summary".into(),
prompt_version: "v1".into(),
max_charts_per_user: 50,
}