-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchat-history-config.ts
More file actions
43 lines (34 loc) · 1.69 KB
/
Copy pathchat-history-config.ts
File metadata and controls
43 lines (34 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Chat History Management Enhancement
// ================================
// Summary of Changes Made:
// 1. Increased streaming processor history limit from 10 to 100 messages
// 2. Increased duplicate checking range from 10 to 50 messages
// 3. Added performance monitoring for large chat histories
// 4. Database schema already supports unlimited String[] messages
// Current Configuration:
const HISTORY_LIMITS = {
// Messages kept in AI context for conversation continuity
AI_CONTEXT_MESSAGES: 100, // Was: 10 (50 user + 50 AI pairs)
// Messages checked for duplicates when saving new messages
DUPLICATE_CHECK_MESSAGES: 50, // Was: 10
// UI performance warning threshold
UI_PERFORMANCE_WARNING: 200, // New: Shows console warning for very large histories
// Database storage: UNLIMITED (PostgreSQL String[] array)
};
// Benefits of Increased Limits:
// ✅ Better conversation context for AI responses
// ✅ More comprehensive workout history access
// ✅ Improved duplicate detection accuracy
// ✅ Better long-term conversation memory
// ✅ Enhanced user experience for power users
// Performance Considerations:
// - Chat history loading: O(n) but cached in memory
// - Duplicate checking: O(n) with Set for optimization
// - UI rendering: React handles list virtualization well
// - Database: PostgreSQL arrays are efficient for this use case
console.log("Chat history limits have been increased:");
console.log("- AI Context Messages: 10 → 100 (10x increase)");
console.log("- Duplicate Check Range: 10 → 50 (5x increase)");
console.log("- Database Storage: Unlimited");
console.log("- UI Performance: Monitoring added for 200+ messages");
export default HISTORY_LIMITS;