Commit graph

17 commits

Author SHA1 Message Date
TamHC
883e457009
implemented the history retention feature
### 1. __History Retention Configuration__

- __config.toml__: Added `[HISTORY]` section with `RETENTION_DAYS = 30` setting
- __Backend Integration__: Updated configuration handling to support history retention
- __API Endpoints__: Modified `/api/config` to read/write history retention settings

### 2. __User Interface__

- __Settings Page__: Added "History Settings" section with number input for retention days
- __Real-time Updates__: Settings are saved to config.toml when changed
- __Clear Documentation__: Explains that retention only applies when incognito mode is off

### 3. __Automatic History Cleanup__

- __Background Processing__: Cleanup runs automatically when new chats are created (non-incognito mode)
- __Smart Logic__: Only deletes chats older than configured retention period
- __Complete Cleanup__: Removes both chat records and associated messages
- __Performance Optimized__: Non-blocking background execution

### 4. __Manual Cleanup API__

- __Endpoint__: `POST /api/cleanup-history` for manual cleanup triggers
- __Utility Functions__: Reusable cleanup logic in dedicated utility file

### 5. __Docker Rebuild__

- __Container Rebuild__: Successfully rebuilt the Docker containers with new features
- __Configuration Persistence__: config.toml changes are preserved in Docker volume
- __Application Ready__: The application should now be accessible at [](http://localhost:3000)<http://localhost:3000>

## Key Features:

1. __Incognito Mode Integration__: History retention only applies when incognito mode is OFF
2. __Flexible Configuration__: 0 = keep forever, any positive number = days to retain
3. __Automatic Cleanup__: Runs in background when creating new chats
4. __Manual Control__: API endpoint for manual cleanup triggers
5. __Database Integrity__: Properly removes both chats and associated messages

## Testing the Feature:

1. __Access the Application__: Open [](http://localhost:3000)<http://localhost:3000> in your browser
2. __Configure Settings__: Go to Settings → History Settings → Set retention days
3. __Test Incognito Mode__: Toggle incognito mode on/off to see different behaviors
4. __Create Test Chats__: Create chats in both modes to verify functionality
5. __Manual Cleanup__: Use the `/api/cleanup-history` endpoint to test manual cleanup
2025-06-24 18:26:18 +08:00
ItzCrazyKns
ccb72c8970 feat(app): add weather widget 2025-05-30 08:36:08 +05:30
ItzCrazyKns
740ff941a5 feat(discover): add preview mode 2025-05-30 08:35:15 +05:30
ItzCrazyKns
073b5e897c feat(app): lint & beautify 2025-04-12 11:58:52 +05:30
ItzCrazyKns
588e68e93e feat(providers): add deepseek provider 2025-04-06 13:37:43 +05:30
OTYAK
64e2d457cc feat(search): add optional systemInstructions to API request body 2025-04-05 19:06:18 +01:00
ItzCrazyKns
09661ae11d feat(prompts): fix typo, closes #715 2025-04-02 13:02:28 +05:30
ItzCrazyKns
5b1055e8c9 feat(routes): add system instructions 2025-04-01 15:49:36 +05:30
ItzCrazyKns
90e303f737 feat(search): lint & beautify, update content type 2025-03-30 21:12:04 +05:30
OTYAK
5d60ab1139 feat(api): Switch to newline-delimited JSON streaming instead of SSE 2025-03-27 13:04:09 +01:00
OTYAK
9095996356
Merge branch 'ItzCrazyKns:master' into master 2025-03-27 13:01:09 +01:00
ItzCrazyKns
310c8a75fd feat(routes): fix typo, closes #692 2025-03-27 11:36:58 +05:30
OTYAK
191d1dc25f refactor(api): clean up comments and improve abort handling in search route 2025-03-26 11:32:46 +01:00
OTYAK
d3b2f8983d feat(api): add streaming support to search route 2025-03-26 11:28:05 +01:00
ItzCrazyKns
62e6c24840 feat(app): fix build errors 2025-03-20 12:47:54 +05:30
ItzCrazyKns
33b895b75e feat(app): add search API 2025-03-20 12:29:52 +05:30
ItzCrazyKns
217736d05a feat(app): remove backend 2025-03-19 16:23:27 +05:30