librechat-data-provider 0.1.2 → 0.1.3
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 +12 -2
- package/dist/index.js +11 -1
- package/package.json +2 -1
- package/src/react-query-service.ts +3 -3
- package/src/types.ts +209 -15
- package/types/createPayload.d.ts +2 -2
- package/types/react-query-service.d.ts +4 -2
- package/types/types.d.ts +180 -15
package/dist/index.es.js
CHANGED
|
@@ -342,6 +342,13 @@ var EModelEndpoint;
|
|
|
342
342
|
EModelEndpoint["gptPlugins"] = "gptPlugins";
|
|
343
343
|
EModelEndpoint["anthropic"] = "anthropic";
|
|
344
344
|
})(EModelEndpoint || (EModelEndpoint = {}));
|
|
345
|
+
var Side;
|
|
346
|
+
(function (Side) {
|
|
347
|
+
Side["Top"] = "top";
|
|
348
|
+
Side["Right"] = "right";
|
|
349
|
+
Side["Bottom"] = "bottom";
|
|
350
|
+
Side["Left"] = "left";
|
|
351
|
+
})(Side || (Side = {}));
|
|
345
352
|
|
|
346
353
|
var QueryKeys;
|
|
347
354
|
(function (QueryKeys) {
|
|
@@ -454,7 +461,10 @@ var useSearchQuery = function (searchQuery, pageNumber, config) {
|
|
|
454
461
|
};
|
|
455
462
|
var useUpdateTokenCountMutation = function () {
|
|
456
463
|
var queryClient = useQueryClient();
|
|
457
|
-
return useMutation(function (
|
|
464
|
+
return useMutation(function (_a) {
|
|
465
|
+
var text = _a.text;
|
|
466
|
+
return updateTokenCount(text);
|
|
467
|
+
}, {
|
|
458
468
|
onSuccess: function () {
|
|
459
469
|
queryClient.invalidateQueries([QueryKeys.tokenCount]);
|
|
460
470
|
},
|
|
@@ -767,4 +777,4 @@ function createPayload(submission) {
|
|
|
767
777
|
return { server: server, payload: payload };
|
|
768
778
|
}
|
|
769
779
|
|
|
770
|
-
export { EModelEndpoint, QueryKeys, SSE, abortRequestWithMessage, clearAllConversations, createPayload, createPreset, deleteConversation, deletePreset, getAIEndpoints, getAvailablePlugins, getConversationById, getConversations, getLoginGoogle, getMessagesByConvoId, getPresets, getSearchEnabled, getStartupConfig, getUser, login, logout, refreshToken, register, requestPasswordReset, resetPassword, searchConversations, setAcceptLanguageHeader, setTokenHeader, updateConversation, updatePreset, updateTokenCount, updateUserPlugins, useAbortRequestWithMessage, useAvailablePluginsQuery, useClearConversationsMutation, useCreatePresetMutation, useDeleteConversationMutation, useDeletePresetMutation, useGetConversationByIdMutation, useGetConversationByIdQuery, useGetConversationsQuery, useGetEndpointsQuery, useGetMessagesByConvoId, useGetPresetsQuery, useGetSearchEnabledQuery, useGetStartupConfig, useGetUserQuery, useLoginUserMutation, useLogoutUserMutation, useRefreshTokenMutation, useRegisterUserMutation, useRequestPasswordResetMutation, useResetPasswordMutation, useSearchQuery, useUpdateConversationMutation, useUpdatePresetMutation, useUpdateTokenCountMutation, useUpdateUserPluginsMutation };
|
|
780
|
+
export { EModelEndpoint, QueryKeys, SSE, Side, abortRequestWithMessage, clearAllConversations, createPayload, createPreset, deleteConversation, deletePreset, getAIEndpoints, getAvailablePlugins, getConversationById, getConversations, getLoginGoogle, getMessagesByConvoId, getPresets, getSearchEnabled, getStartupConfig, getUser, login, logout, refreshToken, register, requestPasswordReset, resetPassword, searchConversations, setAcceptLanguageHeader, setTokenHeader, updateConversation, updatePreset, updateTokenCount, updateUserPlugins, useAbortRequestWithMessage, useAvailablePluginsQuery, useClearConversationsMutation, useCreatePresetMutation, useDeleteConversationMutation, useDeletePresetMutation, useGetConversationByIdMutation, useGetConversationByIdQuery, useGetConversationsQuery, useGetEndpointsQuery, useGetMessagesByConvoId, useGetPresetsQuery, useGetSearchEnabledQuery, useGetStartupConfig, useGetUserQuery, useLoginUserMutation, useLogoutUserMutation, useRefreshTokenMutation, useRegisterUserMutation, useRequestPasswordResetMutation, useResetPasswordMutation, useSearchQuery, useUpdateConversationMutation, useUpdatePresetMutation, useUpdateTokenCountMutation, useUpdateUserPluginsMutation };
|
package/dist/index.js
CHANGED
|
@@ -344,6 +344,13 @@ exports.EModelEndpoint = void 0;
|
|
|
344
344
|
EModelEndpoint["gptPlugins"] = "gptPlugins";
|
|
345
345
|
EModelEndpoint["anthropic"] = "anthropic";
|
|
346
346
|
})(exports.EModelEndpoint || (exports.EModelEndpoint = {}));
|
|
347
|
+
exports.Side = void 0;
|
|
348
|
+
(function (Side) {
|
|
349
|
+
Side["Top"] = "top";
|
|
350
|
+
Side["Right"] = "right";
|
|
351
|
+
Side["Bottom"] = "bottom";
|
|
352
|
+
Side["Left"] = "left";
|
|
353
|
+
})(exports.Side || (exports.Side = {}));
|
|
347
354
|
|
|
348
355
|
exports.QueryKeys = void 0;
|
|
349
356
|
(function (QueryKeys) {
|
|
@@ -456,7 +463,10 @@ var useSearchQuery = function (searchQuery, pageNumber, config) {
|
|
|
456
463
|
};
|
|
457
464
|
var useUpdateTokenCountMutation = function () {
|
|
458
465
|
var queryClient = reactQuery.useQueryClient();
|
|
459
|
-
return reactQuery.useMutation(function (
|
|
466
|
+
return reactQuery.useMutation(function (_a) {
|
|
467
|
+
var text = _a.text;
|
|
468
|
+
return updateTokenCount(text);
|
|
469
|
+
}, {
|
|
460
470
|
onSuccess: function () {
|
|
461
471
|
queryClient.invalidateQueries([exports.QueryKeys.tokenCount]);
|
|
462
472
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "librechat-data-provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "data services for librechat apps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@tanstack/query-core": "^4.29.19",
|
|
37
37
|
"@types/jest": "^29.5.2",
|
|
38
38
|
"@types/node": "^20.3.0",
|
|
39
|
+
"@types/react": "^18.2.18",
|
|
39
40
|
"jest": "^29.5.0",
|
|
40
41
|
"jest-junit": "^16.0.0",
|
|
41
42
|
"rimraf": "^5.0.1",
|
|
@@ -165,7 +165,7 @@ export const useGetSearchEnabledQuery = (
|
|
|
165
165
|
});
|
|
166
166
|
};
|
|
167
167
|
|
|
168
|
-
export const useGetEndpointsQuery = (): QueryObserverResult<t.
|
|
168
|
+
export const useGetEndpointsQuery = (): QueryObserverResult<t.TEndpointsConfig> => {
|
|
169
169
|
return useQuery([QueryKeys.endpoints], () => dataService.getAIEndpoints(), {
|
|
170
170
|
refetchOnWindowFocus: false,
|
|
171
171
|
refetchOnReconnect: false,
|
|
@@ -246,11 +246,11 @@ export const useSearchQuery = (
|
|
|
246
246
|
export const useUpdateTokenCountMutation = (): UseMutationResult<
|
|
247
247
|
t.TUpdateTokenCountResponse,
|
|
248
248
|
unknown,
|
|
249
|
-
string,
|
|
249
|
+
{ text: string },
|
|
250
250
|
unknown
|
|
251
251
|
> => {
|
|
252
252
|
const queryClient = useQueryClient();
|
|
253
|
-
return useMutation((text: string) => dataService.updateTokenCount(text), {
|
|
253
|
+
return useMutation(({ text }: { text: string }) => dataService.updateTokenCount(text), {
|
|
254
254
|
onSuccess: () => {
|
|
255
255
|
queryClient.invalidateQueries([QueryKeys.tokenCount]);
|
|
256
256
|
},
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
1
3
|
export type TMessage = {
|
|
2
4
|
messageId: string;
|
|
3
5
|
conversationId: string;
|
|
@@ -11,9 +13,17 @@ export type TMessage = {
|
|
|
11
13
|
updatedAt: string;
|
|
12
14
|
};
|
|
13
15
|
|
|
16
|
+
export type TMessages = TMessage[];
|
|
17
|
+
|
|
18
|
+
export type TMessagesAtom = TMessages | null;
|
|
19
|
+
|
|
14
20
|
export type TExample = {
|
|
15
|
-
input:
|
|
16
|
-
|
|
21
|
+
input: {
|
|
22
|
+
content: string;
|
|
23
|
+
};
|
|
24
|
+
output: {
|
|
25
|
+
content: string;
|
|
26
|
+
};
|
|
17
27
|
};
|
|
18
28
|
|
|
19
29
|
export enum EModelEndpoint {
|
|
@@ -33,7 +43,7 @@ export type TSubmission = {
|
|
|
33
43
|
conversationId?: string;
|
|
34
44
|
conversationSignature?: string;
|
|
35
45
|
current: boolean;
|
|
36
|
-
endpoint: EModelEndpoint;
|
|
46
|
+
endpoint: EModelEndpoint | null;
|
|
37
47
|
invocationId: number;
|
|
38
48
|
isCreatedByUser: boolean;
|
|
39
49
|
jailbreak: boolean;
|
|
@@ -57,7 +67,7 @@ export type TSubmission = {
|
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
export type TEndpointOption = {
|
|
60
|
-
endpoint: EModelEndpoint;
|
|
70
|
+
endpoint: EModelEndpoint | null;
|
|
61
71
|
model?: string;
|
|
62
72
|
promptPrefix?: string;
|
|
63
73
|
temperature?: number;
|
|
@@ -76,6 +86,17 @@ export type TPlugin = {
|
|
|
76
86
|
icon: string;
|
|
77
87
|
authConfig: TPluginAuthConfig[];
|
|
78
88
|
authenticated: boolean;
|
|
89
|
+
isButton?: boolean;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export type TPluginAction = {
|
|
93
|
+
pluginKey: string;
|
|
94
|
+
action: 'install' | 'uninstall';
|
|
95
|
+
auth?: unknown;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export type TTemplate = {
|
|
99
|
+
[key: string]: TPlugin;
|
|
79
100
|
};
|
|
80
101
|
|
|
81
102
|
export type TUpdateUserPlugins = {
|
|
@@ -84,17 +105,25 @@ export type TUpdateUserPlugins = {
|
|
|
84
105
|
auth?: unknown;
|
|
85
106
|
};
|
|
86
107
|
|
|
108
|
+
export type TAgentOptions = {
|
|
109
|
+
agent: string;
|
|
110
|
+
skipCompletion: boolean;
|
|
111
|
+
model: string;
|
|
112
|
+
temperature: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
87
115
|
export type TConversation = {
|
|
88
|
-
conversationId: string;
|
|
116
|
+
conversationId: string | null;
|
|
89
117
|
title: string;
|
|
90
118
|
user?: string;
|
|
91
|
-
endpoint: EModelEndpoint;
|
|
119
|
+
endpoint: EModelEndpoint | null;
|
|
92
120
|
suggestions?: string[];
|
|
93
121
|
messages?: TMessage[];
|
|
94
122
|
tools?: TPlugin[];
|
|
95
123
|
createdAt: string;
|
|
96
124
|
updatedAt: string;
|
|
97
125
|
// google only
|
|
126
|
+
systemMessage?: string;
|
|
98
127
|
modelLabel?: string;
|
|
99
128
|
examples?: TExample[];
|
|
100
129
|
// for azureOpenAI, openAI only
|
|
@@ -108,6 +137,7 @@ export type TConversation = {
|
|
|
108
137
|
// bing and google
|
|
109
138
|
context?: string;
|
|
110
139
|
top_p?: number;
|
|
140
|
+
frequency_penalty?: number;
|
|
111
141
|
presence_penalty?: number;
|
|
112
142
|
// for bingAI only
|
|
113
143
|
jailbreak?: boolean;
|
|
@@ -117,21 +147,33 @@ export type TConversation = {
|
|
|
117
147
|
clientId?: string;
|
|
118
148
|
invocationId?: string;
|
|
119
149
|
toneStyle?: string;
|
|
150
|
+
maxOutputTokens?: number;
|
|
151
|
+
// plugins only
|
|
152
|
+
agentOptions?: TAgentOptions;
|
|
120
153
|
};
|
|
121
154
|
|
|
122
155
|
export type TPreset = {
|
|
123
156
|
title: string;
|
|
124
|
-
|
|
157
|
+
conversationId?: string;
|
|
158
|
+
endpoint: EModelEndpoint | null;
|
|
125
159
|
conversationSignature?: string;
|
|
126
160
|
createdAt?: string;
|
|
127
161
|
updatedAt?: string;
|
|
128
162
|
presetId?: string;
|
|
163
|
+
tools?: TPlugin[];
|
|
129
164
|
user?: string;
|
|
165
|
+
modelLabel?: string;
|
|
166
|
+
maxOutputTokens?: number;
|
|
167
|
+
topP?: number;
|
|
168
|
+
topK?: number;
|
|
169
|
+
context?: string;
|
|
170
|
+
systemMessage?: string;
|
|
130
171
|
// for azureOpenAI, openAI only
|
|
131
172
|
chatGptLabel?: string;
|
|
132
173
|
frequence_penalty?: number;
|
|
133
174
|
model?: string;
|
|
134
175
|
presence_penalty?: number;
|
|
176
|
+
frequency_penalty?: number;
|
|
135
177
|
promptPrefix?: string;
|
|
136
178
|
temperature?: number;
|
|
137
179
|
top_p?: number;
|
|
@@ -142,6 +184,15 @@ export type TPreset = {
|
|
|
142
184
|
jailbreakPresetId?: string;
|
|
143
185
|
presetSignature?: string;
|
|
144
186
|
toneStyle?: string;
|
|
187
|
+
// plugins only
|
|
188
|
+
agentOptions?: TAgentOptions;
|
|
189
|
+
// google only
|
|
190
|
+
examples?: TExample[];
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export type TOptionSettings = {
|
|
194
|
+
showExamples?: boolean;
|
|
195
|
+
isCodeChat?: boolean;
|
|
145
196
|
};
|
|
146
197
|
|
|
147
198
|
export type TUser = {
|
|
@@ -196,15 +247,30 @@ export type TSearchResults = {
|
|
|
196
247
|
filter: object;
|
|
197
248
|
};
|
|
198
249
|
|
|
199
|
-
export type
|
|
200
|
-
azureOpenAI:
|
|
201
|
-
bingAI: boolean;
|
|
202
|
-
ChatGptBrowser: {
|
|
250
|
+
export type TEndpointsConfig = {
|
|
251
|
+
azureOpenAI: {
|
|
203
252
|
availableModels: [];
|
|
204
|
-
};
|
|
205
|
-
|
|
253
|
+
} | null;
|
|
254
|
+
bingAI: {
|
|
206
255
|
availableModels: [];
|
|
207
|
-
};
|
|
256
|
+
} | null;
|
|
257
|
+
chatGPTBrowser: {
|
|
258
|
+
availableModels: [];
|
|
259
|
+
} | null;
|
|
260
|
+
anthropic: {
|
|
261
|
+
availableModels: [];
|
|
262
|
+
} | null;
|
|
263
|
+
google: {
|
|
264
|
+
availableModels: [];
|
|
265
|
+
} | null;
|
|
266
|
+
openAI: {
|
|
267
|
+
availableModels: [];
|
|
268
|
+
} | null;
|
|
269
|
+
gptPlugins: {
|
|
270
|
+
availableModels: [];
|
|
271
|
+
availableTools?: [];
|
|
272
|
+
plugins?: [];
|
|
273
|
+
} | null;
|
|
208
274
|
};
|
|
209
275
|
|
|
210
276
|
export type TUpdateTokenCountResponse = {
|
|
@@ -257,6 +323,7 @@ export type TStartupConfig = {
|
|
|
257
323
|
serverDomain: string;
|
|
258
324
|
registrationEnabled: boolean;
|
|
259
325
|
socialLoginEnabled: boolean;
|
|
326
|
+
emailEnabled: boolean;
|
|
260
327
|
};
|
|
261
328
|
|
|
262
329
|
export type TRefreshTokenResponse = {
|
|
@@ -265,7 +332,8 @@ export type TRefreshTokenResponse = {
|
|
|
265
332
|
};
|
|
266
333
|
|
|
267
334
|
export type TRequestPasswordResetResponse = {
|
|
268
|
-
link
|
|
335
|
+
link?: string;
|
|
336
|
+
message?: string;
|
|
269
337
|
};
|
|
270
338
|
|
|
271
339
|
export type File = {
|
|
@@ -273,3 +341,129 @@ export type File = {
|
|
|
273
341
|
date: number;
|
|
274
342
|
size: number;
|
|
275
343
|
};
|
|
344
|
+
|
|
345
|
+
export type SetOption = (param: number | string) => (newValue: number | string | boolean) => void;
|
|
346
|
+
export type SetExample = (
|
|
347
|
+
i: number,
|
|
348
|
+
type: string,
|
|
349
|
+
newValue: number | string | boolean | null,
|
|
350
|
+
) => void;
|
|
351
|
+
|
|
352
|
+
export enum Side {
|
|
353
|
+
Top = 'top',
|
|
354
|
+
Right = 'right',
|
|
355
|
+
Bottom = 'bottom',
|
|
356
|
+
Left = 'left',
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export type OptionHoverProps = {
|
|
360
|
+
endpoint: string;
|
|
361
|
+
type: string;
|
|
362
|
+
side: Side;
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
export type BaseProps = {
|
|
366
|
+
conversation: TConversation | TPreset | null;
|
|
367
|
+
className?: string;
|
|
368
|
+
isPreset?: boolean;
|
|
369
|
+
readonly?: boolean;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export type SettingsProps = BaseProps & {
|
|
373
|
+
setOption: SetOption;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export type TModels = {
|
|
377
|
+
models: string[];
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
export type ModelSelectProps = SettingsProps & TModels;
|
|
381
|
+
|
|
382
|
+
export type ExamplesProps = {
|
|
383
|
+
readonly?: boolean;
|
|
384
|
+
className?: string;
|
|
385
|
+
examples: TExample[];
|
|
386
|
+
setExample: SetExample;
|
|
387
|
+
addExample: () => void;
|
|
388
|
+
removeExample: () => void;
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export type GoogleProps = {
|
|
392
|
+
showExamples: boolean;
|
|
393
|
+
isCodeChat: boolean;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
export type GoogleViewProps = SettingsProps & GoogleProps;
|
|
397
|
+
export type OptionComponent = React.FC<ModelSelectProps>;
|
|
398
|
+
export type MultiViewComponent = React.FC<BaseProps & TModels>;
|
|
399
|
+
|
|
400
|
+
export type SelectProps = {
|
|
401
|
+
conversation: TConversation | null;
|
|
402
|
+
setOption: SetOption;
|
|
403
|
+
extraProps?: GoogleProps;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
export type SetOptionsPayload = {
|
|
407
|
+
setOption: SetOption;
|
|
408
|
+
setExample: SetExample;
|
|
409
|
+
addExample: () => void;
|
|
410
|
+
removeExample: () => void;
|
|
411
|
+
setAgentOption: SetOption;
|
|
412
|
+
getConversation: () => TConversation | TPreset | null;
|
|
413
|
+
checkPluginSelection: (value: string) => boolean;
|
|
414
|
+
setTools: (newValue: string) => void;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
export type UseSetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload;
|
|
418
|
+
export type UsePresetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload | boolean;
|
|
419
|
+
|
|
420
|
+
export type PopoverButton = {
|
|
421
|
+
label: string;
|
|
422
|
+
buttonClass: string;
|
|
423
|
+
handler: () => void;
|
|
424
|
+
icon: React.ReactNode;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
export type EndpointOptionsPopoverProps = {
|
|
428
|
+
children: React.ReactNode;
|
|
429
|
+
visible: boolean;
|
|
430
|
+
endpoint: EModelEndpoint;
|
|
431
|
+
saveAsPreset: () => void;
|
|
432
|
+
closePopover: () => void;
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
export type EditPresetProps = {
|
|
436
|
+
open: boolean;
|
|
437
|
+
onOpenChange: React.Dispatch<React.SetStateAction<boolean>>;
|
|
438
|
+
preset: TPreset;
|
|
439
|
+
title?: string;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
export type MultiSelectDropDownProps = {
|
|
443
|
+
title?: string;
|
|
444
|
+
value: Array<{ icon?: string; name?: string; isButton?: boolean }>;
|
|
445
|
+
disabled?: boolean;
|
|
446
|
+
setSelected: (option: string) => void;
|
|
447
|
+
availableValues: TPlugin[];
|
|
448
|
+
showAbove?: boolean;
|
|
449
|
+
showLabel?: boolean;
|
|
450
|
+
containerClassName?: string;
|
|
451
|
+
isSelected: (value: string) => boolean;
|
|
452
|
+
className?: string;
|
|
453
|
+
optionValueKey?: string;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
export type TError = {
|
|
457
|
+
message: string;
|
|
458
|
+
code?: number;
|
|
459
|
+
response?: {
|
|
460
|
+
data?: {
|
|
461
|
+
message?: string;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
export type CleanupPreset = {
|
|
467
|
+
preset: Partial<TPreset>;
|
|
468
|
+
endpointsConfig?: TEndpointsConfig | Record<string, unknown>;
|
|
469
|
+
};
|
package/types/createPayload.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { TSubmission, EModelEndpoint } from './types';
|
|
|
2
2
|
export default function createPayload(submission: TSubmission): {
|
|
3
3
|
server: string;
|
|
4
4
|
payload: {
|
|
5
|
-
conversationId: string;
|
|
6
|
-
endpoint: EModelEndpoint;
|
|
5
|
+
conversationId: string | null;
|
|
6
|
+
endpoint: EModelEndpoint | null;
|
|
7
7
|
model?: string | undefined;
|
|
8
8
|
promptPrefix?: string | undefined;
|
|
9
9
|
temperature?: number | undefined;
|
|
@@ -27,13 +27,15 @@ export declare const useDeleteConversationMutation: (id?: string) => UseMutation
|
|
|
27
27
|
export declare const useClearConversationsMutation: () => UseMutationResult<unknown>;
|
|
28
28
|
export declare const useGetConversationsQuery: (pageNumber: string, config?: UseQueryOptions<t.TGetConversationsResponse>) => QueryObserverResult<t.TGetConversationsResponse>;
|
|
29
29
|
export declare const useGetSearchEnabledQuery: (config?: UseQueryOptions<boolean>) => QueryObserverResult<boolean>;
|
|
30
|
-
export declare const useGetEndpointsQuery: () => QueryObserverResult<t.
|
|
30
|
+
export declare const useGetEndpointsQuery: () => QueryObserverResult<t.TEndpointsConfig>;
|
|
31
31
|
export declare const useCreatePresetMutation: () => UseMutationResult<t.TPreset[], unknown, t.TPreset, unknown>;
|
|
32
32
|
export declare const useUpdatePresetMutation: () => UseMutationResult<t.TPreset[], unknown, t.TPreset, unknown>;
|
|
33
33
|
export declare const useGetPresetsQuery: (config?: UseQueryOptions<t.TPreset[]>) => QueryObserverResult<t.TPreset[], unknown>;
|
|
34
34
|
export declare const useDeletePresetMutation: () => UseMutationResult<t.TPreset[], unknown, t.TPreset | object, unknown>;
|
|
35
35
|
export declare const useSearchQuery: (searchQuery: string, pageNumber: string, config?: UseQueryOptions<t.TSearchResults>) => QueryObserverResult<t.TSearchResults>;
|
|
36
|
-
export declare const useUpdateTokenCountMutation: () => UseMutationResult<t.TUpdateTokenCountResponse, unknown,
|
|
36
|
+
export declare const useUpdateTokenCountMutation: () => UseMutationResult<t.TUpdateTokenCountResponse, unknown, {
|
|
37
|
+
text: string;
|
|
38
|
+
}, unknown>;
|
|
37
39
|
export declare const useLoginUserMutation: () => UseMutationResult<t.TLoginResponse, unknown, t.TLoginUser, unknown>;
|
|
38
40
|
export declare const useRegisterUserMutation: () => UseMutationResult<unknown, unknown, t.TRegisterUser, unknown>;
|
|
39
41
|
export declare const useLogoutUserMutation: () => UseMutationResult<unknown>;
|
package/types/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
export type TMessage = {
|
|
2
3
|
messageId: string;
|
|
3
4
|
conversationId: string;
|
|
@@ -10,9 +11,15 @@ export type TMessage = {
|
|
|
10
11
|
createdAt: string;
|
|
11
12
|
updatedAt: string;
|
|
12
13
|
};
|
|
14
|
+
export type TMessages = TMessage[];
|
|
15
|
+
export type TMessagesAtom = TMessages | null;
|
|
13
16
|
export type TExample = {
|
|
14
|
-
input:
|
|
15
|
-
|
|
17
|
+
input: {
|
|
18
|
+
content: string;
|
|
19
|
+
};
|
|
20
|
+
output: {
|
|
21
|
+
content: string;
|
|
22
|
+
};
|
|
16
23
|
};
|
|
17
24
|
export declare enum EModelEndpoint {
|
|
18
25
|
azureOpenAI = "azureOpenAI",
|
|
@@ -30,7 +37,7 @@ export type TSubmission = {
|
|
|
30
37
|
conversationId?: string;
|
|
31
38
|
conversationSignature?: string;
|
|
32
39
|
current: boolean;
|
|
33
|
-
endpoint: EModelEndpoint;
|
|
40
|
+
endpoint: EModelEndpoint | null;
|
|
34
41
|
invocationId: number;
|
|
35
42
|
isCreatedByUser: boolean;
|
|
36
43
|
jailbreak: boolean;
|
|
@@ -53,7 +60,7 @@ export type TSubmission = {
|
|
|
53
60
|
endpointOption: TEndpointOption;
|
|
54
61
|
};
|
|
55
62
|
export type TEndpointOption = {
|
|
56
|
-
endpoint: EModelEndpoint;
|
|
63
|
+
endpoint: EModelEndpoint | null;
|
|
57
64
|
model?: string;
|
|
58
65
|
promptPrefix?: string;
|
|
59
66
|
temperature?: number;
|
|
@@ -70,22 +77,38 @@ export type TPlugin = {
|
|
|
70
77
|
icon: string;
|
|
71
78
|
authConfig: TPluginAuthConfig[];
|
|
72
79
|
authenticated: boolean;
|
|
80
|
+
isButton?: boolean;
|
|
81
|
+
};
|
|
82
|
+
export type TPluginAction = {
|
|
83
|
+
pluginKey: string;
|
|
84
|
+
action: 'install' | 'uninstall';
|
|
85
|
+
auth?: unknown;
|
|
86
|
+
};
|
|
87
|
+
export type TTemplate = {
|
|
88
|
+
[key: string]: TPlugin;
|
|
73
89
|
};
|
|
74
90
|
export type TUpdateUserPlugins = {
|
|
75
91
|
pluginKey: string;
|
|
76
92
|
action: string;
|
|
77
93
|
auth?: unknown;
|
|
78
94
|
};
|
|
95
|
+
export type TAgentOptions = {
|
|
96
|
+
agent: string;
|
|
97
|
+
skipCompletion: boolean;
|
|
98
|
+
model: string;
|
|
99
|
+
temperature: number;
|
|
100
|
+
};
|
|
79
101
|
export type TConversation = {
|
|
80
|
-
conversationId: string;
|
|
102
|
+
conversationId: string | null;
|
|
81
103
|
title: string;
|
|
82
104
|
user?: string;
|
|
83
|
-
endpoint: EModelEndpoint;
|
|
105
|
+
endpoint: EModelEndpoint | null;
|
|
84
106
|
suggestions?: string[];
|
|
85
107
|
messages?: TMessage[];
|
|
86
108
|
tools?: TPlugin[];
|
|
87
109
|
createdAt: string;
|
|
88
110
|
updatedAt: string;
|
|
111
|
+
systemMessage?: string;
|
|
89
112
|
modelLabel?: string;
|
|
90
113
|
examples?: TExample[];
|
|
91
114
|
chatGptLabel?: string;
|
|
@@ -97,6 +120,7 @@ export type TConversation = {
|
|
|
97
120
|
topK?: number;
|
|
98
121
|
context?: string;
|
|
99
122
|
top_p?: number;
|
|
123
|
+
frequency_penalty?: number;
|
|
100
124
|
presence_penalty?: number;
|
|
101
125
|
jailbreak?: boolean;
|
|
102
126
|
jailbreakConversationId?: string;
|
|
@@ -105,19 +129,30 @@ export type TConversation = {
|
|
|
105
129
|
clientId?: string;
|
|
106
130
|
invocationId?: string;
|
|
107
131
|
toneStyle?: string;
|
|
132
|
+
maxOutputTokens?: number;
|
|
133
|
+
agentOptions?: TAgentOptions;
|
|
108
134
|
};
|
|
109
135
|
export type TPreset = {
|
|
110
136
|
title: string;
|
|
111
|
-
|
|
137
|
+
conversationId?: string;
|
|
138
|
+
endpoint: EModelEndpoint | null;
|
|
112
139
|
conversationSignature?: string;
|
|
113
140
|
createdAt?: string;
|
|
114
141
|
updatedAt?: string;
|
|
115
142
|
presetId?: string;
|
|
143
|
+
tools?: TPlugin[];
|
|
116
144
|
user?: string;
|
|
145
|
+
modelLabel?: string;
|
|
146
|
+
maxOutputTokens?: number;
|
|
147
|
+
topP?: number;
|
|
148
|
+
topK?: number;
|
|
149
|
+
context?: string;
|
|
150
|
+
systemMessage?: string;
|
|
117
151
|
chatGptLabel?: string;
|
|
118
152
|
frequence_penalty?: number;
|
|
119
153
|
model?: string;
|
|
120
154
|
presence_penalty?: number;
|
|
155
|
+
frequency_penalty?: number;
|
|
121
156
|
promptPrefix?: string;
|
|
122
157
|
temperature?: number;
|
|
123
158
|
top_p?: number;
|
|
@@ -127,6 +162,12 @@ export type TPreset = {
|
|
|
127
162
|
jailbreakPresetId?: string;
|
|
128
163
|
presetSignature?: string;
|
|
129
164
|
toneStyle?: string;
|
|
165
|
+
agentOptions?: TAgentOptions;
|
|
166
|
+
examples?: TExample[];
|
|
167
|
+
};
|
|
168
|
+
export type TOptionSettings = {
|
|
169
|
+
showExamples?: boolean;
|
|
170
|
+
isCodeChat?: boolean;
|
|
130
171
|
};
|
|
131
172
|
export type TUser = {
|
|
132
173
|
id: string;
|
|
@@ -173,15 +214,30 @@ export type TSearchResults = {
|
|
|
173
214
|
pages: string | number;
|
|
174
215
|
filter: object;
|
|
175
216
|
};
|
|
176
|
-
export type
|
|
177
|
-
azureOpenAI:
|
|
178
|
-
bingAI: boolean;
|
|
179
|
-
ChatGptBrowser: {
|
|
217
|
+
export type TEndpointsConfig = {
|
|
218
|
+
azureOpenAI: {
|
|
180
219
|
availableModels: [];
|
|
181
|
-
};
|
|
182
|
-
|
|
220
|
+
} | null;
|
|
221
|
+
bingAI: {
|
|
183
222
|
availableModels: [];
|
|
184
|
-
};
|
|
223
|
+
} | null;
|
|
224
|
+
chatGPTBrowser: {
|
|
225
|
+
availableModels: [];
|
|
226
|
+
} | null;
|
|
227
|
+
anthropic: {
|
|
228
|
+
availableModels: [];
|
|
229
|
+
} | null;
|
|
230
|
+
google: {
|
|
231
|
+
availableModels: [];
|
|
232
|
+
} | null;
|
|
233
|
+
openAI: {
|
|
234
|
+
availableModels: [];
|
|
235
|
+
} | null;
|
|
236
|
+
gptPlugins: {
|
|
237
|
+
availableModels: [];
|
|
238
|
+
availableTools?: [];
|
|
239
|
+
plugins?: [];
|
|
240
|
+
} | null;
|
|
185
241
|
};
|
|
186
242
|
export type TUpdateTokenCountResponse = {
|
|
187
243
|
count: number;
|
|
@@ -224,16 +280,125 @@ export type TStartupConfig = {
|
|
|
224
280
|
serverDomain: string;
|
|
225
281
|
registrationEnabled: boolean;
|
|
226
282
|
socialLoginEnabled: boolean;
|
|
283
|
+
emailEnabled: boolean;
|
|
227
284
|
};
|
|
228
285
|
export type TRefreshTokenResponse = {
|
|
229
286
|
token: string;
|
|
230
287
|
user: TUser;
|
|
231
288
|
};
|
|
232
289
|
export type TRequestPasswordResetResponse = {
|
|
233
|
-
link
|
|
290
|
+
link?: string;
|
|
291
|
+
message?: string;
|
|
234
292
|
};
|
|
235
293
|
export type File = {
|
|
236
294
|
name: string;
|
|
237
295
|
date: number;
|
|
238
296
|
size: number;
|
|
239
297
|
};
|
|
298
|
+
export type SetOption = (param: number | string) => (newValue: number | string | boolean) => void;
|
|
299
|
+
export type SetExample = (i: number, type: string, newValue: number | string | boolean | null) => void;
|
|
300
|
+
export declare enum Side {
|
|
301
|
+
Top = "top",
|
|
302
|
+
Right = "right",
|
|
303
|
+
Bottom = "bottom",
|
|
304
|
+
Left = "left"
|
|
305
|
+
}
|
|
306
|
+
export type OptionHoverProps = {
|
|
307
|
+
endpoint: string;
|
|
308
|
+
type: string;
|
|
309
|
+
side: Side;
|
|
310
|
+
};
|
|
311
|
+
export type BaseProps = {
|
|
312
|
+
conversation: TConversation | TPreset | null;
|
|
313
|
+
className?: string;
|
|
314
|
+
isPreset?: boolean;
|
|
315
|
+
readonly?: boolean;
|
|
316
|
+
};
|
|
317
|
+
export type SettingsProps = BaseProps & {
|
|
318
|
+
setOption: SetOption;
|
|
319
|
+
};
|
|
320
|
+
export type TModels = {
|
|
321
|
+
models: string[];
|
|
322
|
+
};
|
|
323
|
+
export type ModelSelectProps = SettingsProps & TModels;
|
|
324
|
+
export type ExamplesProps = {
|
|
325
|
+
readonly?: boolean;
|
|
326
|
+
className?: string;
|
|
327
|
+
examples: TExample[];
|
|
328
|
+
setExample: SetExample;
|
|
329
|
+
addExample: () => void;
|
|
330
|
+
removeExample: () => void;
|
|
331
|
+
};
|
|
332
|
+
export type GoogleProps = {
|
|
333
|
+
showExamples: boolean;
|
|
334
|
+
isCodeChat: boolean;
|
|
335
|
+
};
|
|
336
|
+
export type GoogleViewProps = SettingsProps & GoogleProps;
|
|
337
|
+
export type OptionComponent = React.FC<ModelSelectProps>;
|
|
338
|
+
export type MultiViewComponent = React.FC<BaseProps & TModels>;
|
|
339
|
+
export type SelectProps = {
|
|
340
|
+
conversation: TConversation | null;
|
|
341
|
+
setOption: SetOption;
|
|
342
|
+
extraProps?: GoogleProps;
|
|
343
|
+
};
|
|
344
|
+
export type SetOptionsPayload = {
|
|
345
|
+
setOption: SetOption;
|
|
346
|
+
setExample: SetExample;
|
|
347
|
+
addExample: () => void;
|
|
348
|
+
removeExample: () => void;
|
|
349
|
+
setAgentOption: SetOption;
|
|
350
|
+
getConversation: () => TConversation | TPreset | null;
|
|
351
|
+
checkPluginSelection: (value: string) => boolean;
|
|
352
|
+
setTools: (newValue: string) => void;
|
|
353
|
+
};
|
|
354
|
+
export type UseSetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload;
|
|
355
|
+
export type UsePresetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload | boolean;
|
|
356
|
+
export type PopoverButton = {
|
|
357
|
+
label: string;
|
|
358
|
+
buttonClass: string;
|
|
359
|
+
handler: () => void;
|
|
360
|
+
icon: React.ReactNode;
|
|
361
|
+
};
|
|
362
|
+
export type EndpointOptionsPopoverProps = {
|
|
363
|
+
children: React.ReactNode;
|
|
364
|
+
visible: boolean;
|
|
365
|
+
endpoint: EModelEndpoint;
|
|
366
|
+
saveAsPreset: () => void;
|
|
367
|
+
closePopover: () => void;
|
|
368
|
+
};
|
|
369
|
+
export type EditPresetProps = {
|
|
370
|
+
open: boolean;
|
|
371
|
+
onOpenChange: React.Dispatch<React.SetStateAction<boolean>>;
|
|
372
|
+
preset: TPreset;
|
|
373
|
+
title?: string;
|
|
374
|
+
};
|
|
375
|
+
export type MultiSelectDropDownProps = {
|
|
376
|
+
title?: string;
|
|
377
|
+
value: Array<{
|
|
378
|
+
icon?: string;
|
|
379
|
+
name?: string;
|
|
380
|
+
isButton?: boolean;
|
|
381
|
+
}>;
|
|
382
|
+
disabled?: boolean;
|
|
383
|
+
setSelected: (option: string) => void;
|
|
384
|
+
availableValues: TPlugin[];
|
|
385
|
+
showAbove?: boolean;
|
|
386
|
+
showLabel?: boolean;
|
|
387
|
+
containerClassName?: string;
|
|
388
|
+
isSelected: (value: string) => boolean;
|
|
389
|
+
className?: string;
|
|
390
|
+
optionValueKey?: string;
|
|
391
|
+
};
|
|
392
|
+
export type TError = {
|
|
393
|
+
message: string;
|
|
394
|
+
code?: number;
|
|
395
|
+
response?: {
|
|
396
|
+
data?: {
|
|
397
|
+
message?: string;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
};
|
|
401
|
+
export type CleanupPreset = {
|
|
402
|
+
preset: Partial<TPreset>;
|
|
403
|
+
endpointsConfig?: TEndpointsConfig | Record<string, unknown>;
|
|
404
|
+
};
|