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 (
Configure how long AI assistant conversations are retained. Pinned chats are never automatically deleted.
Chats older than this will be automatically deleted (1-365 days)
When this limit is exceeded, oldest unpinned chats are deleted