From 50adb1b3c678facb1e40c2f4ab6ea8448fbf33a7 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Sun, 11 Feb 2024 08:46:14 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20ci:=20Fix=20Conversation=20Group?= =?UTF-8?q?ing=20Tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/utils/convos.fakeData.ts | 233 ++++++++++------------------ client/src/utils/convos.spec.ts | 2 +- 2 files changed, 82 insertions(+), 153 deletions(-) diff --git a/client/src/utils/convos.fakeData.ts b/client/src/utils/convos.fakeData.ts index 0a6367167f..bcb7229d0d 100644 --- a/client/src/utils/convos.fakeData.ts +++ b/client/src/utils/convos.fakeData.ts @@ -1,20 +1,22 @@ +import { EModelEndpoint, ImageDetail } from 'librechat-data-provider'; import type { ConversationData } from 'librechat-data-provider'; -/* @ts-ignore */ +const today = new Date(); +today.setDate(today.getDate() - 3); +const updatedAt = today.toISOString(); + export const convoData: ConversationData = { pages: [ { conversations: [ { - _id: '65bd0a2f7cb605e374e93ed1', conversationId: 'bf71b257-3625-440c-b6a6-03f6a3fd6a4d', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-02T15:28:47.123Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bd0a2f7cb605e374e93ea3', '65bd0a2f7cb605e374e94028', @@ -28,21 +30,17 @@ export const convoData: ConversationData = { temperature: 1, title: 'A Long Story', top_p: 1, - updatedAt: '2024-02-03T22:56:46.269Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bec2c27cb605e374189730', conversationId: '544f1c4f-030f-4ea2-997c-35923f5d8ee2', user: 'my-user-id', - __v: 0, - _meiliIndex: true, chatGptLabel: null, createdAt: '2024-02-03T22:48:33.144Z', endpoint: 'OpenRouter', - endpointType: 'custom', + endpointType: EModelEndpoint.custom, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bec2c27cb605e3741896fd', '65bec2c47cb605e374189c16', @@ -57,18 +55,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'How Are You Doing?', top_p: 1, - updatedAt: '2024-02-03T22:49:21.140Z', + updatedAt, }, { - _id: '65be8c0d7cb605e3747323ad', conversationId: 'e3f19866-190e-43ab-869f-10260f07530f', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T18:55:09.560Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65be8c0d7cb605e37473236c', '65be8c0d7cb605e374732475'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -77,19 +73,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'A Long Story', top_p: 1, - updatedAt: '2024-02-03T18:55:17.586Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65be6bd17cb605e37412706b', conversationId: '4d569723-3aff-4f52-9bbf-e127783a06ac', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T16:37:37.600Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65be6bd17cb605e374127036', '65be6bd17cb605e374127156', @@ -105,19 +98,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Write Einstein\'s Famous Equation in LaTeX', top_p: 1, - updatedAt: '2024-02-03T18:55:02.407Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65be6b7b7cb605e374117546', conversationId: '640db89d-459f-4411-a0b0-26cb1d53bf1a', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T16:36:11.010Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65be6b7a7cb605e374117519', '65be6b7b7cb605e37411766c', @@ -134,19 +124,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Fibonacci Solver in Python', top_p: 1, - updatedAt: '2024-02-03T18:46:06.636Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde6117cb605e37481d315', conversationId: 'a9b39a05-fdc0-47f4-bd3b-b0aca618f656', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:06:55.573Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bde6117cb605e37481d294', '65bde6117cb605e37481d4eb', @@ -170,19 +157,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'test', top_p: 1, - updatedAt: '2024-02-03T18:22:42.524Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bd1b347cb605e3741e29dc', conversationId: '3ce779d7-8535-4a43-9b70-e0d3160f299e', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-02T16:41:24.324Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bd1b347cb605e3741e299d', '65bd1b347cb605e3741e2ba6', @@ -195,19 +179,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T18:16:13.357Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bdd6d77cb605e37454b694', conversationId: 'c162f906-06fb-405a-b7e6-773a0fc5f8e9', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:01:57.968Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bdd6d77cb605e37454b66c', '65bdd6d87cb605e37454b892', @@ -228,19 +209,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'test', top_p: 1, - updatedAt: '2024-02-03T18:15:57.133Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65be82c87cb605e374577820', conversationId: '48bbc7d5-1815-4024-8ac6-6c9f59242426', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T18:15:36.759Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65be82c87cb605e3745777f6', '65be82c97cb605e374577911', @@ -253,19 +231,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T18:15:49.536Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde8567cb605e37488ac01', conversationId: '97d6e676-b05b-43f9-8f56-1c07e8a1eb4e', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:16:36.407Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bde8557cb605e37488abe2', '65bde8567cb605e37488ad32', @@ -292,19 +267,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'test', top_p: 1, - updatedAt: '2024-02-03T18:15:28.531Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde95c7cb605e3748ba8ae', conversationId: '293f230b-ceaa-4802-9611-c4fe7e4b1fd6', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:20:58.933Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bde95c7cb605e3748ba84d', '65bde95c7cb605e3748baa9d', @@ -318,19 +290,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello, How Can I Help You?', top_p: 1, - updatedAt: '2024-02-03T16:35:07.134Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65be6a967cb605e3740ebdc4', conversationId: '279db3ad-2219-4229-b99a-e19a2b191dd7', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T16:32:22.480Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65be6a967cb605e3740ebd60', '65be6a967cb605e3740ebf38'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -339,19 +308,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello there! How may I assist you today?', top_p: 1, - updatedAt: '2024-02-03T16:32:25.066Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bdea947cb605e3748f42c0', conversationId: '3e62a081-055c-4ee5-9e33-7ab8b3d367c9', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:26:10.988Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bdea947cb605e3748f4275', '65bdea947cb605e3748f43af'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -360,19 +326,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How may I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:26:13.177Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde8aa7cb605e37489a27b', conversationId: 'b97836fc-8566-48e2-a28d-99f99528ca20', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:18:01.245Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde8aa7cb605e37489a256', '65bde8ab7cb605e37489a3a1'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -381,19 +344,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:18:04.006Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde8357cb605e3748850a7', conversationId: 'aa52b79d-ebe7-49d1-9fee-5f5b89d56069', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:16:03.728Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde8357cb605e37488508e', '65bde8357cb605e37488520e'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -402,19 +362,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How may I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:16:06.189Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde7887cb605e374864527', conversationId: 'fe50b20f-8465-4866-b5ef-9bc519a00eef', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:13:10.682Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde7887cb605e3748644e0', '65bde7887cb605e37486463b'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -423,19 +380,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:13:12.960Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde6f47cb605e37484824b', conversationId: '2fbb4a34-4d17-4e05-8c0a-949e78572aa3', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:10:42.904Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde6f47cb605e374848207', '65bde6f47cb605e3748483b5'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -444,19 +398,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:10:45.245Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde6a77cb605e37483941b', conversationId: 'c0d587d0-e881-42be-a2cf-5bf01198bdac', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:09:25.506Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde6a77cb605e3748393d7', '65bde6a77cb605e374839506'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -465,19 +416,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:09:27.717Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde65c7cb605e37482b717', conversationId: 'acd7fa14-4165-4fa1-b2a6-637041743a78', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:08:10.607Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde65c7cb605e37482b6f7', '65bde65c7cb605e37482b822'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -486,19 +434,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:08:12.971Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde6467cb605e37482700c', conversationId: '61ba520e-d53b-4816-b8cc-059d89f15ed4', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T07:07:49.166Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde6467cb605e374826fee', '65bde6477cb605e374827125'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -507,19 +452,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T07:07:51.592Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bde4677cb605e3747cd139', conversationId: 'd4f599af-aeae-4a54-b34c-bd85ce8134af', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:59:49.834Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bde4677cb605e3747cd0ed', '65bde4677cb605e3747cd26d'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -528,19 +470,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T06:59:52.004Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bddfd37cb605e3746f4328', conversationId: 'e424c98c-8540-428a-ae43-dc314e15849d', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:40:18.167Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bddfd37cb605e3746f42c5', '65bddfd47cb605e3746f4471'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -549,19 +488,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T06:40:20.382Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bddeb97cb605e3746bfb8c', conversationId: 'edac9c4d-bb66-4550-acaf-98006b83db4d', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:35:35.937Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: ['65bddeb97cb605e3746bfb5e', '65bddeb97cb605e3746bfc8a'], model: 'gpt-3.5-turbo-0301', presence_penalty: 0, @@ -570,19 +506,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hello! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T06:35:38.519Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bdd6817cb605e37453b949', conversationId: 'dbeca051-8af8-42cb-a611-70f669c66502', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:00:31.691Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bdd6817cb605e37453b904', '65bdd6817cb605e37453ba9b', @@ -596,19 +529,16 @@ export const convoData: ConversationData = { temperature: 1, title: 'test 2', top_p: 1, - updatedAt: '2024-02-03T06:30:21.941Z', - _meiliIndex: true, + updatedAt, }, { - _id: '65bdd9ac7cb605e3745cf331', conversationId: '4a69c491-5cfc-4a62-b7d3-6a54d890dfa8', user: 'my-user-id', - __v: 0, chatGptLabel: null, createdAt: '2024-02-03T06:14:02.394Z', - endpoint: 'openAI', + endpoint: EModelEndpoint.openAI, frequency_penalty: 0, - imageDetail: 'auto', + imageDetail: ImageDetail.auto, messages: [ '65bdd9ab7cb605e3745cf30b', '65bdd9ac7cb605e3745cf3f6', @@ -624,12 +554,11 @@ export const convoData: ConversationData = { temperature: 1, title: 'Hi there! How can I assist you today?', top_p: 1, - updatedAt: '2024-02-03T06:25:59.827Z', - _meiliIndex: true, + updatedAt, }, ], pages: 49, - pageNumber: 1, + pageNumber: '1', pageSize: 25, }, ], diff --git a/client/src/utils/convos.spec.ts b/client/src/utils/convos.spec.ts index 1ec1c00b1e..1d21d8654c 100644 --- a/client/src/utils/convos.spec.ts +++ b/client/src/utils/convos.spec.ts @@ -152,7 +152,7 @@ describe('Conversation Utilities with Fake Data', () => { const allConversations = pages.flatMap((p) => p.conversations); const grouped = groupConversationsByDate(allConversations); - expect(grouped).toHaveLength(2); + expect(grouped).toHaveLength(1); expect(grouped[0][1]).toBeInstanceOf(Array); }); });