librechat-data-provider 0.7.4 → 0.7.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "librechat-data-provider",
3
- "version": "0.7.4",
3
+ "version": "0.7.41",
4
4
  "description": "data services for librechat apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,5 +1,6 @@
1
1
  import type { AssistantsEndpoint } from './schemas';
2
2
 
3
+ export const health = () => '/health';
3
4
  export const user = () => '/api/user';
4
5
 
5
6
  export const balance = () => '/api/balance';
@@ -32,8 +33,10 @@ export const abortRequest = (endpoint: string) => `/api/ask/${endpoint}/abort`;
32
33
 
33
34
  export const conversationsRoot = '/api/convos';
34
35
 
35
- export const conversations = (pageNumber: string, isArchived?: boolean) =>
36
- `${conversationsRoot}?pageNumber=${pageNumber}${isArchived ? '&isArchived=true' : ''}`;
36
+ export const conversations = (pageNumber: string, isArchived?: boolean, tags?: string[]) =>
37
+ `${conversationsRoot}?pageNumber=${pageNumber}${isArchived ? '&isArchived=true' : ''}${tags
38
+ ?.map((tag) => `&tags=${tag}`)
39
+ .join('')}`;
37
40
 
38
41
  export const conversationById = (id: string) => `${conversationsRoot}/${id}`;
39
42
 
@@ -188,3 +191,14 @@ export const roles = () => '/api/roles';
188
191
  export const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;
189
192
  export const updatePromptPermissions = (roleName: string) =>
190
193
  `${roles()}/${roleName.toLowerCase()}/prompts`;
194
+
195
+ /* Conversation Tags */
196
+ export const conversationTags = (tag?: string) => `/api/tags${tag ? `/${tag}` : ''}`;
197
+
198
+ export const conversationTagsList = (pageNumber: string, sort?: string, order?: string) =>
199
+ `${conversationTags()}/list?pageNumber=${pageNumber}${sort ? `&sort=${sort}` : ''}${
200
+ order ? `&order=${order}` : ''
201
+ }`;
202
+
203
+ export const addTagToConversation = (conversationId: string) =>
204
+ `${conversationsRoot}/tags/${conversationId}`;
package/src/config.ts CHANGED
@@ -12,6 +12,7 @@ export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'd
12
12
  export const defaultRetrievalModels = [
13
13
  'gpt-4o',
14
14
  'gpt-4o-2024-05-13',
15
+ 'gpt-4o-2024-08-06',
15
16
  'gpt-4o-mini',
16
17
  'gpt-4o-mini-2024-07-18',
17
18
  'gpt-4-turbo-preview',
@@ -282,7 +283,7 @@ const ttsLocalaiSchema = z.object({
282
283
  const ttsSchema = z.object({
283
284
  openai: ttsOpenaiSchema.optional(),
284
285
  azureOpenAI: ttsAzureOpenAISchema.optional(),
285
- elevenLabs: ttsElevenLabsSchema.optional(),
286
+ elevenlabs: ttsElevenLabsSchema.optional(),
286
287
  localai: ttsLocalaiSchema.optional(),
287
288
  });
288
289
 
@@ -679,6 +680,7 @@ export enum InfiniteCollections {
679
680
  * Enum for time intervals
680
681
  */
681
682
  export enum Time {
683
+ ONE_HOUR = 3600000,
682
684
  THIRTY_MINUTES = 1800000,
683
685
  TEN_MINUTES = 600000,
684
686
  FIVE_MINUTES = 300000,
@@ -799,6 +801,10 @@ export enum ViolationTypes {
799
801
  * Verify Email Limit Violation.
800
802
  */
801
803
  VERIFY_EMAIL_LIMIT = 'verify_email_limit',
804
+ /**
805
+ * Verify Conversation Access violation.
806
+ */
807
+ CONVO_ACCESS = 'convo_access',
802
808
  }
803
809
 
804
810
  /**
@@ -895,6 +901,10 @@ export enum SettingsTabValues {
895
901
  * Tab for Account Settings
896
902
  */
897
903
  ACCOUNT = 'account',
904
+ /**
905
+ * Chat input commands
906
+ */
907
+ COMMANDS = 'commands',
898
908
  }
899
909
 
900
910
  export enum STTProviders {
@@ -930,7 +940,7 @@ export enum TTSProviders {
930
940
  /** Enum for app-wide constants */
931
941
  export enum Constants {
932
942
  /** Key for the app's version. */
933
- VERSION = 'v0.7.4-rc1',
943
+ VERSION = 'v0.7.4',
934
944
  /** Key for the Custom Config's version (librechat.yaml). */
935
945
  CONFIG_VERSION = '1.1.5',
936
946
  /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
@@ -947,6 +957,8 @@ export enum Constants {
947
957
  COMMANDS_MAX_LENGTH = 56,
948
958
  /** Default Stream Rate (ms) */
949
959
  DEFAULT_STREAM_RATE = 1,
960
+ /** Saved Tag */
961
+ SAVED_TAG = 'Saved',
950
962
  }
951
963
 
952
964
  export enum LocalStorageKeys {
@@ -424,7 +424,8 @@ export const listConversations = (
424
424
  // Assuming params has a pageNumber property
425
425
  const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
426
426
  const isArchived = params?.isArchived || false; // Default to false if not provided
427
- return request.get(endpoints.conversations(pageNumber, isArchived));
427
+ const tags = params?.tags || []; // Default to an empty array if not provided
428
+ return request.get(endpoints.conversations(pageNumber, isArchived, tags));
428
429
  };
429
430
 
430
431
  export const listConversationsByQuery = (
@@ -541,3 +542,38 @@ export function updatePromptPermissions(
541
542
  ): Promise<m.UpdatePromptPermResponse> {
542
543
  return request.put(endpoints.updatePromptPermissions(variables.roleName), variables.updates);
543
544
  }
545
+
546
+ /* Tags */
547
+ export function getConversationTags(): Promise<t.TConversationTagsResponse> {
548
+ return request.get(endpoints.conversationTags());
549
+ }
550
+
551
+ export function createConversationTag(
552
+ payload: t.TConversationTagRequest,
553
+ ): Promise<t.TConversationTagResponse> {
554
+ return request.post(endpoints.conversationTags(), payload);
555
+ }
556
+
557
+ export function updateConversationTag(
558
+ tag: string,
559
+ payload: t.TConversationTagRequest,
560
+ ): Promise<t.TConversationTagResponse> {
561
+ return request.put(endpoints.conversationTags(tag), payload);
562
+ }
563
+ export function deleteConversationTag(tag: string): Promise<t.TConversationTagResponse> {
564
+ return request.delete(endpoints.conversationTags(tag));
565
+ }
566
+
567
+ export function addTagToConversation(
568
+ conversationId: string,
569
+ payload: t.TTagConversationRequest,
570
+ ): Promise<t.TTagConversationResponse> {
571
+ return request.put(endpoints.addTagToConversation(conversationId), payload);
572
+ }
573
+ export function rebuildConversationTags(): Promise<t.TConversationTagsResponse> {
574
+ return request.post(endpoints.conversationTags('rebuild'));
575
+ }
576
+
577
+ export function healthCheck(): Promise<string> {
578
+ return request.get(endpoints.health());
579
+ }
package/src/keys.ts CHANGED
@@ -36,6 +36,8 @@ export enum QueryKeys {
36
36
  categories = 'categories',
37
37
  randomPrompts = 'randomPrompts',
38
38
  roles = 'roles',
39
+ conversationTags = 'conversationTags',
40
+ health = 'health',
39
41
  }
40
42
 
41
43
  export enum MutationKeys {
package/src/schemas.ts CHANGED
@@ -371,6 +371,7 @@ export const tConversationSchema = z.object({
371
371
  updatedAt: z.string(),
372
372
  modelLabel: z.string().nullable().optional(),
373
373
  examples: z.array(tExampleSchema).optional(),
374
+ tags: z.array(z.string()).optional(),
374
375
  /* Prefer modelLabel over chatGptLabel */
375
376
  chatGptLabel: z.string().nullable().optional(),
376
377
  userLabel: z.string().optional(),
@@ -476,6 +477,17 @@ export const tSharedLinkSchema = z.object({
476
477
  });
477
478
  export type TSharedLink = z.infer<typeof tSharedLinkSchema>;
478
479
 
480
+ export const tConversationTagSchema = z.object({
481
+ user: z.string(),
482
+ tag: z.string(),
483
+ description: z.string().optional(),
484
+ createdAt: z.string(),
485
+ updatedAt: z.string(),
486
+ count: z.number(),
487
+ position: z.number(),
488
+ });
489
+ export type TConversationTag = z.infer<typeof tConversationTagSchema>;
490
+
479
491
  export const openAISchema = tConversationSchema
480
492
  .pick({
481
493
  model: true,
@@ -173,3 +173,9 @@ export type UpdatePromptPermOptions = MutationOptions<
173
173
  unknown,
174
174
  types.TError
175
175
  >;
176
+
177
+ export type UpdateConversationTagOptions = MutationOptions<
178
+ types.TConversationTag,
179
+ types.TConversationTagRequest
180
+ >;
181
+ export type DeleteConversationTagOptions = MutationOptions<types.TConversationTag, string>;
@@ -1,6 +1,7 @@
1
1
  import type { InfiniteData } from '@tanstack/react-query';
2
- import type { TMessage, TConversation, TSharedLink } from '../schemas';
3
2
  import type * as t from '../types';
3
+ import type { TMessage, TConversation, TSharedLink, TConversationTag } from '../schemas';
4
+
4
5
  export type Conversation = {
5
6
  id: string;
6
7
  createdAt: number;
@@ -18,6 +19,7 @@ export type ConversationListParams = {
18
19
  pageNumber: string; // Add this line
19
20
  conversationId?: string;
20
21
  isArchived?: boolean;
22
+ tags?: string[];
21
23
  };
22
24
 
23
25
  // Type for the response from the conversation list API
@@ -68,3 +70,5 @@ export type AllPromptGroupsFilterRequest = {
68
70
  };
69
71
 
70
72
  export type AllPromptGroupsResponse = t.TPromptGroup[];
73
+
74
+ export type ConversationTagsResponse = TConversationTag[];
package/src/types.ts CHANGED
@@ -7,6 +7,7 @@ import type {
7
7
  TSharedLink,
8
8
  TConversation,
9
9
  EModelEndpoint,
10
+ TConversationTag,
10
11
  } from './schemas';
11
12
  import type { TSpecsConfig } from './models';
12
13
  export type TOpenAIMessage = OpenAI.Chat.ChatCompletionMessageParam;
@@ -170,6 +171,24 @@ export type TSharedLinkResponse = TSharedLink;
170
171
  export type TSharedLinksResponse = TSharedLink[];
171
172
  export type TDeleteSharedLinkResponse = TSharedLink;
172
173
 
174
+ // type for getting conversation tags
175
+ export type TConversationTagsResponse = TConversationTag[];
176
+ // type for creating conversation tag
177
+ export type TConversationTagRequest = Partial<
178
+ Omit<TConversationTag, 'createdAt' | 'updatedAt' | 'count' | 'user'>
179
+ > & {
180
+ conversationId?: string;
181
+ addToConversation?: boolean;
182
+ };
183
+
184
+ export type TConversationTagResponse = TConversationTag;
185
+
186
+ // type for tagging conversation
187
+ export type TTagConversationRequest = {
188
+ tags: string[];
189
+ };
190
+ export type TTagConversationResponse = string[];
191
+
173
192
  export type TForkConvoRequest = {
174
193
  messageId: string;
175
194
  conversationId: string;
@@ -294,7 +313,13 @@ export type TStartupConfig = {
294
313
  openidLoginEnabled: boolean;
295
314
  openidLabel: string;
296
315
  openidImageUrl: string;
297
- ldapLoginEnabled: boolean;
316
+ /** LDAP Auth Configuration */
317
+ ldap?: {
318
+ /** LDAP enabled */
319
+ enabled: boolean;
320
+ /** Whether LDAP uses username vs. email */
321
+ username?: boolean;
322
+ };
298
323
  serverDomain: string;
299
324
  emailLoginEnabled: boolean;
300
325
  registrationEnabled: boolean;