🔍 feat: Show Messages from Search Result (#2699)

* refactor(Nav): delegate Search-specific variables/hooks to SearchContext

* fix: safely determine firstTodayConvoId if convo is undefined

* chore: remove empty line

* feat: initial render of search messages

* feat: SearchButtons

* update Ko.ts

* update localizations with new key phrases

* chore: localization comparisons

* fix: clear conversation state on searchQuery navigation

* style: search messages view styling

* refactor(Convo): consolidate logic to navigateWithLastTools from useNavigateToConvo

* fix(SearchButtons): styling and correct navigation logic

* fix(SearchBar): invalidate all message queries and invoke `clearText` if onChange value is empty

* refactor(NewChat): consolidate new chat button logic to NewChatButtonIcon

* chore: localizations for Nav date groups

* chore: update comparisons

* fix: early return from sendRequest to avoid quick searchQuery reset

* style: Link Icon

* chore: bump tiktoken, use o200k_base for gpt-4o
This commit is contained in:
Danny Avila 2024-05-14 11:00:01 -04:00 committed by GitHub
parent 638ac5bba6
commit e42709bd1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 2742 additions and 234 deletions

View file

@ -1,11 +1,12 @@
import { convoData } from './convos.fakeData';
import {
groupConversationsByDate,
dateKeys,
addConversation,
updateConversation,
updateConvoFields,
updateConversation,
deleteConversation,
findPageForConversation,
groupConversationsByDate,
} from './convos';
import type { TConversation, ConversationData } from 'librechat-data-provider';
@ -20,13 +21,13 @@ describe('Conversation Utilities', () => {
{ 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][0]).toBe(dateKeys.today);
expect(grouped[0][1]).toHaveLength(1);
expect(grouped[1][0]).toBe('Yesterday');
expect(grouped[1][0]).toBe(dateKeys.yesterday);
expect(grouped[1][1]).toHaveLength(1);
expect(grouped[2][0]).toBe('Previous 7 days');
expect(grouped[2][0]).toBe(dateKeys.previous7Days);
expect(grouped[2][1]).toHaveLength(1);
expect(grouped[3][0]).toBe('Previous 30 days');
expect(grouped[3][0]).toBe(dateKeys.previous30Days);
expect(grouped[3][1]).toHaveLength(1);
expect(grouped[4][0]).toBe(' 2023');
expect(grouped[4][1]).toHaveLength(1);