import { useState, useEffect } from 'react' import { Save, Loader2, Clock } from 'lucide-react' import { assistantChatApi } from '@/api/assistantChat' export default function ChatRetentionSettingsPage() { const [loading, setLoading] = useState(true) const [saving, setSaving] = useState(false) const [retentionDays, setRetentionDays] = useState('') const [maxCount, setMaxCount] = useState('') const [success, setSuccess] = useState(false) useEffect(() => { loadSettings() }, []) const loadSettings = async () => { try { const data = await assistantChatApi.getRetentionSettings() setRetentionDays(data.chat_retention_days?.toString() ?? '90') setMaxCount(data.chat_retention_max_count?.toString() ?? '100') } catch { // silently handle } finally { setLoading(false) } } const handleSave = async () => { setSaving(true) setSuccess(false) try { await assistantChatApi.updateRetentionSettings({ chat_retention_days: parseInt(retentionDays) || null, chat_retention_max_count: parseInt(maxCount) || null, }) setSuccess(true) setTimeout(() => setSuccess(false), 3000) } catch { // silently handle } finally { setSaving(false) } } if (loading) { return (
) } return (

Chat Retention

Configure how long AI assistant conversations are retained. Pinned chats are never automatically deleted.

setRetentionDays(e.target.value)} min={1} max={365} className="w-full rounded-xl border bg-card text-foreground text-sm px-4 py-2.5 focus:outline-hidden focus:border-primary/30" style={{ borderColor: 'var(--color-border-default)' }} />

Chats older than this will be automatically deleted (1-365 days)

setMaxCount(e.target.value)} min={10} max={10000} className="w-full rounded-xl border bg-card text-foreground text-sm px-4 py-2.5 focus:outline-hidden focus:border-primary/30" style={{ borderColor: 'var(--color-border-default)' }} />

When this limit is exceeded, oldest unpinned chats are deleted

{success && ( Settings saved )}
) }