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.
- package/check_updates.sh +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/dist/react-query/package.json +1 -1
- package/package.json +6 -6
- package/react-query/package.json +1 -1
- package/server-rollup.config.js +3 -3
- package/specs/actions.spec.ts +700 -36
- package/specs/azure.spec.ts +8 -5
- package/specs/filetypes.spec.ts +1 -7
- package/specs/mcp.spec.ts +52 -0
- package/specs/openapiSpecs.ts +127 -0
- package/specs/utils.spec.ts +129 -0
- package/src/actions.ts +311 -101
- package/src/api-endpoints.ts +70 -13
- package/src/artifacts.ts +3104 -0
- package/src/azure.ts +40 -33
- package/src/bedrock.ts +227 -0
- package/src/config.ts +344 -78
- package/src/createPayload.ts +3 -1
- package/src/data-service.ts +353 -90
- package/src/file-config.ts +13 -2
- package/src/generate.ts +31 -2
- package/src/index.ts +12 -4
- package/src/keys.ts +17 -0
- package/src/mcp.ts +87 -0
- package/src/models.ts +1 -1
- package/src/parsers.ts +118 -60
- package/src/react-query/react-query-service.ts +54 -115
- package/src/request.ts +31 -7
- package/src/roles.ts +91 -2
- package/src/schemas.ts +513 -340
- package/src/types/agents.ts +276 -0
- package/src/types/assistants.ts +181 -27
- package/src/types/files.ts +6 -0
- package/src/types/mutations.ts +170 -7
- package/src/types/queries.ts +43 -21
- package/src/types/runs.ts +23 -0
- package/src/types.ts +132 -67
- package/src/utils.ts +44 -0
- package/src/zod.spec.ts +526 -0
- package/src/zod.ts +86 -0
- package/tsconfig.json +1 -2
- package/specs/parsers.spec.ts +0 -48
- package/src/sse.js +0 -242
package/src/api-endpoints.ts
CHANGED
|
@@ -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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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}${
|
|
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) =>
|
|
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
|
-
|
|
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';
|