Try draft prompts on own charts before saving
CI / test (push) Successful in 46s
CI / build (push) Successful in 4m16s
CI / deploy (push) Skipped

Under each prompt on /admin/promptok, "Kipróbálás" writes the summary or
detailed analysis with the text in the editor (saved or not) on one of the
admin's own charts. Test runs live in prompt_previews: never shown with the
chart, not cached, no credits, one attempt, at most three open per admin,
removed after 30 days. The worker writes them when no analysis is due. The
result shows the model, tokens, cost and time, and the draft can be loaded back.

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-17 14:41:12 +00:00
co-authored by Claude Opus 5.5
parent 86d5dc5503
commit b77dafdb26
13 changed files with 697 additions and 24 deletions
+2 -1
View File
@@ -8,7 +8,7 @@ use tokio::sync::watch;
const INTERVAL: Duration = Duration::from_secs(3600);
/// (what, statement) pairs; each returns the number of deleted rows.
const STATEMENTS: [(&str, &str); 4] = [
const STATEMENTS: [(&str, &str); 5] = [
("sessions", "DELETE FROM sessions WHERE expires_at < now()"),
("auth_tokens", "DELETE FROM auth_tokens WHERE expires_at < now()"),
// Sent e-mails contain links with tokens; keep them a week for support.
@@ -18,6 +18,7 @@ const STATEMENTS: [(&str, &str); 4] = [
OR failed_at < now() - interval '30 days'",
),
("invites", "DELETE FROM synastry_invites WHERE accepted_at IS NULL AND expires_at < now() - interval '30 days'"),
("prompt_previews", "DELETE FROM prompt_previews WHERE created_at < now() - interval '30 days'"),
];
pub async fn run_once(db: &PgPool) -> Result<Vec<(&'static str, u64)>, sqlx::Error> {