feat: clear chat history manually, auto-expire old history after 90 days

Manual: DELETE /api/v1/ai/chat-history (scoped by recipeId or scope=general,
matching GET's scoping) plus a trash-icon button + confirm dialog in both
chat panels' headers.

Automatic: new internal cron endpoint (chat-cleanup), same shared-secret
pattern as the existing leftover-reminders/weekly-digest crons, deletes
any chat_messages older than 90 days. Wired into cron/crontab (daily,
03:00 UTC) and the Dockerfile's cron stage.

Verified locally: cleared a real conversation through the actual UI and
confirmed it didn't come back on reopen (not just cleared client-side);
inserted a 100-day-old and a 5-day-old message directly, called the cron
endpoint with the real shared-secret check, confirmed only the old one
was deleted and the recent one survived; confirmed the endpoint 401s with
no/wrong secret.
This commit is contained in:
Arnaud
2026-07-12 23:27:05 +02:00
parent 9549684254
commit adaa837564
10 changed files with 200 additions and 5 deletions
+8 -1
View File
@@ -393,7 +393,14 @@
"searchPlaceholder": "Search past questions…",
"searching": "Searching…",
"noResults": "No matching messages",
"close": "Close"
"close": "Close",
"clearAriaLabel": "Clear chat history",
"clearConfirmTitle": "Clear this conversation?",
"clearConfirmDescription": "This deletes the saved history for this chat. This can't be undone.",
"clearCancel": "Cancel",
"clearConfirm": "Clear history",
"cleared": "Chat history cleared",
"clearFailed": "Failed to clear chat history"
},
"cookingChat": {
"sorry": "Sorry, I couldn't answer that.",
+8 -1
View File
@@ -393,7 +393,14 @@
"searchPlaceholder": "Rechercher une question passée…",
"searching": "Recherche…",
"noResults": "Aucun message correspondant",
"close": "Fermer"
"close": "Fermer",
"clearAriaLabel": "Effacer l'historique",
"clearConfirmTitle": "Effacer cette conversation ?",
"clearConfirmDescription": "Cela supprime l'historique enregistré de cette conversation. Cette action est irréversible.",
"clearCancel": "Annuler",
"clearConfirm": "Effacer l'historique",
"cleared": "Historique effacé",
"clearFailed": "Échec de l'effacement de l'historique"
},
"cookingChat": {
"sorry": "Désolé, je n'ai pas pu répondre à cela.",