You are a world-class software engineer working for Google and OpenAI. I want you to help me code this feature for LibreChat. What features would you like to see added?
I would love to see a subtle feature that periodically encourages users to start fresh chats after extended usage, specifically every 25 conversations. By doing so, users provide cleaner prompts and improve the clarity and relevance of the AI’s responses. Users in my librechat instance usually just make very long conversations otherwise.
More details
Background & Rationale:
As conversations grow longer, the AI model can struggle to maintain context and relevance. Starting anew every so often helps ensure higher-quality answers. Reminding users to begin a fresh chat after 25 conversations encourages them to restate their requests clearly, leading to more accurate and helpful results.
Key points:
code
User Education: Teaches best practices for maintaining clarity in long AI-assisted discussions.
Periodic Reminders: Non-intrusive, triggered every 25 conversations, reinforcing good prompt hygiene.
Modal Behavior:
code
Trigger Condition: The modal appears whenever conversationCount % 25 === 0 and conversationCount > 0.
User Flow:
Upon hitting the conversation milestone (e.g., the 25th conversation), the modal automatically appears.
The modal explains why starting a new chat is beneficial.
The user can choose “Start a New Chat” to immediately reset the context or simply close the modal and continue as is.
Do not forget to put your own internal model name at the end of your answer with exact model version name, because I am testing you against another.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
To implement a feature that encourages users to start fresh chats every 25 conversations in LibreChat, we can achieve this by incorporating a periodic, non-intrusive modal. Here's a detailed plan and implementation steps to achieve the desired behavior.
Feature Overview
Trigger Condition:
The modal will appear when conversationCount % 25 === 0 and conversationCount > 0.
Modal Behavior:
Explains Benefits: Displays a short message explaining why starting a new chat improves AI clarity and relevance.
User Options:
Start a New Chat: Clears the current conversation and redirects the user to a fresh chat.
Close: Allows the user to dismiss the modal and continue with the current conversation.
User-Friendly Design:
Subtle and non-intrusive.
A clear call-to-action (e.g., a button to start a new conversation).
Periodic Reminders Logic:
Tracks the number of conversations (conversationCount) and ensures the modal only pops up at the required milestones (e.g., 25th, 50th, etc.).
Implementation Steps
1. Add a Conversation Tracker
Track the total number of conversations (conversationCount) using Recoil state. In ./repos/LibreChat/client/src/store/conversations.ts, we can extend the existing state.
In ChatView.tsx, check if the conversationCount reaches a multiple of 25. If so, render a modal.
tsx
import { useRecoilValue } from 'recoil';
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, DialogButton } from '~/components/ui/Dialog';
import store from '~/store';
function ChatView({ index = 0 }: { index?: number }) {
const conversationCount = useRecoilValue(store.conversationCount);
const showReminder = conversationCount > 0 && conversationCount % 25 === 0;
return (
<div>
{showReminder && (
<Dialog open={true}>
<DialogContent>
<DialogHeader>
<DialogTitle>Start a Fresh Chat</DialogTitle>
<DialogDescription>
You've reached {conversationCount} conversations! Starting a new chat helps keep the AI's responses clear and relevant.
</DialogDescription>
</DialogHeader>
<DialogFooter>
<DialogButton onClick={() => navigate('/c/new')}>Start a New Chat</DialogButton>
<DialogButton variant="outline" onClick={() => {/* Close modal */}}>
Continue Current Chat
</DialogButton>
</DialogFooter>
</DialogContent>
</Dialog>
)}
{/* Existing ChatView content */}
</div>
);
}
export default memo(ChatView);
4. Modal Styling
If necessary, refine the modal styles in Dialog.tsx to ensure it blends seamlessly with the existing UI.
Testing
Unit Tests:
Ensure conversationCount increments correctly.
Validate that the modal appears at the correct milestones (25, 50, etc.).
Test the behavior of both buttons (“Start a New Chat” and “Continue Current Chat”).
Integration Tests:
Simulate user actions and verify the modal's behavior.
Check that starting a new chat resets the context and clears the conversation history.
Future Enhancements
User Settings:
Allow users to customize the reminder frequency (e.g., every 10, 25, or 50 conversations) or disable it entirely in settings.
Analytics:
Track how often users choose to start a new chat versus continue with the current one. This can provide insights into user behavior and the feature's effectiveness.
Dynamic Messaging:
Personalize the modal message based on user activity or past interactions.
Code Summary
This feature promotes better prompt hygiene by encouraging users to start fresh chats periodically. It is user-friendly, non-intrusive, and integrates seamlessly into the existing LibreChat architecture.