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/types/mutations.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as types from '../types';
|
|
2
2
|
import * as r from '../roles';
|
|
3
3
|
import {
|
|
4
|
+
Tools,
|
|
4
5
|
Assistant,
|
|
5
6
|
AssistantCreateParams,
|
|
6
7
|
AssistantUpdateParams,
|
|
@@ -8,6 +9,9 @@ import {
|
|
|
8
9
|
FunctionTool,
|
|
9
10
|
AssistantDocument,
|
|
10
11
|
Action,
|
|
12
|
+
Agent,
|
|
13
|
+
AgentCreateParams,
|
|
14
|
+
AgentUpdateParams,
|
|
11
15
|
} from './assistants';
|
|
12
16
|
|
|
13
17
|
export type MutationOptions<
|
|
@@ -20,6 +24,12 @@ export type MutationOptions<
|
|
|
20
24
|
onSuccess?: (data: Response, variables: Request, context?: Context) => void;
|
|
21
25
|
onMutate?: (variables: Request) => Snapshot | Promise<Snapshot>;
|
|
22
26
|
onError?: (error: Error, variables: Request, context?: Context, snapshot?: Snapshot) => void;
|
|
27
|
+
onSettled?: (
|
|
28
|
+
data: Response | undefined,
|
|
29
|
+
error: Error | null,
|
|
30
|
+
variables: Request,
|
|
31
|
+
context?: Context,
|
|
32
|
+
) => void;
|
|
23
33
|
};
|
|
24
34
|
|
|
25
35
|
export type TGenTitleRequest = {
|
|
@@ -39,7 +49,7 @@ export type UpdatePresetOptions = MutationOptions<types.TPreset, types.TPreset>;
|
|
|
39
49
|
|
|
40
50
|
export type DeletePresetOptions = MutationOptions<PresetDeleteResponse, types.TPreset | undefined>;
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
/* Assistant mutations */
|
|
43
53
|
|
|
44
54
|
export type AssistantAvatarVariables = {
|
|
45
55
|
assistant_id: string;
|
|
@@ -94,22 +104,98 @@ export type DeleteActionVariables = {
|
|
|
94
104
|
|
|
95
105
|
export type DeleteActionOptions = MutationOptions<void, DeleteActionVariables>;
|
|
96
106
|
|
|
107
|
+
/* Agent mutations */
|
|
108
|
+
|
|
109
|
+
export type AgentAvatarVariables = {
|
|
110
|
+
agent_id: string;
|
|
111
|
+
formData: FormData;
|
|
112
|
+
postCreation?: boolean;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type UpdateAgentActionVariables = {
|
|
116
|
+
agent_id: string;
|
|
117
|
+
action_id?: string;
|
|
118
|
+
metadata: ActionMetadata;
|
|
119
|
+
functions: FunctionTool[];
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export type UploadAgentAvatarOptions = MutationOptions<Agent, AgentAvatarVariables>;
|
|
123
|
+
|
|
124
|
+
export type CreateAgentMutationOptions = MutationOptions<Agent, AgentCreateParams>;
|
|
125
|
+
|
|
126
|
+
export type UpdateAgentVariables = {
|
|
127
|
+
agent_id: string;
|
|
128
|
+
data: AgentUpdateParams;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type UpdateAgentMutationOptions = MutationOptions<Agent, UpdateAgentVariables>;
|
|
132
|
+
|
|
133
|
+
export type DuplicateAgentBody = {
|
|
134
|
+
agent_id: string;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type DuplicateAgentMutationOptions = MutationOptions<
|
|
138
|
+
{ agent: Agent; actions: Action[] },
|
|
139
|
+
Pick<DuplicateAgentBody, 'agent_id'>
|
|
140
|
+
>;
|
|
141
|
+
|
|
142
|
+
export type DeleteAgentBody = {
|
|
143
|
+
agent_id: string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export type DeleteAgentMutationOptions = MutationOptions<void, Pick<DeleteAgentBody, 'agent_id'>>;
|
|
147
|
+
|
|
148
|
+
export type UpdateAgentActionResponse = [Agent, Action];
|
|
149
|
+
export type UpdateAgentActionOptions = MutationOptions<
|
|
150
|
+
UpdateAgentActionResponse,
|
|
151
|
+
UpdateAgentActionVariables
|
|
152
|
+
>;
|
|
153
|
+
|
|
154
|
+
export type DeleteAgentActionVariables = {
|
|
155
|
+
agent_id: string;
|
|
156
|
+
action_id: string;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export type DeleteAgentActionOptions = MutationOptions<void, DeleteAgentActionVariables>;
|
|
160
|
+
|
|
97
161
|
export type DeleteConversationOptions = MutationOptions<
|
|
98
162
|
types.TDeleteConversationResponse,
|
|
99
163
|
types.TDeleteConversationRequest
|
|
100
164
|
>;
|
|
101
165
|
|
|
166
|
+
export type DuplicateConvoOptions = MutationOptions<
|
|
167
|
+
types.TDuplicateConvoResponse,
|
|
168
|
+
types.TDuplicateConvoRequest
|
|
169
|
+
>;
|
|
170
|
+
|
|
102
171
|
export type ForkConvoOptions = MutationOptions<types.TForkConvoResponse, types.TForkConvoRequest>;
|
|
103
172
|
|
|
104
173
|
export type CreateSharedLinkOptions = MutationOptions<
|
|
105
174
|
types.TSharedLink,
|
|
106
175
|
Partial<types.TSharedLink>
|
|
107
176
|
>;
|
|
177
|
+
|
|
178
|
+
export type updateTagsInConvoOptions = MutationOptions<
|
|
179
|
+
types.TTagConversationResponse,
|
|
180
|
+
types.TTagConversationRequest
|
|
181
|
+
>;
|
|
182
|
+
|
|
108
183
|
export type UpdateSharedLinkOptions = MutationOptions<
|
|
109
184
|
types.TSharedLink,
|
|
110
185
|
Partial<types.TSharedLink>
|
|
111
186
|
>;
|
|
112
|
-
|
|
187
|
+
|
|
188
|
+
export type ArchiveConvoOptions = MutationOptions<
|
|
189
|
+
types.TArchiveConversationResponse,
|
|
190
|
+
types.TArchiveConversationRequest
|
|
191
|
+
>;
|
|
192
|
+
|
|
193
|
+
export type DeleteSharedLinkContext = { previousQueries?: Map<string, TDeleteSharedLinkResponse> };
|
|
194
|
+
export type DeleteSharedLinkOptions = MutationOptions<
|
|
195
|
+
TDeleteSharedLinkResponse,
|
|
196
|
+
{ shareId: string },
|
|
197
|
+
DeleteSharedLinkContext
|
|
198
|
+
>;
|
|
113
199
|
|
|
114
200
|
export type TUpdatePromptContext =
|
|
115
201
|
| {
|
|
@@ -160,16 +246,93 @@ export type RegistrationOptions = MutationOptions<
|
|
|
160
246
|
types.TError
|
|
161
247
|
>;
|
|
162
248
|
|
|
163
|
-
export type
|
|
249
|
+
export type UpdatePermVars<T> = {
|
|
164
250
|
roleName: string;
|
|
165
|
-
updates: Partial<
|
|
251
|
+
updates: Partial<T>;
|
|
166
252
|
};
|
|
167
253
|
|
|
168
|
-
export type
|
|
254
|
+
export type UpdatePromptPermVars = UpdatePermVars<r.TPromptPermissions>;
|
|
255
|
+
|
|
256
|
+
export type UpdateAgentPermVars = UpdatePermVars<r.TAgentPermissions>;
|
|
257
|
+
|
|
258
|
+
export type UpdatePermResponse = r.TRole;
|
|
169
259
|
|
|
170
260
|
export type UpdatePromptPermOptions = MutationOptions<
|
|
171
|
-
|
|
261
|
+
UpdatePermResponse,
|
|
172
262
|
UpdatePromptPermVars,
|
|
173
263
|
unknown,
|
|
174
|
-
types.TError
|
|
264
|
+
types.TError | null | undefined
|
|
265
|
+
>;
|
|
266
|
+
|
|
267
|
+
export type UpdateAgentPermOptions = MutationOptions<
|
|
268
|
+
UpdatePermResponse,
|
|
269
|
+
UpdateAgentPermVars,
|
|
270
|
+
unknown,
|
|
271
|
+
types.TError | null | undefined
|
|
272
|
+
>;
|
|
273
|
+
|
|
274
|
+
export type UpdateConversationTagOptions = MutationOptions<
|
|
275
|
+
types.TConversationTag,
|
|
276
|
+
types.TConversationTagRequest
|
|
277
|
+
>;
|
|
278
|
+
export type DeleteConversationTagOptions = MutationOptions<types.TConversationTag, string>;
|
|
279
|
+
|
|
280
|
+
export type AcceptTermsMutationOptions = MutationOptions<
|
|
281
|
+
types.TAcceptTermsResponse,
|
|
282
|
+
void,
|
|
283
|
+
unknown,
|
|
284
|
+
void
|
|
285
|
+
>;
|
|
286
|
+
|
|
287
|
+
/* Tools */
|
|
288
|
+
export type UpdatePluginAuthOptions = MutationOptions<types.TUser, types.TUpdateUserPlugins>;
|
|
289
|
+
|
|
290
|
+
export type ToolParamsMap = {
|
|
291
|
+
[Tools.execute_code]: {
|
|
292
|
+
lang: string;
|
|
293
|
+
code: string;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
export type ToolId = keyof ToolParamsMap;
|
|
298
|
+
|
|
299
|
+
export type ToolParams<T extends ToolId> = ToolParamsMap[T] & {
|
|
300
|
+
messageId: string;
|
|
301
|
+
partIndex?: number;
|
|
302
|
+
blockIndex?: number;
|
|
303
|
+
conversationId: string;
|
|
304
|
+
};
|
|
305
|
+
export type ToolCallResponse = { result: unknown; attachments?: types.TAttachment[] };
|
|
306
|
+
export type ToolCallMutationOptions<T extends ToolId> = MutationOptions<
|
|
307
|
+
ToolCallResponse,
|
|
308
|
+
ToolParams<T>
|
|
175
309
|
>;
|
|
310
|
+
|
|
311
|
+
export type TDeleteSharedLinkResponse = {
|
|
312
|
+
success: boolean;
|
|
313
|
+
shareId: string;
|
|
314
|
+
message: string;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export type TEditArtifactRequest = {
|
|
318
|
+
index: number;
|
|
319
|
+
messageId: string;
|
|
320
|
+
original: string;
|
|
321
|
+
updated: string;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export type TEditArtifactResponse = Pick<types.TMessage, 'content' | 'text' | 'conversationId'>;
|
|
325
|
+
|
|
326
|
+
export type EditArtifactOptions = MutationOptions<
|
|
327
|
+
TEditArtifactResponse,
|
|
328
|
+
TEditArtifactRequest,
|
|
329
|
+
unknown,
|
|
330
|
+
Error
|
|
331
|
+
>;
|
|
332
|
+
|
|
333
|
+
export type TLogoutResponse = {
|
|
334
|
+
message: string;
|
|
335
|
+
redirect?: string;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export type LogoutOptions = MutationOptions<TLogoutResponse, undefined>;
|
package/src/types/queries.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { InfiniteData } from '@tanstack/react-query';
|
|
2
|
-
import type
|
|
2
|
+
import type * as a from '../types/agents';
|
|
3
|
+
import type * as s from '../schemas';
|
|
3
4
|
import type * as t from '../types';
|
|
5
|
+
|
|
4
6
|
export type Conversation = {
|
|
5
7
|
id: string;
|
|
6
8
|
createdAt: number;
|
|
7
9
|
participants: string[];
|
|
8
10
|
lastMessage: string;
|
|
9
|
-
conversations: TConversation[];
|
|
11
|
+
conversations: s.TConversation[];
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
// Parameters for listing conversations (e.g., for pagination)
|
|
@@ -15,46 +17,58 @@ export type ConversationListParams = {
|
|
|
15
17
|
before?: string | null;
|
|
16
18
|
after?: string | null;
|
|
17
19
|
order?: 'asc' | 'desc';
|
|
18
|
-
pageNumber: string;
|
|
20
|
+
pageNumber: string;
|
|
19
21
|
conversationId?: string;
|
|
20
22
|
isArchived?: boolean;
|
|
23
|
+
tags?: string[];
|
|
21
24
|
};
|
|
22
25
|
|
|
23
26
|
// Type for the response from the conversation list API
|
|
24
27
|
export type ConversationListResponse = {
|
|
25
|
-
conversations: TConversation[];
|
|
28
|
+
conversations: s.TConversation[];
|
|
26
29
|
pageNumber: string;
|
|
27
30
|
pageSize: string | number;
|
|
28
31
|
pages: string | number;
|
|
29
|
-
messages: TMessage[];
|
|
32
|
+
messages: s.TMessage[];
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
export type ConversationData = InfiniteData<ConversationListResponse>;
|
|
33
36
|
export type ConversationUpdater = (
|
|
34
37
|
data: ConversationData,
|
|
35
|
-
conversation: TConversation,
|
|
38
|
+
conversation: s.TConversation,
|
|
36
39
|
) => ConversationData;
|
|
37
40
|
|
|
38
|
-
export type SharedMessagesResponse = Omit<TSharedLink, 'messages'> & {
|
|
39
|
-
messages: TMessage[];
|
|
40
|
-
};
|
|
41
|
-
export type SharedLinkListParams = Omit<ConversationListParams, 'isArchived' | 'conversationId'> & {
|
|
42
|
-
isPublic?: boolean;
|
|
41
|
+
export type SharedMessagesResponse = Omit<s.TSharedLink, 'messages'> & {
|
|
42
|
+
messages: s.TMessage[];
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
export interface SharedLinksListParams {
|
|
46
|
+
pageSize: number;
|
|
47
|
+
isPublic: boolean;
|
|
48
|
+
sortBy: 'title' | 'createdAt';
|
|
49
|
+
sortDirection: 'asc' | 'desc';
|
|
50
|
+
search?: string;
|
|
51
|
+
cursor?: string;
|
|
52
|
+
}
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
export type SharedLinkItem = {
|
|
55
|
+
shareId: string;
|
|
56
|
+
title: string;
|
|
57
|
+
isPublic: boolean;
|
|
58
|
+
createdAt: Date;
|
|
59
|
+
conversationId: string;
|
|
55
60
|
};
|
|
56
61
|
|
|
57
|
-
export
|
|
62
|
+
export interface SharedLinksResponse {
|
|
63
|
+
links: SharedLinkItem[];
|
|
64
|
+
nextCursor: string | null;
|
|
65
|
+
hasNextPage: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface SharedLinkQueryData {
|
|
69
|
+
pages: SharedLinksResponse[];
|
|
70
|
+
pageParams: (string | null)[];
|
|
71
|
+
}
|
|
58
72
|
|
|
59
73
|
export type AllPromptGroupsFilterRequest = {
|
|
60
74
|
category: string;
|
|
@@ -68,3 +82,11 @@ export type AllPromptGroupsFilterRequest = {
|
|
|
68
82
|
};
|
|
69
83
|
|
|
70
84
|
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
|
85
|
+
|
|
86
|
+
export type ConversationTagsResponse = s.TConversationTag[];
|
|
87
|
+
|
|
88
|
+
export type VerifyToolAuthParams = { toolId: string };
|
|
89
|
+
export type VerifyToolAuthResponse = { authenticated: boolean; message?: string | s.AuthType };
|
|
90
|
+
|
|
91
|
+
export type GetToolCallParams = { conversationId: string };
|
|
92
|
+
export type ToolCallResults = a.ToolCallResult[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export enum ContentTypes {
|
|
2
|
+
TEXT = 'text',
|
|
3
|
+
THINK = 'think',
|
|
4
|
+
TEXT_DELTA = 'text_delta',
|
|
5
|
+
TOOL_CALL = 'tool_call',
|
|
6
|
+
IMAGE_FILE = 'image_file',
|
|
7
|
+
IMAGE_URL = 'image_url',
|
|
8
|
+
ERROR = 'error',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum StepTypes {
|
|
12
|
+
TOOL_CALLS = 'tool_calls',
|
|
13
|
+
MESSAGE_CREATION = 'message_creation',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum ToolCallTypes {
|
|
17
|
+
FUNCTION = 'function',
|
|
18
|
+
RETRIEVAL = 'retrieval',
|
|
19
|
+
FILE_SEARCH = 'file_search',
|
|
20
|
+
CODE_INTERPRETER = 'code_interpreter',
|
|
21
|
+
/* Agents Tool Call */
|
|
22
|
+
TOOL_CALL = 'tool_call',
|
|
23
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import OpenAI from 'openai';
|
|
1
|
+
import type OpenAI from 'openai';
|
|
2
2
|
import type { InfiniteData } from '@tanstack/react-query';
|
|
3
3
|
import type {
|
|
4
4
|
TMessage,
|
|
@@ -7,24 +7,22 @@ import type {
|
|
|
7
7
|
TSharedLink,
|
|
8
8
|
TConversation,
|
|
9
9
|
EModelEndpoint,
|
|
10
|
+
TConversationTag,
|
|
11
|
+
TBanner,
|
|
10
12
|
} from './schemas';
|
|
11
|
-
import type { TSpecsConfig } from './models';
|
|
12
13
|
export type TOpenAIMessage = OpenAI.Chat.ChatCompletionMessageParam;
|
|
13
|
-
export type TOpenAIFunction = OpenAI.Chat.ChatCompletionCreateParams.Function;
|
|
14
|
-
export type TOpenAIFunctionCall = OpenAI.Chat.ChatCompletionCreateParams.FunctionCallOption;
|
|
15
14
|
|
|
16
15
|
export * from './schemas';
|
|
17
16
|
|
|
18
17
|
export type TMessages = TMessage[];
|
|
19
18
|
|
|
20
|
-
export type TMessagesAtom = TMessages | null;
|
|
21
|
-
|
|
22
19
|
/* TODO: Cleanup EndpointOption types */
|
|
23
20
|
export type TEndpointOption = {
|
|
24
21
|
endpoint: EModelEndpoint;
|
|
25
22
|
endpointType?: EModelEndpoint;
|
|
26
23
|
modelDisplayLabel?: string;
|
|
27
24
|
resendFiles?: boolean;
|
|
25
|
+
promptCache?: boolean;
|
|
28
26
|
maxContextTokens?: number;
|
|
29
27
|
imageDetail?: ImageDetail;
|
|
30
28
|
model?: string | null;
|
|
@@ -46,38 +44,45 @@ export type TPayload = Partial<TMessage> &
|
|
|
46
44
|
isContinued: boolean;
|
|
47
45
|
conversationId: string | null;
|
|
48
46
|
messages?: TMessages;
|
|
47
|
+
isTemporary: boolean;
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
export type TSubmission = {
|
|
51
|
+
artifacts?: string;
|
|
52
52
|
plugin?: TResPlugin;
|
|
53
53
|
plugins?: TResPlugin[];
|
|
54
54
|
userMessage: TMessage;
|
|
55
55
|
isEdited?: boolean;
|
|
56
56
|
isContinued?: boolean;
|
|
57
|
+
isTemporary: boolean;
|
|
57
58
|
messages: TMessage[];
|
|
58
59
|
isRegenerate?: boolean;
|
|
59
60
|
conversationId?: string;
|
|
60
|
-
initialResponse
|
|
61
|
+
initialResponse?: TMessage;
|
|
61
62
|
conversation: Partial<TConversation>;
|
|
62
63
|
endpointOption: TEndpointOption;
|
|
64
|
+
clientTimestamp?: string;
|
|
63
65
|
};
|
|
64
66
|
|
|
67
|
+
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|
|
68
|
+
|
|
65
69
|
export type TPluginAction = {
|
|
66
70
|
pluginKey: string;
|
|
67
71
|
action: 'install' | 'uninstall';
|
|
68
72
|
auth?: unknown;
|
|
69
|
-
|
|
73
|
+
isEntityTool?: boolean;
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
export type GroupedConversations = [key: string, TConversation[]][];
|
|
73
77
|
|
|
74
78
|
export type TUpdateUserPlugins = {
|
|
75
|
-
|
|
79
|
+
isEntityTool?: boolean;
|
|
76
80
|
pluginKey: string;
|
|
77
81
|
action: string;
|
|
78
82
|
auth?: unknown;
|
|
79
83
|
};
|
|
80
84
|
|
|
85
|
+
// TODO `label` needs to be changed to the proper `TranslationKeys`
|
|
81
86
|
export type TCategory = {
|
|
82
87
|
id?: string;
|
|
83
88
|
value: string;
|
|
@@ -86,7 +91,7 @@ export type TCategory = {
|
|
|
86
91
|
|
|
87
92
|
export type TError = {
|
|
88
93
|
message: string;
|
|
89
|
-
code?: number;
|
|
94
|
+
code?: number | string;
|
|
90
95
|
response?: {
|
|
91
96
|
data?: {
|
|
92
97
|
message?: string;
|
|
@@ -95,6 +100,12 @@ export type TError = {
|
|
|
95
100
|
};
|
|
96
101
|
};
|
|
97
102
|
|
|
103
|
+
export type TBackupCode = {
|
|
104
|
+
codeHash: string;
|
|
105
|
+
used: boolean;
|
|
106
|
+
usedAt: Date | null;
|
|
107
|
+
};
|
|
108
|
+
|
|
98
109
|
export type TUser = {
|
|
99
110
|
id: string;
|
|
100
111
|
username: string;
|
|
@@ -103,7 +114,8 @@ export type TUser = {
|
|
|
103
114
|
avatar: string;
|
|
104
115
|
role: string;
|
|
105
116
|
provider: string;
|
|
106
|
-
plugins
|
|
117
|
+
plugins?: string[];
|
|
118
|
+
backupCodes?: TBackupCode[];
|
|
107
119
|
createdAt: string;
|
|
108
120
|
updatedAt: string;
|
|
109
121
|
};
|
|
@@ -122,6 +134,13 @@ export type TUpdateMessageRequest = {
|
|
|
122
134
|
text: string;
|
|
123
135
|
};
|
|
124
136
|
|
|
137
|
+
export type TUpdateMessageContent = {
|
|
138
|
+
conversationId: string;
|
|
139
|
+
messageId: string;
|
|
140
|
+
index: number;
|
|
141
|
+
text: string;
|
|
142
|
+
};
|
|
143
|
+
|
|
125
144
|
export type TUpdateUserKeyRequest = {
|
|
126
145
|
name: string;
|
|
127
146
|
value: string;
|
|
@@ -138,6 +157,7 @@ export type TUpdateConversationResponse = TConversation;
|
|
|
138
157
|
export type TDeleteConversationRequest = {
|
|
139
158
|
conversationId?: string;
|
|
140
159
|
thread_id?: string;
|
|
160
|
+
endpoint?: string;
|
|
141
161
|
source?: string;
|
|
142
162
|
};
|
|
143
163
|
|
|
@@ -160,15 +180,45 @@ export type TArchiveConversationResponse = TConversation;
|
|
|
160
180
|
export type TSharedMessagesResponse = Omit<TSharedLink, 'messages'> & {
|
|
161
181
|
messages: TMessage[];
|
|
162
182
|
};
|
|
163
|
-
|
|
164
|
-
|
|
183
|
+
|
|
184
|
+
export type TCreateShareLinkRequest = Pick<TConversation, 'conversationId'>;
|
|
185
|
+
|
|
186
|
+
export type TUpdateShareLinkRequest = Pick<TSharedLink, 'shareId'>;
|
|
187
|
+
|
|
188
|
+
export type TSharedLinkResponse = Pick<TSharedLink, 'shareId'> &
|
|
189
|
+
Pick<TConversation, 'conversationId'>;
|
|
190
|
+
|
|
191
|
+
export type TSharedLinkGetResponse = TSharedLinkResponse & {
|
|
192
|
+
success: boolean;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// type for getting conversation tags
|
|
196
|
+
export type TConversationTagsResponse = TConversationTag[];
|
|
197
|
+
// type for creating conversation tag
|
|
198
|
+
export type TConversationTagRequest = Partial<
|
|
199
|
+
Omit<TConversationTag, 'createdAt' | 'updatedAt' | 'count' | 'user'>
|
|
165
200
|
> & {
|
|
166
|
-
conversationId
|
|
201
|
+
conversationId?: string;
|
|
202
|
+
addToConversation?: boolean;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export type TConversationTagResponse = TConversationTag;
|
|
206
|
+
|
|
207
|
+
export type TTagConversationRequest = {
|
|
208
|
+
tags: string[];
|
|
209
|
+
tag: string;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export type TTagConversationResponse = string[];
|
|
213
|
+
|
|
214
|
+
export type TDuplicateConvoRequest = {
|
|
215
|
+
conversationId?: string;
|
|
167
216
|
};
|
|
168
217
|
|
|
169
|
-
export type
|
|
170
|
-
|
|
171
|
-
|
|
218
|
+
export type TDuplicateConvoResponse = {
|
|
219
|
+
conversation: TConversation;
|
|
220
|
+
messages: TMessage[];
|
|
221
|
+
};
|
|
172
222
|
|
|
173
223
|
export type TForkConvoRequest = {
|
|
174
224
|
messageId: string;
|
|
@@ -197,6 +247,7 @@ export type TConfig = {
|
|
|
197
247
|
type?: EModelEndpoint;
|
|
198
248
|
azure?: boolean;
|
|
199
249
|
availableTools?: [];
|
|
250
|
+
availableRegions?: string[];
|
|
200
251
|
plugins?: Record<string, string>;
|
|
201
252
|
name?: string;
|
|
202
253
|
iconURL?: string;
|
|
@@ -235,16 +286,67 @@ export type TRegisterUser = {
|
|
|
235
286
|
username: string;
|
|
236
287
|
password: string;
|
|
237
288
|
confirm_password?: string;
|
|
289
|
+
token?: string;
|
|
238
290
|
};
|
|
239
291
|
|
|
240
292
|
export type TLoginUser = {
|
|
241
293
|
email: string;
|
|
242
294
|
password: string;
|
|
295
|
+
token?: string;
|
|
296
|
+
backupCode?: string;
|
|
243
297
|
};
|
|
244
298
|
|
|
245
299
|
export type TLoginResponse = {
|
|
246
|
-
token
|
|
247
|
-
user
|
|
300
|
+
token?: string;
|
|
301
|
+
user?: TUser;
|
|
302
|
+
twoFAPending?: boolean;
|
|
303
|
+
tempToken?: string;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
export type TEnable2FAResponse = {
|
|
307
|
+
otpauthUrl: string;
|
|
308
|
+
backupCodes: string[];
|
|
309
|
+
message?: string;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export type TVerify2FARequest = {
|
|
313
|
+
token?: string;
|
|
314
|
+
backupCode?: string;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export type TVerify2FAResponse = {
|
|
318
|
+
message: string;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* For verifying 2FA during login with a temporary token.
|
|
323
|
+
*/
|
|
324
|
+
export type TVerify2FATempRequest = {
|
|
325
|
+
tempToken: string;
|
|
326
|
+
token?: string;
|
|
327
|
+
backupCode?: string;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export type TVerify2FATempResponse = {
|
|
331
|
+
token?: string;
|
|
332
|
+
user?: TUser;
|
|
333
|
+
message?: string;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Response from disabling 2FA.
|
|
338
|
+
*/
|
|
339
|
+
export type TDisable2FAResponse = {
|
|
340
|
+
message: string;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Response from regenerating backup codes.
|
|
345
|
+
*/
|
|
346
|
+
export type TRegenerateBackupCodesResponse = {
|
|
347
|
+
message: string;
|
|
348
|
+
backupCodes: string[];
|
|
349
|
+
backupCodesHash: string[];
|
|
248
350
|
};
|
|
249
351
|
|
|
250
352
|
export type TRequestPasswordReset = {
|
|
@@ -267,51 +369,6 @@ export type TVerifyEmail = {
|
|
|
267
369
|
|
|
268
370
|
export type TResendVerificationEmail = Omit<TVerifyEmail, 'token'>;
|
|
269
371
|
|
|
270
|
-
export type TInterfaceConfig = {
|
|
271
|
-
privacyPolicy?: {
|
|
272
|
-
externalUrl?: string;
|
|
273
|
-
openNewTab?: boolean;
|
|
274
|
-
};
|
|
275
|
-
termsOfService?: {
|
|
276
|
-
externalUrl?: string;
|
|
277
|
-
openNewTab?: boolean;
|
|
278
|
-
};
|
|
279
|
-
endpointsMenu: boolean;
|
|
280
|
-
modelSelect: boolean;
|
|
281
|
-
parameters: boolean;
|
|
282
|
-
sidePanel: boolean;
|
|
283
|
-
presets: boolean;
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
export type TStartupConfig = {
|
|
287
|
-
appTitle: string;
|
|
288
|
-
socialLogins?: string[];
|
|
289
|
-
interface?: TInterfaceConfig;
|
|
290
|
-
discordLoginEnabled: boolean;
|
|
291
|
-
facebookLoginEnabled: boolean;
|
|
292
|
-
githubLoginEnabled: boolean;
|
|
293
|
-
googleLoginEnabled: boolean;
|
|
294
|
-
openidLoginEnabled: boolean;
|
|
295
|
-
openidLabel: string;
|
|
296
|
-
openidImageUrl: string;
|
|
297
|
-
ldapLoginEnabled: boolean;
|
|
298
|
-
serverDomain: string;
|
|
299
|
-
emailLoginEnabled: boolean;
|
|
300
|
-
registrationEnabled: boolean;
|
|
301
|
-
socialLoginEnabled: boolean;
|
|
302
|
-
passwordResetEnabled: boolean;
|
|
303
|
-
emailEnabled: boolean;
|
|
304
|
-
checkBalance: boolean;
|
|
305
|
-
showBirthdayIcon: boolean;
|
|
306
|
-
helpAndFaqURL: string;
|
|
307
|
-
customFooter?: string;
|
|
308
|
-
modelSpecs?: TSpecsConfig;
|
|
309
|
-
sharedLinksEnabled: boolean;
|
|
310
|
-
publicSharedLinksEnabled: boolean;
|
|
311
|
-
analyticsGtmId?: string;
|
|
312
|
-
instanceProjectId: string;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
372
|
export type TRefreshTokenResponse = {
|
|
316
373
|
token: string;
|
|
317
374
|
user: TUser;
|
|
@@ -445,9 +502,7 @@ export type TUpdatePromptLabelsResponse = {
|
|
|
445
502
|
message: string;
|
|
446
503
|
};
|
|
447
504
|
|
|
448
|
-
export type TDeletePromptGroupResponse =
|
|
449
|
-
promptGroup: string;
|
|
450
|
-
};
|
|
505
|
+
export type TDeletePromptGroupResponse = TUpdatePromptLabelsResponse;
|
|
451
506
|
|
|
452
507
|
export type TDeletePromptGroupRequest = {
|
|
453
508
|
id: string;
|
|
@@ -465,3 +520,13 @@ export type TGetRandomPromptsRequest = {
|
|
|
465
520
|
};
|
|
466
521
|
|
|
467
522
|
export type TCustomConfigSpeechResponse = { [key: string]: string };
|
|
523
|
+
|
|
524
|
+
export type TUserTermsResponse = {
|
|
525
|
+
termsAccepted: boolean;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
export type TAcceptTermsResponse = {
|
|
529
|
+
success: boolean;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
export type TBannerResponse = TBanner | null;
|