librechat-data-provider 0.1.2 → 0.1.4
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 +103 -4
- package/dist/index.js +110 -3
- package/package.json +4 -2
- package/src/createPayload.ts +3 -2
- package/src/data-service.ts +8 -7
- package/src/react-query-service.ts +26 -25
- package/src/schemas.ts +121 -0
- package/src/types.ts +176 -105
- package/types/createPayload.d.ts +7 -7
- package/types/data-service.d.ts +8 -7
- package/types/react-query-service.d.ts +13 -10
- package/types/schemas.d.ts +625 -0
- package/types/types.d.ts +155 -98
package/types/types.d.ts
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sender: string;
|
|
7
|
-
text: string;
|
|
8
|
-
isCreatedByUser: boolean;
|
|
9
|
-
error: boolean;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
updatedAt: string;
|
|
12
|
-
};
|
|
13
|
-
export type TExample = {
|
|
14
|
-
input: string;
|
|
15
|
-
output: string;
|
|
16
|
-
};
|
|
17
|
-
export declare enum EModelEndpoint {
|
|
18
|
-
azureOpenAI = "azureOpenAI",
|
|
19
|
-
openAI = "openAI",
|
|
20
|
-
bingAI = "bingAI",
|
|
21
|
-
chatGPT = "chatGPT",
|
|
22
|
-
chatGPTBrowser = "chatGPTBrowser",
|
|
23
|
-
google = "google",
|
|
24
|
-
gptPlugins = "gptPlugins",
|
|
25
|
-
anthropic = "anthropic"
|
|
26
|
-
}
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TExample, TMessage, EModelEndpoint, TPlugin, TConversation, TPreset } from './schemas';
|
|
3
|
+
export * from './schemas';
|
|
4
|
+
export type TMessages = TMessage[];
|
|
5
|
+
export type TMessagesAtom = TMessages | null;
|
|
27
6
|
export type TSubmission = {
|
|
28
7
|
clientId?: string;
|
|
29
8
|
context?: string;
|
|
30
9
|
conversationId?: string;
|
|
31
10
|
conversationSignature?: string;
|
|
32
11
|
current: boolean;
|
|
33
|
-
endpoint: EModelEndpoint;
|
|
12
|
+
endpoint: EModelEndpoint | null;
|
|
34
13
|
invocationId: number;
|
|
35
14
|
isCreatedByUser: boolean;
|
|
36
15
|
jailbreak: boolean;
|
|
@@ -53,80 +32,27 @@ export type TSubmission = {
|
|
|
53
32
|
endpointOption: TEndpointOption;
|
|
54
33
|
};
|
|
55
34
|
export type TEndpointOption = {
|
|
56
|
-
endpoint: EModelEndpoint;
|
|
35
|
+
endpoint: EModelEndpoint | null;
|
|
57
36
|
model?: string;
|
|
58
37
|
promptPrefix?: string;
|
|
59
38
|
temperature?: number;
|
|
60
39
|
};
|
|
61
|
-
export type
|
|
62
|
-
authField: string;
|
|
63
|
-
label: string;
|
|
64
|
-
description: string;
|
|
65
|
-
};
|
|
66
|
-
export type TPlugin = {
|
|
67
|
-
name: string;
|
|
40
|
+
export type TPluginAction = {
|
|
68
41
|
pluginKey: string;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
action: 'install' | 'uninstall';
|
|
43
|
+
auth?: unknown;
|
|
44
|
+
};
|
|
45
|
+
export type TTemplate = {
|
|
46
|
+
[key: string]: TPlugin;
|
|
73
47
|
};
|
|
74
48
|
export type TUpdateUserPlugins = {
|
|
75
49
|
pluginKey: string;
|
|
76
50
|
action: string;
|
|
77
51
|
auth?: unknown;
|
|
78
52
|
};
|
|
79
|
-
export type
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
user?: string;
|
|
83
|
-
endpoint: EModelEndpoint;
|
|
84
|
-
suggestions?: string[];
|
|
85
|
-
messages?: TMessage[];
|
|
86
|
-
tools?: TPlugin[];
|
|
87
|
-
createdAt: string;
|
|
88
|
-
updatedAt: string;
|
|
89
|
-
modelLabel?: string;
|
|
90
|
-
examples?: TExample[];
|
|
91
|
-
chatGptLabel?: string;
|
|
92
|
-
userLabel?: string;
|
|
93
|
-
model?: string;
|
|
94
|
-
promptPrefix?: string;
|
|
95
|
-
temperature?: number;
|
|
96
|
-
topP?: number;
|
|
97
|
-
topK?: number;
|
|
98
|
-
context?: string;
|
|
99
|
-
top_p?: number;
|
|
100
|
-
presence_penalty?: number;
|
|
101
|
-
jailbreak?: boolean;
|
|
102
|
-
jailbreakConversationId?: string;
|
|
103
|
-
conversationSignature?: string;
|
|
104
|
-
parentMessageId?: string;
|
|
105
|
-
clientId?: string;
|
|
106
|
-
invocationId?: string;
|
|
107
|
-
toneStyle?: string;
|
|
108
|
-
};
|
|
109
|
-
export type TPreset = {
|
|
110
|
-
title: string;
|
|
111
|
-
endpoint: EModelEndpoint;
|
|
112
|
-
conversationSignature?: string;
|
|
113
|
-
createdAt?: string;
|
|
114
|
-
updatedAt?: string;
|
|
115
|
-
presetId?: string;
|
|
116
|
-
user?: string;
|
|
117
|
-
chatGptLabel?: string;
|
|
118
|
-
frequence_penalty?: number;
|
|
119
|
-
model?: string;
|
|
120
|
-
presence_penalty?: number;
|
|
121
|
-
promptPrefix?: string;
|
|
122
|
-
temperature?: number;
|
|
123
|
-
top_p?: number;
|
|
124
|
-
clientId?: string;
|
|
125
|
-
invocationId?: number;
|
|
126
|
-
jailbreak?: boolean;
|
|
127
|
-
jailbreakPresetId?: string;
|
|
128
|
-
presetSignature?: string;
|
|
129
|
-
toneStyle?: string;
|
|
53
|
+
export type TOptionSettings = {
|
|
54
|
+
showExamples?: boolean;
|
|
55
|
+
isCodeChat?: boolean;
|
|
130
56
|
};
|
|
131
57
|
export type TUser = {
|
|
132
58
|
id: string;
|
|
@@ -173,15 +99,30 @@ export type TSearchResults = {
|
|
|
173
99
|
pages: string | number;
|
|
174
100
|
filter: object;
|
|
175
101
|
};
|
|
176
|
-
export type
|
|
177
|
-
azureOpenAI:
|
|
178
|
-
bingAI: boolean;
|
|
179
|
-
ChatGptBrowser: {
|
|
102
|
+
export type TEndpointsConfig = {
|
|
103
|
+
azureOpenAI: {
|
|
180
104
|
availableModels: [];
|
|
181
|
-
};
|
|
182
|
-
|
|
105
|
+
} | null;
|
|
106
|
+
bingAI: {
|
|
183
107
|
availableModels: [];
|
|
184
|
-
};
|
|
108
|
+
} | null;
|
|
109
|
+
chatGPTBrowser: {
|
|
110
|
+
availableModels: [];
|
|
111
|
+
} | null;
|
|
112
|
+
anthropic: {
|
|
113
|
+
availableModels: [];
|
|
114
|
+
} | null;
|
|
115
|
+
google: {
|
|
116
|
+
availableModels: [];
|
|
117
|
+
} | null;
|
|
118
|
+
openAI: {
|
|
119
|
+
availableModels: [];
|
|
120
|
+
} | null;
|
|
121
|
+
gptPlugins: {
|
|
122
|
+
availableModels: [];
|
|
123
|
+
availableTools?: [];
|
|
124
|
+
plugins?: [];
|
|
125
|
+
} | null;
|
|
185
126
|
};
|
|
186
127
|
export type TUpdateTokenCountResponse = {
|
|
187
128
|
count: number;
|
|
@@ -224,16 +165,132 @@ export type TStartupConfig = {
|
|
|
224
165
|
serverDomain: string;
|
|
225
166
|
registrationEnabled: boolean;
|
|
226
167
|
socialLoginEnabled: boolean;
|
|
168
|
+
emailEnabled: boolean;
|
|
227
169
|
};
|
|
228
170
|
export type TRefreshTokenResponse = {
|
|
229
171
|
token: string;
|
|
230
172
|
user: TUser;
|
|
231
173
|
};
|
|
232
174
|
export type TRequestPasswordResetResponse = {
|
|
233
|
-
link
|
|
175
|
+
link?: string;
|
|
176
|
+
message?: string;
|
|
234
177
|
};
|
|
235
178
|
export type File = {
|
|
236
179
|
name: string;
|
|
237
180
|
date: number;
|
|
238
181
|
size: number;
|
|
239
182
|
};
|
|
183
|
+
export type SetOption = (param: number | string) => (newValue: number | string | boolean) => void;
|
|
184
|
+
export type SetExample = (i: number, type: string, newValue: number | string | boolean | null) => void;
|
|
185
|
+
export declare enum Side {
|
|
186
|
+
Top = "top",
|
|
187
|
+
Right = "right",
|
|
188
|
+
Bottom = "bottom",
|
|
189
|
+
Left = "left"
|
|
190
|
+
}
|
|
191
|
+
export type OptionHoverProps = {
|
|
192
|
+
endpoint: string;
|
|
193
|
+
type: string;
|
|
194
|
+
side: Side;
|
|
195
|
+
};
|
|
196
|
+
export type BaseProps = {
|
|
197
|
+
conversation: TConversation | TPreset | null;
|
|
198
|
+
className?: string;
|
|
199
|
+
isPreset?: boolean;
|
|
200
|
+
readonly?: boolean;
|
|
201
|
+
};
|
|
202
|
+
export type SettingsProps = BaseProps & {
|
|
203
|
+
setOption: SetOption;
|
|
204
|
+
};
|
|
205
|
+
export type TModels = {
|
|
206
|
+
models: string[];
|
|
207
|
+
};
|
|
208
|
+
export type ModelSelectProps = SettingsProps & TModels;
|
|
209
|
+
export type ExamplesProps = {
|
|
210
|
+
readonly?: boolean;
|
|
211
|
+
className?: string;
|
|
212
|
+
examples: TExample[];
|
|
213
|
+
setExample: SetExample;
|
|
214
|
+
addExample: () => void;
|
|
215
|
+
removeExample: () => void;
|
|
216
|
+
};
|
|
217
|
+
export type GoogleProps = {
|
|
218
|
+
showExamples: boolean;
|
|
219
|
+
isCodeChat: boolean;
|
|
220
|
+
};
|
|
221
|
+
export type GoogleViewProps = SettingsProps & GoogleProps;
|
|
222
|
+
export type OptionComponent = React.FC<ModelSelectProps>;
|
|
223
|
+
export type MultiViewComponent = React.FC<BaseProps & TModels>;
|
|
224
|
+
export type SelectProps = {
|
|
225
|
+
conversation: TConversation | null;
|
|
226
|
+
setOption: SetOption;
|
|
227
|
+
extraProps?: GoogleProps;
|
|
228
|
+
};
|
|
229
|
+
export type SetOptionsPayload = {
|
|
230
|
+
setOption: SetOption;
|
|
231
|
+
setExample: SetExample;
|
|
232
|
+
addExample: () => void;
|
|
233
|
+
removeExample: () => void;
|
|
234
|
+
setAgentOption: SetOption;
|
|
235
|
+
getConversation: () => TConversation | TPreset | null;
|
|
236
|
+
checkPluginSelection: (value: string) => boolean;
|
|
237
|
+
setTools: (newValue: string) => void;
|
|
238
|
+
};
|
|
239
|
+
export type UseSetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload;
|
|
240
|
+
export type UsePresetOptions = (preset?: TPreset | boolean | null) => SetOptionsPayload | boolean;
|
|
241
|
+
export type PopoverButton = {
|
|
242
|
+
label: string;
|
|
243
|
+
buttonClass: string;
|
|
244
|
+
handler: () => void;
|
|
245
|
+
icon: React.ReactNode;
|
|
246
|
+
};
|
|
247
|
+
export type EndpointOptionsPopoverProps = {
|
|
248
|
+
children: React.ReactNode;
|
|
249
|
+
visible: boolean;
|
|
250
|
+
endpoint: EModelEndpoint;
|
|
251
|
+
saveAsPreset: () => void;
|
|
252
|
+
closePopover: () => void;
|
|
253
|
+
};
|
|
254
|
+
export type EditPresetProps = {
|
|
255
|
+
open: boolean;
|
|
256
|
+
onOpenChange: React.Dispatch<React.SetStateAction<boolean>>;
|
|
257
|
+
preset: TPreset;
|
|
258
|
+
title?: string;
|
|
259
|
+
};
|
|
260
|
+
export type MultiSelectDropDownProps = {
|
|
261
|
+
title?: string;
|
|
262
|
+
value: Array<{
|
|
263
|
+
icon?: string;
|
|
264
|
+
name?: string;
|
|
265
|
+
isButton?: boolean;
|
|
266
|
+
}>;
|
|
267
|
+
disabled?: boolean;
|
|
268
|
+
setSelected: (option: string) => void;
|
|
269
|
+
availableValues: TPlugin[];
|
|
270
|
+
showAbove?: boolean;
|
|
271
|
+
showLabel?: boolean;
|
|
272
|
+
containerClassName?: string;
|
|
273
|
+
isSelected: (value: string) => boolean;
|
|
274
|
+
className?: string;
|
|
275
|
+
optionValueKey?: string;
|
|
276
|
+
};
|
|
277
|
+
export type TError = {
|
|
278
|
+
message: string;
|
|
279
|
+
code?: number;
|
|
280
|
+
response?: {
|
|
281
|
+
data?: {
|
|
282
|
+
message?: string;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
export type CleanupPreset = {
|
|
287
|
+
preset: Partial<TPreset>;
|
|
288
|
+
endpointsConfig?: TEndpointsConfig | Record<string, unknown>;
|
|
289
|
+
};
|
|
290
|
+
export type PagesProps = {
|
|
291
|
+
pages: number;
|
|
292
|
+
pageNumber: number;
|
|
293
|
+
setPageNumber: (pageNumber: number) => void;
|
|
294
|
+
nextPage: () => Promise<void>;
|
|
295
|
+
previousPage: () => Promise<void>;
|
|
296
|
+
};
|