librechat-data-provider 0.7.4 → 0.7.7

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.
Files changed (49) hide show
  1. package/check_updates.sh +1 -0
  2. package/dist/index.es.js +1 -1
  3. package/dist/index.es.js.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/react-query/index.es.js +1 -1
  7. package/dist/react-query/index.es.js.map +1 -1
  8. package/dist/react-query/package.json +1 -1
  9. package/package.json +6 -6
  10. package/react-query/package.json +1 -1
  11. package/server-rollup.config.js +3 -3
  12. package/specs/actions.spec.ts +700 -36
  13. package/specs/azure.spec.ts +8 -5
  14. package/specs/filetypes.spec.ts +1 -7
  15. package/specs/mcp.spec.ts +52 -0
  16. package/specs/openapiSpecs.ts +127 -0
  17. package/specs/utils.spec.ts +129 -0
  18. package/src/actions.ts +311 -101
  19. package/src/api-endpoints.ts +70 -13
  20. package/src/artifacts.ts +3104 -0
  21. package/src/azure.ts +40 -33
  22. package/src/bedrock.ts +227 -0
  23. package/src/config.ts +344 -78
  24. package/src/createPayload.ts +3 -1
  25. package/src/data-service.ts +353 -90
  26. package/src/file-config.ts +13 -2
  27. package/src/generate.ts +31 -2
  28. package/src/index.ts +12 -4
  29. package/src/keys.ts +17 -0
  30. package/src/mcp.ts +87 -0
  31. package/src/models.ts +1 -1
  32. package/src/parsers.ts +118 -60
  33. package/src/react-query/react-query-service.ts +54 -115
  34. package/src/request.ts +31 -7
  35. package/src/roles.ts +91 -2
  36. package/src/schemas.ts +513 -340
  37. package/src/types/agents.ts +276 -0
  38. package/src/types/assistants.ts +181 -27
  39. package/src/types/files.ts +6 -0
  40. package/src/types/mutations.ts +170 -7
  41. package/src/types/queries.ts +43 -21
  42. package/src/types/runs.ts +23 -0
  43. package/src/types.ts +132 -67
  44. package/src/utils.ts +44 -0
  45. package/src/zod.spec.ts +526 -0
  46. package/src/zod.ts +86 -0
  47. package/tsconfig.json +1 -2
  48. package/specs/parsers.spec.ts +0 -48
  49. package/src/sse.js +0 -242
@@ -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';
@@ -9,14 +10,24 @@ export const userPlugins = () => '/api/user/plugins';
9
10
  export const deleteUser = () => '/api/user/delete';
10
11
 
11
12
  export const messages = (conversationId: string, messageId?: string) =>
12
- `/api/messages/${conversationId}${messageId ? `/${messageId}` : ''}`;
13
+ `/api/messages/${conversationId}${messageId != null && messageId ? `/${messageId}` : ''}`;
13
14
 
14
15
  const shareRoot = '/api/share';
15
16
  export const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;
16
- export const getSharedLinks = (pageNumber: string, isPublic: boolean) =>
17
- `${shareRoot}?pageNumber=${pageNumber}&isPublic=${isPublic}`;
18
- export const createSharedLink = shareRoot;
19
- export const updateSharedLink = shareRoot;
17
+ export const getSharedLink = (conversationId: string) => `${shareRoot}/link/${conversationId}`;
18
+ export const getSharedLinks = (
19
+ pageSize: number,
20
+ isPublic: boolean,
21
+ sortBy: 'title' | 'createdAt',
22
+ sortDirection: 'asc' | 'desc',
23
+ search?: string,
24
+ cursor?: string,
25
+ ) =>
26
+ `${shareRoot}?pageSize=${pageSize}&isPublic=${isPublic}&sortBy=${sortBy}&sortDirection=${sortDirection}${
27
+ search ? `&search=${search}` : ''
28
+ }${cursor ? `&cursor=${cursor}` : ''}`;
29
+ export const createSharedLink = (conversationId: string) => `${shareRoot}/${conversationId}`;
30
+ export const updateSharedLink = (shareId: string) => `${shareRoot}/${shareId}`;
20
31
 
21
32
  const keysEndpoint = '/api/keys';
22
33
 
@@ -32,8 +43,10 @@ export const abortRequest = (endpoint: string) => `/api/ask/${endpoint}/abort`;
32
43
 
33
44
  export const conversationsRoot = '/api/convos';
34
45
 
35
- export const conversations = (pageNumber: string, isArchived?: boolean) =>
36
- `${conversationsRoot}?pageNumber=${pageNumber}${isArchived ? '&isArchived=true' : ''}`;
46
+ export const conversations = (pageNumber: string, isArchived?: boolean, tags?: string[]) =>
47
+ `${conversationsRoot}?pageNumber=${pageNumber}${
48
+ isArchived === true ? '&isArchived=true' : ''
49
+ }${tags?.map((tag) => `&tags=${tag}`).join('')}`;
37
50
 
38
51
  export const conversationById = (id: string) => `${conversationsRoot}/${id}`;
39
52
 
@@ -47,6 +60,8 @@ export const importConversation = () => `${conversationsRoot}/import`;
47
60
 
48
61
  export const forkConversation = () => `${conversationsRoot}/fork`;
49
62
 
63
+ export const duplicateConversation = () => `${conversationsRoot}/duplicate`;
64
+
50
65
  export const search = (q: string, pageNumber: string) =>
51
66
  `/api/search?q=${q}&pageNumber=${pageNumber}`;
52
67
 
@@ -74,7 +89,8 @@ export const loginFacebook = () => '/api/auth/facebook';
74
89
 
75
90
  export const loginGoogle = () => '/api/auth/google';
76
91
 
77
- export const refreshToken = (retry?: boolean) => `/api/auth/refresh${retry ? '?retry=true' : ''}`;
92
+ export const refreshToken = (retry?: boolean) =>
93
+ `/api/auth/refresh${retry === true ? '?retry=true' : ''}`;
78
94
 
79
95
  export const requestPasswordReset = () => '/api/auth/requestPasswordReset';
80
96
 
@@ -91,19 +107,21 @@ export const config = () => '/api/config';
91
107
  export const prompts = () => '/api/prompts';
92
108
 
93
109
  export const assistants = ({
94
- path,
110
+ path = '',
95
111
  options,
96
112
  version,
97
113
  endpoint,
114
+ isAvatar,
98
115
  }: {
99
116
  path?: string;
100
117
  options?: object;
101
118
  endpoint?: AssistantsEndpoint;
102
119
  version: number | string;
120
+ isAvatar?: boolean;
103
121
  }) => {
104
- let url = `/api/assistants/v${version}`;
122
+ let url = isAvatar === true ? `${images()}/assistants` : `/api/assistants/v${version}`;
105
123
 
106
- if (path) {
124
+ if (path && path !== '') {
107
125
  url += `/${path}`;
108
126
  }
109
127
 
@@ -122,6 +140,21 @@ export const assistants = ({
122
140
  return url;
123
141
  };
124
142
 
143
+ export const agents = ({ path = '', options }: { path?: string; options?: object }) => {
144
+ let url = '/api/agents';
145
+
146
+ if (path && path !== '') {
147
+ url += `/${path}`;
148
+ }
149
+
150
+ if (options && Object.keys(options).length > 0) {
151
+ const queryParams = new URLSearchParams(options as Record<string, string>).toString();
152
+ url += `?${queryParams}`;
153
+ }
154
+
155
+ return url;
156
+ };
157
+
125
158
  export const files = () => '/api/files';
126
159
 
127
160
  export const images = () => `${files()}/images`;
@@ -186,5 +219,29 @@ export const getAllPromptGroups = () => `${prompts()}/all`;
186
219
  /* Roles */
187
220
  export const roles = () => '/api/roles';
188
221
  export const getRole = (roleName: string) => `${roles()}/${roleName.toLowerCase()}`;
189
- export const updatePromptPermissions = (roleName: string) =>
190
- `${roles()}/${roleName.toLowerCase()}/prompts`;
222
+ export const updatePromptPermissions = (roleName: string) => `${getRole(roleName)}/prompts`;
223
+ export const updateAgentPermissions = (roleName: string) => `${getRole(roleName)}/agents`;
224
+
225
+ /* Conversation Tags */
226
+ export const conversationTags = (tag?: string) =>
227
+ `/api/tags${tag != null && tag ? `/${encodeURIComponent(tag)}` : ''}`;
228
+
229
+ export const conversationTagsList = (pageNumber: string, sort?: string, order?: string) =>
230
+ `${conversationTags()}/list?pageNumber=${pageNumber}${sort ? `&sort=${sort}` : ''}${
231
+ order ? `&order=${order}` : ''
232
+ }`;
233
+
234
+ export const addTagToConversation = (conversationId: string) =>
235
+ `${conversationTags()}/convo/${conversationId}`;
236
+
237
+ export const userTerms = () => '/api/user/terms';
238
+ export const acceptUserTerms = () => '/api/user/terms/accept';
239
+ export const banner = () => '/api/banner';
240
+
241
+ // Two-Factor Endpoints
242
+ export const enableTwoFactor = () => '/api/auth/2fa/enable';
243
+ export const verifyTwoFactor = () => '/api/auth/2fa/verify';
244
+ export const confirmTwoFactor = () => '/api/auth/2fa/confirm';
245
+ export const disableTwoFactor = () => '/api/auth/2fa/disable';
246
+ export const regenerateBackupCodes = () => '/api/auth/2fa/backup/regenerate';
247
+ export const verifyTwoFactorTemp = () => '/api/auth/2fa/verify-temp';