Try draft prompts on own charts before saving
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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user