mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🖌️ style: Update conversation history groups (#1770)
* style: Add month groups to conversation history * style: Change "Last x days" to "Previous x days" to match ChatGPT * style: Add "Yesterday" to conversation groups to match ChatGPT * fix: use startOfDay for Yesterday conversation group * fix: Output month name instead of number in conversation group name * test: Validate new conversation groups are created properly * fix: Formatting of month category string was wrong
This commit is contained in:
parent
50adb1b3c6
commit
14b61fc861
2 changed files with 29 additions and 4 deletions
|
|
@ -15,12 +15,21 @@ describe('Conversation Utilities', () => {
|
|||
const conversations = [
|
||||
{ conversationId: '1', updatedAt: '2023-04-01T12:00:00Z' },
|
||||
{ conversationId: '2', updatedAt: new Date().toISOString() },
|
||||
{ conversationId: '3', updatedAt: new Date(Date.now() - 86400000).toISOString() }, // 86400 seconds ago = yesterday
|
||||
{ conversationId: '4', updatedAt: new Date(Date.now() - 86400000 * 2).toISOString() }, // 2 days ago (previous 7 days)
|
||||
{ conversationId: '5', updatedAt: new Date(Date.now() - 86400000 * 8).toISOString() }, // 8 days ago (previous 30 days)
|
||||
];
|
||||
const grouped = groupConversationsByDate(conversations as TConversation[]);
|
||||
expect(grouped[0][0]).toBe('Today');
|
||||
expect(grouped[0][1]).toHaveLength(1);
|
||||
expect(grouped[1][0]).toBe(' 2023');
|
||||
expect(grouped[1][0]).toBe('Yesterday');
|
||||
expect(grouped[1][1]).toHaveLength(1);
|
||||
expect(grouped[2][0]).toBe('Previous 7 days');
|
||||
expect(grouped[2][1]).toHaveLength(1);
|
||||
expect(grouped[3][0]).toBe('Previous 30 days');
|
||||
expect(grouped[3][1]).toHaveLength(1);
|
||||
expect(grouped[4][0]).toBe(' 2023');
|
||||
expect(grouped[4][1]).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('returns an empty array for no conversations', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue