librechat-data-provider 0.7.78 → 0.7.81
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/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/package.json +2 -1
- package/specs/actions.spec.ts +238 -0
- package/specs/parsers.spec.ts +125 -0
- package/src/actions.ts +73 -19
- package/src/api-endpoints.ts +42 -10
- package/src/config.ts +28 -1
- package/src/createPayload.ts +13 -2
- package/src/data-service.ts +47 -69
- package/src/file-config.ts +3 -2
- package/src/index.ts +1 -0
- package/src/parsers.ts +45 -16
- package/src/permissions.ts +90 -0
- package/src/react-query/react-query-service.ts +5 -34
- package/src/roles.ts +72 -126
- package/src/schemas.ts +151 -178
- package/src/types/assistants.ts +16 -18
- package/src/types/mutations.ts +8 -2
- package/src/types/queries.ts +28 -13
- package/src/types.ts +10 -0
- package/src/zod.spec.ts +569 -1
- package/src/zod.ts +318 -9
package/src/types/assistants.ts
CHANGED
|
@@ -27,6 +27,7 @@ export enum EToolResources {
|
|
|
27
27
|
code_interpreter = 'code_interpreter',
|
|
28
28
|
execute_code = 'execute_code',
|
|
29
29
|
file_search = 'file_search',
|
|
30
|
+
image_edit = 'image_edit',
|
|
30
31
|
ocr = 'ocr',
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -163,15 +164,9 @@ export type AgentModelParameters = {
|
|
|
163
164
|
presence_penalty: AgentParameterValue;
|
|
164
165
|
};
|
|
165
166
|
|
|
166
|
-
export interface
|
|
167
|
-
execute_code?: ExecuteCodeResource;
|
|
168
|
-
file_search?: AgentFileResource;
|
|
169
|
-
ocr?: Omit<AgentFileResource, 'vector_store_ids'>;
|
|
170
|
-
}
|
|
171
|
-
export interface ExecuteCodeResource {
|
|
167
|
+
export interface AgentBaseResource {
|
|
172
168
|
/**
|
|
173
|
-
* A list of file IDs made available to the
|
|
174
|
-
* There can be a maximum of 20 files associated with the tool.
|
|
169
|
+
* A list of file IDs made available to the tool.
|
|
175
170
|
*/
|
|
176
171
|
file_ids?: Array<string>;
|
|
177
172
|
/**
|
|
@@ -180,21 +175,24 @@ export interface ExecuteCodeResource {
|
|
|
180
175
|
files?: Array<TFile>;
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
export interface
|
|
178
|
+
export interface AgentToolResources {
|
|
179
|
+
[EToolResources.image_edit]?: AgentBaseResource;
|
|
180
|
+
[EToolResources.execute_code]?: ExecuteCodeResource;
|
|
181
|
+
[EToolResources.file_search]?: AgentFileResource;
|
|
182
|
+
[EToolResources.ocr]?: AgentBaseResource;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A resource for the execute_code tool.
|
|
186
|
+
* Contains file IDs made available to the tool (max 20 files) and already fetched files.
|
|
187
|
+
*/
|
|
188
|
+
export type ExecuteCodeResource = AgentBaseResource;
|
|
189
|
+
|
|
190
|
+
export interface AgentFileResource extends AgentBaseResource {
|
|
184
191
|
/**
|
|
185
192
|
* The ID of the vector store attached to this agent. There
|
|
186
193
|
* can be a maximum of 1 vector store attached to the agent.
|
|
187
194
|
*/
|
|
188
195
|
vector_store_ids?: Array<string>;
|
|
189
|
-
/**
|
|
190
|
-
* A list of file IDs made available to the `file_search` tool.
|
|
191
|
-
* To be used before vector stores are implemented.
|
|
192
|
-
*/
|
|
193
|
-
file_ids?: Array<string>;
|
|
194
|
-
/**
|
|
195
|
-
* A list of files already fetched.
|
|
196
|
-
*/
|
|
197
|
-
files?: Array<TFile>;
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
export type Agent = {
|
package/src/types/mutations.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as types from '../types';
|
|
2
2
|
import * as r from '../roles';
|
|
3
|
+
import * as p from '../permissions';
|
|
3
4
|
import {
|
|
4
5
|
Tools,
|
|
5
6
|
Assistant,
|
|
@@ -163,6 +164,11 @@ export type DeleteConversationOptions = MutationOptions<
|
|
|
163
164
|
types.TDeleteConversationRequest
|
|
164
165
|
>;
|
|
165
166
|
|
|
167
|
+
export type ArchiveConversationOptions = MutationOptions<
|
|
168
|
+
types.TArchiveConversationResponse,
|
|
169
|
+
types.TArchiveConversationRequest
|
|
170
|
+
>;
|
|
171
|
+
|
|
166
172
|
export type DuplicateConvoOptions = MutationOptions<
|
|
167
173
|
types.TDuplicateConvoResponse,
|
|
168
174
|
types.TDuplicateConvoRequest
|
|
@@ -251,9 +257,9 @@ export type UpdatePermVars<T> = {
|
|
|
251
257
|
updates: Partial<T>;
|
|
252
258
|
};
|
|
253
259
|
|
|
254
|
-
export type UpdatePromptPermVars = UpdatePermVars<
|
|
260
|
+
export type UpdatePromptPermVars = UpdatePermVars<p.TPromptPermissions>;
|
|
255
261
|
|
|
256
|
-
export type UpdateAgentPermVars = UpdatePermVars<
|
|
262
|
+
export type UpdateAgentPermVars = UpdatePermVars<p.TAgentPermissions>;
|
|
257
263
|
|
|
258
264
|
export type UpdatePermResponse = r.TRole;
|
|
259
265
|
|
package/src/types/queries.ts
CHANGED
|
@@ -11,25 +11,23 @@ export type Conversation = {
|
|
|
11
11
|
conversations: s.TConversation[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
// Parameters for listing conversations (e.g., for pagination)
|
|
15
14
|
export type ConversationListParams = {
|
|
16
|
-
|
|
17
|
-
before?: string | null;
|
|
18
|
-
after?: string | null;
|
|
19
|
-
order?: 'asc' | 'desc';
|
|
20
|
-
pageNumber: string;
|
|
21
|
-
conversationId?: string;
|
|
15
|
+
cursor?: string;
|
|
22
16
|
isArchived?: boolean;
|
|
17
|
+
sortBy?: 'title' | 'createdAt' | 'updatedAt';
|
|
18
|
+
sortDirection?: 'asc' | 'desc';
|
|
23
19
|
tags?: string[];
|
|
20
|
+
search?: string;
|
|
24
21
|
};
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
export type MinimalConversation = Pick<
|
|
24
|
+
s.TConversation,
|
|
25
|
+
'conversationId' | 'endpoint' | 'title' | 'createdAt' | 'updatedAt' | 'user'
|
|
26
|
+
>;
|
|
27
|
+
|
|
27
28
|
export type ConversationListResponse = {
|
|
28
|
-
conversations:
|
|
29
|
-
|
|
30
|
-
pageSize: string | number;
|
|
31
|
-
pages: string | number;
|
|
32
|
-
messages: s.TMessage[];
|
|
29
|
+
conversations: MinimalConversation[];
|
|
30
|
+
nextCursor: string | null;
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
export type ConversationData = InfiniteData<ConversationListResponse>;
|
|
@@ -38,6 +36,23 @@ export type ConversationUpdater = (
|
|
|
38
36
|
conversation: s.TConversation,
|
|
39
37
|
) => ConversationData;
|
|
40
38
|
|
|
39
|
+
/* Messages */
|
|
40
|
+
export type MessagesListParams = {
|
|
41
|
+
cursor?: string | null;
|
|
42
|
+
sortBy?: 'endpoint' | 'createdAt' | 'updatedAt';
|
|
43
|
+
sortDirection?: 'asc' | 'desc';
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
conversationId?: string;
|
|
46
|
+
messageId?: string;
|
|
47
|
+
search?: string;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type MessagesListResponse = {
|
|
51
|
+
messages: s.TMessage[];
|
|
52
|
+
nextCursor: string | null;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/* Shared Links */
|
|
41
56
|
export type SharedMessagesResponse = Omit<s.TSharedLink, 'messages'> & {
|
|
42
57
|
messages: s.TMessage[];
|
|
43
58
|
};
|
package/src/types.ts
CHANGED
|
@@ -18,6 +18,8 @@ export type TMessages = TMessage[];
|
|
|
18
18
|
|
|
19
19
|
/* TODO: Cleanup EndpointOption types */
|
|
20
20
|
export type TEndpointOption = {
|
|
21
|
+
spec?: string | null;
|
|
22
|
+
iconURL?: string | null;
|
|
21
23
|
endpoint: EModelEndpoint;
|
|
22
24
|
endpointType?: EModelEndpoint;
|
|
23
25
|
modelDisplayLabel?: string;
|
|
@@ -39,12 +41,18 @@ export type TEndpointOption = {
|
|
|
39
41
|
overrideUserMessageId?: string;
|
|
40
42
|
};
|
|
41
43
|
|
|
44
|
+
export type TEphemeralAgent = {
|
|
45
|
+
mcp?: string[];
|
|
46
|
+
execute_code?: boolean;
|
|
47
|
+
};
|
|
48
|
+
|
|
42
49
|
export type TPayload = Partial<TMessage> &
|
|
43
50
|
Partial<TEndpointOption> & {
|
|
44
51
|
isContinued: boolean;
|
|
45
52
|
conversationId: string | null;
|
|
46
53
|
messages?: TMessages;
|
|
47
54
|
isTemporary: boolean;
|
|
55
|
+
ephemeralAgent?: TEphemeralAgent | null;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
58
|
export type TSubmission = {
|
|
@@ -57,10 +65,12 @@ export type TSubmission = {
|
|
|
57
65
|
isTemporary: boolean;
|
|
58
66
|
messages: TMessage[];
|
|
59
67
|
isRegenerate?: boolean;
|
|
68
|
+
isResubmission?: boolean;
|
|
60
69
|
initialResponse?: TMessage;
|
|
61
70
|
conversation: Partial<TConversation>;
|
|
62
71
|
endpointOption: TEndpointOption;
|
|
63
72
|
clientTimestamp?: string;
|
|
73
|
+
ephemeralAgent?: TEphemeralAgent | null;
|
|
64
74
|
};
|
|
65
75
|
|
|
66
76
|
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|