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/config.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import type { ZodError } from 'zod';
|
|
3
|
+
import type { TModelsConfig } from './types';
|
|
4
4
|
import { EModelEndpoint, eModelEndpointSchema } from './schemas';
|
|
5
|
+
import { specsConfigSchema, TSpecsConfig } from './models';
|
|
5
6
|
import { fileConfigSchema } from './file-config';
|
|
6
|
-
import { specsConfigSchema } from './models';
|
|
7
7
|
import { FileSources } from './types/files';
|
|
8
|
-
import {
|
|
8
|
+
import { MCPServersSchema } from './mcp';
|
|
9
9
|
|
|
10
10
|
export const defaultSocialLogins = ['google', 'facebook', 'openid', 'github', 'discord'];
|
|
11
11
|
|
|
12
12
|
export const defaultRetrievalModels = [
|
|
13
13
|
'gpt-4o',
|
|
14
|
+
'o1-preview-2024-09-12',
|
|
15
|
+
'o1-preview',
|
|
16
|
+
'o1-mini-2024-09-12',
|
|
17
|
+
'o1-mini',
|
|
18
|
+
'o3-mini',
|
|
19
|
+
'chatgpt-4o-latest',
|
|
14
20
|
'gpt-4o-2024-05-13',
|
|
21
|
+
'gpt-4o-2024-08-06',
|
|
15
22
|
'gpt-4o-mini',
|
|
16
23
|
'gpt-4o-mini-2024-07-18',
|
|
17
24
|
'gpt-4-turbo-preview',
|
|
@@ -25,6 +32,27 @@ export const defaultRetrievalModels = [
|
|
|
25
32
|
'gpt-4-1106',
|
|
26
33
|
];
|
|
27
34
|
|
|
35
|
+
export const excludedKeys = new Set([
|
|
36
|
+
'conversationId',
|
|
37
|
+
'title',
|
|
38
|
+
'iconURL',
|
|
39
|
+
'greeting',
|
|
40
|
+
'endpoint',
|
|
41
|
+
'endpointType',
|
|
42
|
+
'createdAt',
|
|
43
|
+
'updatedAt',
|
|
44
|
+
'expiredAt',
|
|
45
|
+
'messages',
|
|
46
|
+
'isArchived',
|
|
47
|
+
'tags',
|
|
48
|
+
'user',
|
|
49
|
+
'__v',
|
|
50
|
+
'_id',
|
|
51
|
+
'tools',
|
|
52
|
+
'model',
|
|
53
|
+
'files',
|
|
54
|
+
]);
|
|
55
|
+
|
|
28
56
|
export enum SettingsViews {
|
|
29
57
|
default = 'default',
|
|
30
58
|
advanced = 'advanced',
|
|
@@ -36,9 +64,8 @@ export const fileSourceSchema = z.nativeEnum(FileSources);
|
|
|
36
64
|
type SchemaShape<T> = T extends z.ZodObject<infer U> ? U : never;
|
|
37
65
|
|
|
38
66
|
// Helper type to determine the default value or undefined based on whether the field has a default
|
|
39
|
-
type DefaultValue<T> =
|
|
40
|
-
? ReturnType<T['_def']['defaultValue']>
|
|
41
|
-
: undefined;
|
|
67
|
+
type DefaultValue<T> =
|
|
68
|
+
T extends z.ZodDefault<z.ZodTypeAny> ? ReturnType<T['_def']['defaultValue']> : undefined;
|
|
42
69
|
|
|
43
70
|
// Extract default values or undefined from the schema shape
|
|
44
71
|
type ExtractDefaults<T> = {
|
|
@@ -108,10 +135,10 @@ export type TAzureModelMapSchema = {
|
|
|
108
135
|
group: string;
|
|
109
136
|
};
|
|
110
137
|
|
|
111
|
-
export type TAzureModelGroupMap = Record<string, TAzureModelMapSchema>;
|
|
138
|
+
export type TAzureModelGroupMap = Record<string, TAzureModelMapSchema | undefined>;
|
|
112
139
|
export type TAzureGroupMap = Record<
|
|
113
140
|
string,
|
|
114
|
-
TAzureBaseSchema & { models: Record<string, TAzureModelConfig> }
|
|
141
|
+
(TAzureBaseSchema & { models: Record<string, TAzureModelConfig | undefined> }) | undefined
|
|
115
142
|
>;
|
|
116
143
|
|
|
117
144
|
export type TValidatedAzureConfig = {
|
|
@@ -133,6 +160,16 @@ export enum Capabilities {
|
|
|
133
160
|
tools = 'tools',
|
|
134
161
|
}
|
|
135
162
|
|
|
163
|
+
export enum AgentCapabilities {
|
|
164
|
+
hide_sequential_outputs = 'hide_sequential_outputs',
|
|
165
|
+
end_after_tools = 'end_after_tools',
|
|
166
|
+
execute_code = 'execute_code',
|
|
167
|
+
file_search = 'file_search',
|
|
168
|
+
artifacts = 'artifacts',
|
|
169
|
+
actions = 'actions',
|
|
170
|
+
tools = 'tools',
|
|
171
|
+
}
|
|
172
|
+
|
|
136
173
|
export const defaultAssistantsVersion = {
|
|
137
174
|
[EModelEndpoint.assistants]: 2,
|
|
138
175
|
[EModelEndpoint.azureAssistants]: 1,
|
|
@@ -140,10 +177,19 @@ export const defaultAssistantsVersion = {
|
|
|
140
177
|
|
|
141
178
|
export const baseEndpointSchema = z.object({
|
|
142
179
|
streamRate: z.number().optional(),
|
|
180
|
+
baseURL: z.string().optional(),
|
|
181
|
+
titlePrompt: z.string().optional(),
|
|
182
|
+
titleModel: z.string().optional(),
|
|
143
183
|
});
|
|
144
184
|
|
|
145
185
|
export type TBaseEndpoint = z.infer<typeof baseEndpointSchema>;
|
|
146
186
|
|
|
187
|
+
export const bedrockEndpointSchema = baseEndpointSchema.merge(
|
|
188
|
+
z.object({
|
|
189
|
+
availableRegions: z.array(z.string()).optional(),
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
|
|
147
193
|
export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
148
194
|
z.object({
|
|
149
195
|
/* assistants specific */
|
|
@@ -167,7 +213,6 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
167
213
|
]),
|
|
168
214
|
/* general */
|
|
169
215
|
apiKey: z.string().optional(),
|
|
170
|
-
baseURL: z.string().optional(),
|
|
171
216
|
models: z
|
|
172
217
|
.object({
|
|
173
218
|
default: z.array(z.string()).min(1),
|
|
@@ -177,13 +222,32 @@ export const assistantEndpointSchema = baseEndpointSchema.merge(
|
|
|
177
222
|
.optional(),
|
|
178
223
|
titleConvo: z.boolean().optional(),
|
|
179
224
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
180
|
-
titleModel: z.string().optional(),
|
|
181
225
|
headers: z.record(z.any()).optional(),
|
|
182
226
|
}),
|
|
183
227
|
);
|
|
184
228
|
|
|
185
229
|
export type TAssistantEndpoint = z.infer<typeof assistantEndpointSchema>;
|
|
186
230
|
|
|
231
|
+
export const agentsEndpointSChema = baseEndpointSchema.merge(
|
|
232
|
+
z.object({
|
|
233
|
+
/* agents specific */
|
|
234
|
+
recursionLimit: z.number().optional(),
|
|
235
|
+
disableBuilder: z.boolean().optional(),
|
|
236
|
+
capabilities: z
|
|
237
|
+
.array(z.nativeEnum(AgentCapabilities))
|
|
238
|
+
.optional()
|
|
239
|
+
.default([
|
|
240
|
+
AgentCapabilities.execute_code,
|
|
241
|
+
AgentCapabilities.file_search,
|
|
242
|
+
AgentCapabilities.artifacts,
|
|
243
|
+
AgentCapabilities.actions,
|
|
244
|
+
AgentCapabilities.tools,
|
|
245
|
+
]),
|
|
246
|
+
}),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
export type TAgentsEndpoint = z.infer<typeof agentsEndpointSChema>;
|
|
250
|
+
|
|
187
251
|
export const endpointSchema = baseEndpointSchema.merge(
|
|
188
252
|
z.object({
|
|
189
253
|
name: z.string().refine((value) => !eModelEndpointSchema.safeParse(value).success, {
|
|
@@ -200,7 +264,6 @@ export const endpointSchema = baseEndpointSchema.merge(
|
|
|
200
264
|
}),
|
|
201
265
|
titleConvo: z.boolean().optional(),
|
|
202
266
|
titleMethod: z.union([z.literal('completion'), z.literal('functions')]).optional(),
|
|
203
|
-
titleModel: z.string().optional(),
|
|
204
267
|
summarize: z.boolean().optional(),
|
|
205
268
|
summaryModel: z.string().optional(),
|
|
206
269
|
forcePrompt: z.boolean().optional(),
|
|
@@ -282,7 +345,7 @@ const ttsLocalaiSchema = z.object({
|
|
|
282
345
|
const ttsSchema = z.object({
|
|
283
346
|
openai: ttsOpenaiSchema.optional(),
|
|
284
347
|
azureOpenAI: ttsAzureOpenAISchema.optional(),
|
|
285
|
-
|
|
348
|
+
elevenlabs: ttsElevenLabsSchema.optional(),
|
|
286
349
|
localai: ttsLocalaiSchema.optional(),
|
|
287
350
|
});
|
|
288
351
|
|
|
@@ -386,6 +449,91 @@ export enum EImageOutputType {
|
|
|
386
449
|
JPEG = 'jpeg',
|
|
387
450
|
}
|
|
388
451
|
|
|
452
|
+
const termsOfServiceSchema = z.object({
|
|
453
|
+
externalUrl: z.string().optional(),
|
|
454
|
+
openNewTab: z.boolean().optional(),
|
|
455
|
+
modalAcceptance: z.boolean().optional(),
|
|
456
|
+
modalTitle: z.string().optional(),
|
|
457
|
+
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
export type TTermsOfService = z.infer<typeof termsOfServiceSchema>;
|
|
461
|
+
|
|
462
|
+
export const intefaceSchema = z
|
|
463
|
+
.object({
|
|
464
|
+
privacyPolicy: z
|
|
465
|
+
.object({
|
|
466
|
+
externalUrl: z.string().optional(),
|
|
467
|
+
openNewTab: z.boolean().optional(),
|
|
468
|
+
})
|
|
469
|
+
.optional(),
|
|
470
|
+
termsOfService: termsOfServiceSchema.optional(),
|
|
471
|
+
customWelcome: z.string().optional(),
|
|
472
|
+
endpointsMenu: z.boolean().optional(),
|
|
473
|
+
modelSelect: z.boolean().optional(),
|
|
474
|
+
parameters: z.boolean().optional(),
|
|
475
|
+
sidePanel: z.boolean().optional(),
|
|
476
|
+
multiConvo: z.boolean().optional(),
|
|
477
|
+
bookmarks: z.boolean().optional(),
|
|
478
|
+
presets: z.boolean().optional(),
|
|
479
|
+
prompts: z.boolean().optional(),
|
|
480
|
+
agents: z.boolean().optional(),
|
|
481
|
+
temporaryChat: z.boolean().optional(),
|
|
482
|
+
runCode: z.boolean().optional(),
|
|
483
|
+
})
|
|
484
|
+
.default({
|
|
485
|
+
endpointsMenu: true,
|
|
486
|
+
modelSelect: true,
|
|
487
|
+
parameters: true,
|
|
488
|
+
sidePanel: true,
|
|
489
|
+
presets: true,
|
|
490
|
+
multiConvo: true,
|
|
491
|
+
bookmarks: true,
|
|
492
|
+
prompts: true,
|
|
493
|
+
agents: true,
|
|
494
|
+
temporaryChat: true,
|
|
495
|
+
runCode: true,
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
export type TInterfaceConfig = z.infer<typeof intefaceSchema>;
|
|
499
|
+
|
|
500
|
+
export type TStartupConfig = {
|
|
501
|
+
appTitle: string;
|
|
502
|
+
socialLogins?: string[];
|
|
503
|
+
interface?: TInterfaceConfig;
|
|
504
|
+
discordLoginEnabled: boolean;
|
|
505
|
+
facebookLoginEnabled: boolean;
|
|
506
|
+
githubLoginEnabled: boolean;
|
|
507
|
+
googleLoginEnabled: boolean;
|
|
508
|
+
openidLoginEnabled: boolean;
|
|
509
|
+
appleLoginEnabled: boolean;
|
|
510
|
+
openidLabel: string;
|
|
511
|
+
openidImageUrl: string;
|
|
512
|
+
/** LDAP Auth Configuration */
|
|
513
|
+
ldap?: {
|
|
514
|
+
/** LDAP enabled */
|
|
515
|
+
enabled: boolean;
|
|
516
|
+
/** Whether LDAP uses username vs. email */
|
|
517
|
+
username?: boolean;
|
|
518
|
+
};
|
|
519
|
+
serverDomain: string;
|
|
520
|
+
emailLoginEnabled: boolean;
|
|
521
|
+
registrationEnabled: boolean;
|
|
522
|
+
socialLoginEnabled: boolean;
|
|
523
|
+
passwordResetEnabled: boolean;
|
|
524
|
+
emailEnabled: boolean;
|
|
525
|
+
checkBalance: boolean;
|
|
526
|
+
showBirthdayIcon: boolean;
|
|
527
|
+
helpAndFaqURL: string;
|
|
528
|
+
customFooter?: string;
|
|
529
|
+
modelSpecs?: TSpecsConfig;
|
|
530
|
+
sharedLinksEnabled: boolean;
|
|
531
|
+
publicSharedLinksEnabled: boolean;
|
|
532
|
+
analyticsGtmId?: string;
|
|
533
|
+
instanceProjectId: string;
|
|
534
|
+
bundlerURL?: string;
|
|
535
|
+
};
|
|
536
|
+
|
|
389
537
|
export const configSchema = z.object({
|
|
390
538
|
version: z.string(),
|
|
391
539
|
cache: z.boolean().default(true),
|
|
@@ -393,34 +541,14 @@ export const configSchema = z.object({
|
|
|
393
541
|
imageOutputType: z.nativeEnum(EImageOutputType).default(EImageOutputType.PNG),
|
|
394
542
|
includedTools: z.array(z.string()).optional(),
|
|
395
543
|
filteredTools: z.array(z.string()).optional(),
|
|
396
|
-
|
|
544
|
+
mcpServers: MCPServersSchema.optional(),
|
|
545
|
+
interface: intefaceSchema,
|
|
546
|
+
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
547
|
+
actions: z
|
|
397
548
|
.object({
|
|
398
|
-
|
|
399
|
-
.object({
|
|
400
|
-
externalUrl: z.string().optional(),
|
|
401
|
-
openNewTab: z.boolean().optional(),
|
|
402
|
-
})
|
|
403
|
-
.optional(),
|
|
404
|
-
termsOfService: z
|
|
405
|
-
.object({
|
|
406
|
-
externalUrl: z.string().optional(),
|
|
407
|
-
openNewTab: z.boolean().optional(),
|
|
408
|
-
})
|
|
409
|
-
.optional(),
|
|
410
|
-
endpointsMenu: z.boolean().optional(),
|
|
411
|
-
modelSelect: z.boolean().optional(),
|
|
412
|
-
parameters: z.boolean().optional(),
|
|
413
|
-
sidePanel: z.boolean().optional(),
|
|
414
|
-
presets: z.boolean().optional(),
|
|
549
|
+
allowedDomains: z.array(z.string()).optional(),
|
|
415
550
|
})
|
|
416
|
-
.
|
|
417
|
-
endpointsMenu: true,
|
|
418
|
-
modelSelect: true,
|
|
419
|
-
parameters: true,
|
|
420
|
-
sidePanel: true,
|
|
421
|
-
presets: true,
|
|
422
|
-
}),
|
|
423
|
-
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
551
|
+
.optional(),
|
|
424
552
|
registration: z
|
|
425
553
|
.object({
|
|
426
554
|
socialLogins: z.array(z.string()).optional(),
|
|
@@ -447,7 +575,9 @@ export const configSchema = z.object({
|
|
|
447
575
|
[EModelEndpoint.azureOpenAI]: azureEndpointSchema.optional(),
|
|
448
576
|
[EModelEndpoint.azureAssistants]: assistantEndpointSchema.optional(),
|
|
449
577
|
[EModelEndpoint.assistants]: assistantEndpointSchema.optional(),
|
|
578
|
+
[EModelEndpoint.agents]: agentsEndpointSChema.optional(),
|
|
450
579
|
[EModelEndpoint.custom]: z.array(endpointSchema.partial()).optional(),
|
|
580
|
+
[EModelEndpoint.bedrock]: baseEndpointSchema.optional(),
|
|
451
581
|
})
|
|
452
582
|
.strict()
|
|
453
583
|
.refine((data) => Object.keys(data).length > 0, {
|
|
@@ -471,6 +601,7 @@ export enum KnownEndpoints {
|
|
|
471
601
|
apipie = 'apipie',
|
|
472
602
|
cohere = 'cohere',
|
|
473
603
|
fireworks = 'fireworks',
|
|
604
|
+
deepseek = 'deepseek',
|
|
474
605
|
groq = 'groq',
|
|
475
606
|
huggingface = 'huggingface',
|
|
476
607
|
mistral = 'mistral',
|
|
@@ -480,6 +611,8 @@ export enum KnownEndpoints {
|
|
|
480
611
|
perplexity = 'perplexity',
|
|
481
612
|
shuttleai = 'shuttleai',
|
|
482
613
|
'together.ai' = 'together.ai',
|
|
614
|
+
unify = 'unify',
|
|
615
|
+
xai = 'xai',
|
|
483
616
|
}
|
|
484
617
|
|
|
485
618
|
export enum FetchTokenConfig {
|
|
@@ -491,28 +624,37 @@ export const defaultEndpoints: EModelEndpoint[] = [
|
|
|
491
624
|
EModelEndpoint.assistants,
|
|
492
625
|
EModelEndpoint.azureAssistants,
|
|
493
626
|
EModelEndpoint.azureOpenAI,
|
|
494
|
-
EModelEndpoint.
|
|
627
|
+
EModelEndpoint.agents,
|
|
495
628
|
EModelEndpoint.chatGPTBrowser,
|
|
496
629
|
EModelEndpoint.gptPlugins,
|
|
497
630
|
EModelEndpoint.google,
|
|
498
631
|
EModelEndpoint.anthropic,
|
|
499
632
|
EModelEndpoint.custom,
|
|
633
|
+
EModelEndpoint.bedrock,
|
|
500
634
|
];
|
|
501
635
|
|
|
502
636
|
export const alternateName = {
|
|
503
637
|
[EModelEndpoint.openAI]: 'OpenAI',
|
|
504
638
|
[EModelEndpoint.assistants]: 'Assistants',
|
|
639
|
+
[EModelEndpoint.agents]: 'Agents',
|
|
505
640
|
[EModelEndpoint.azureAssistants]: 'Azure Assistants',
|
|
506
641
|
[EModelEndpoint.azureOpenAI]: 'Azure OpenAI',
|
|
507
|
-
[EModelEndpoint.bingAI]: 'Bing',
|
|
508
642
|
[EModelEndpoint.chatGPTBrowser]: 'ChatGPT',
|
|
509
643
|
[EModelEndpoint.gptPlugins]: 'Plugins',
|
|
510
644
|
[EModelEndpoint.google]: 'Google',
|
|
511
645
|
[EModelEndpoint.anthropic]: 'Anthropic',
|
|
512
646
|
[EModelEndpoint.custom]: 'Custom',
|
|
647
|
+
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
|
648
|
+
[KnownEndpoints.ollama]: 'Ollama',
|
|
649
|
+
[KnownEndpoints.deepseek]: 'DeepSeek',
|
|
650
|
+
[KnownEndpoints.xai]: 'xAI',
|
|
513
651
|
};
|
|
514
652
|
|
|
515
653
|
const sharedOpenAIModels = [
|
|
654
|
+
'gpt-4o-mini',
|
|
655
|
+
'gpt-4o',
|
|
656
|
+
'gpt-4.5-preview',
|
|
657
|
+
'gpt-4.5-preview-2025-02-27',
|
|
516
658
|
'gpt-3.5-turbo',
|
|
517
659
|
'gpt-3.5-turbo-0125',
|
|
518
660
|
'gpt-4-turbo',
|
|
@@ -530,44 +672,87 @@ const sharedOpenAIModels = [
|
|
|
530
672
|
'gpt-3.5-turbo-0613',
|
|
531
673
|
];
|
|
532
674
|
|
|
675
|
+
const sharedAnthropicModels = [
|
|
676
|
+
'claude-3-7-sonnet-latest',
|
|
677
|
+
'claude-3-7-sonnet-20250219',
|
|
678
|
+
'claude-3-5-haiku-20241022',
|
|
679
|
+
'claude-3-5-sonnet-20241022',
|
|
680
|
+
'claude-3-5-sonnet-20240620',
|
|
681
|
+
'claude-3-5-sonnet-latest',
|
|
682
|
+
'claude-3-opus-20240229',
|
|
683
|
+
'claude-3-sonnet-20240229',
|
|
684
|
+
'claude-3-haiku-20240307',
|
|
685
|
+
'claude-2.1',
|
|
686
|
+
'claude-2',
|
|
687
|
+
'claude-1.2',
|
|
688
|
+
'claude-1',
|
|
689
|
+
'claude-1-100k',
|
|
690
|
+
'claude-instant-1',
|
|
691
|
+
'claude-instant-1-100k',
|
|
692
|
+
];
|
|
693
|
+
|
|
694
|
+
export const bedrockModels = [
|
|
695
|
+
'anthropic.claude-3-5-sonnet-20241022-v2:0',
|
|
696
|
+
'anthropic.claude-3-5-sonnet-20240620-v1:0',
|
|
697
|
+
'anthropic.claude-3-5-haiku-20241022-v1:0',
|
|
698
|
+
'anthropic.claude-3-haiku-20240307-v1:0',
|
|
699
|
+
'anthropic.claude-3-opus-20240229-v1:0',
|
|
700
|
+
'anthropic.claude-3-sonnet-20240229-v1:0',
|
|
701
|
+
'anthropic.claude-v2',
|
|
702
|
+
'anthropic.claude-v2:1',
|
|
703
|
+
'anthropic.claude-instant-v1',
|
|
704
|
+
// 'cohere.command-text-v14', // no conversation history
|
|
705
|
+
// 'cohere.command-light-text-v14', // no conversation history
|
|
706
|
+
'cohere.command-r-v1:0',
|
|
707
|
+
'cohere.command-r-plus-v1:0',
|
|
708
|
+
'meta.llama2-13b-chat-v1',
|
|
709
|
+
'meta.llama2-70b-chat-v1',
|
|
710
|
+
'meta.llama3-8b-instruct-v1:0',
|
|
711
|
+
'meta.llama3-70b-instruct-v1:0',
|
|
712
|
+
'meta.llama3-1-8b-instruct-v1:0',
|
|
713
|
+
'meta.llama3-1-70b-instruct-v1:0',
|
|
714
|
+
'meta.llama3-1-405b-instruct-v1:0',
|
|
715
|
+
'mistral.mistral-7b-instruct-v0:2',
|
|
716
|
+
'mistral.mixtral-8x7b-instruct-v0:1',
|
|
717
|
+
'mistral.mistral-large-2402-v1:0',
|
|
718
|
+
'mistral.mistral-large-2407-v1:0',
|
|
719
|
+
'mistral.mistral-small-2402-v1:0',
|
|
720
|
+
'ai21.jamba-instruct-v1:0',
|
|
721
|
+
// 'ai21.j2-mid-v1', // no streaming
|
|
722
|
+
// 'ai21.j2-ultra-v1', no conversation history
|
|
723
|
+
'amazon.titan-text-lite-v1',
|
|
724
|
+
'amazon.titan-text-express-v1',
|
|
725
|
+
'amazon.titan-text-premier-v1:0',
|
|
726
|
+
];
|
|
727
|
+
|
|
533
728
|
export const defaultModels = {
|
|
534
729
|
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
|
|
535
|
-
[EModelEndpoint.assistants]: [
|
|
730
|
+
[EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],
|
|
731
|
+
[EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)
|
|
536
732
|
[EModelEndpoint.google]: [
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
'
|
|
540
|
-
'
|
|
541
|
-
'
|
|
542
|
-
'
|
|
543
|
-
|
|
544
|
-
'
|
|
545
|
-
'
|
|
546
|
-
'
|
|
547
|
-
'
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
[EModelEndpoint.anthropic]: [
|
|
551
|
-
'claude-3-5-sonnet-20240620',
|
|
552
|
-
'claude-3-opus-20240229',
|
|
553
|
-
'claude-3-sonnet-20240229',
|
|
554
|
-
'claude-3-haiku-20240307',
|
|
555
|
-
'claude-2.1',
|
|
556
|
-
'claude-2',
|
|
557
|
-
'claude-1.2',
|
|
558
|
-
'claude-1',
|
|
559
|
-
'claude-1-100k',
|
|
560
|
-
'claude-instant-1',
|
|
561
|
-
'claude-instant-1-100k',
|
|
733
|
+
// Shared Google Models between Vertex AI & Gen AI
|
|
734
|
+
// Gemini 2.0 Models
|
|
735
|
+
'gemini-2.0-flash-001',
|
|
736
|
+
'gemini-2.0-flash-exp',
|
|
737
|
+
'gemini-2.0-flash-lite',
|
|
738
|
+
'gemini-2.0-pro-exp-02-05',
|
|
739
|
+
// Gemini 1.5 Models
|
|
740
|
+
'gemini-1.5-flash-001',
|
|
741
|
+
'gemini-1.5-flash-002',
|
|
742
|
+
'gemini-1.5-pro-001',
|
|
743
|
+
'gemini-1.5-pro-002',
|
|
744
|
+
// Gemini 1.0 Models
|
|
745
|
+
'gemini-1.0-pro-001',
|
|
562
746
|
],
|
|
747
|
+
[EModelEndpoint.anthropic]: sharedAnthropicModels,
|
|
563
748
|
[EModelEndpoint.openAI]: [
|
|
564
|
-
'gpt-4o-mini',
|
|
565
|
-
'gpt-4o',
|
|
566
749
|
...sharedOpenAIModels,
|
|
750
|
+
'chatgpt-4o-latest',
|
|
567
751
|
'gpt-4-vision-preview',
|
|
568
752
|
'gpt-3.5-turbo-instruct-0914',
|
|
569
753
|
'gpt-3.5-turbo-instruct',
|
|
570
754
|
],
|
|
755
|
+
[EModelEndpoint.bedrock]: bedrockModels,
|
|
571
756
|
};
|
|
572
757
|
|
|
573
758
|
const fitlerAssistantModels = (str: string) => {
|
|
@@ -580,17 +765,17 @@ export const initialModelsConfig: TModelsConfig = {
|
|
|
580
765
|
initial: [],
|
|
581
766
|
[EModelEndpoint.openAI]: openAIModels,
|
|
582
767
|
[EModelEndpoint.assistants]: openAIModels.filter(fitlerAssistantModels),
|
|
768
|
+
[EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)
|
|
583
769
|
[EModelEndpoint.gptPlugins]: openAIModels,
|
|
584
770
|
[EModelEndpoint.azureOpenAI]: openAIModels,
|
|
585
|
-
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
|
|
586
771
|
[EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],
|
|
587
772
|
[EModelEndpoint.google]: defaultModels[EModelEndpoint.google],
|
|
588
773
|
[EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],
|
|
774
|
+
[EModelEndpoint.bedrock]: defaultModels[EModelEndpoint.bedrock],
|
|
589
775
|
};
|
|
590
776
|
|
|
591
777
|
export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
592
778
|
[EModelEndpoint.openAI]: `/api/ask/${EModelEndpoint.openAI}`,
|
|
593
|
-
[EModelEndpoint.bingAI]: `/api/ask/${EModelEndpoint.bingAI}`,
|
|
594
779
|
[EModelEndpoint.google]: `/api/ask/${EModelEndpoint.google}`,
|
|
595
780
|
[EModelEndpoint.custom]: `/api/ask/${EModelEndpoint.custom}`,
|
|
596
781
|
[EModelEndpoint.anthropic]: `/api/ask/${EModelEndpoint.anthropic}`,
|
|
@@ -599,6 +784,8 @@ export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
|
599
784
|
[EModelEndpoint.chatGPTBrowser]: `/api/ask/${EModelEndpoint.chatGPTBrowser}`,
|
|
600
785
|
[EModelEndpoint.azureAssistants]: '/api/assistants/v1/chat',
|
|
601
786
|
[EModelEndpoint.assistants]: '/api/assistants/v2/chat',
|
|
787
|
+
[EModelEndpoint.agents]: `/api/${EModelEndpoint.agents}/chat`,
|
|
788
|
+
[EModelEndpoint.bedrock]: `/api/${EModelEndpoint.bedrock}/chat`,
|
|
602
789
|
};
|
|
603
790
|
|
|
604
791
|
export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
@@ -608,6 +795,8 @@ export const modularEndpoints = new Set<EModelEndpoint | string>([
|
|
|
608
795
|
EModelEndpoint.openAI,
|
|
609
796
|
EModelEndpoint.azureOpenAI,
|
|
610
797
|
EModelEndpoint.custom,
|
|
798
|
+
EModelEndpoint.agents,
|
|
799
|
+
EModelEndpoint.bedrock,
|
|
611
800
|
]);
|
|
612
801
|
|
|
613
802
|
export const supportsBalanceCheck = {
|
|
@@ -616,23 +805,39 @@ export const supportsBalanceCheck = {
|
|
|
616
805
|
[EModelEndpoint.anthropic]: true,
|
|
617
806
|
[EModelEndpoint.gptPlugins]: true,
|
|
618
807
|
[EModelEndpoint.assistants]: true,
|
|
808
|
+
[EModelEndpoint.agents]: true,
|
|
619
809
|
[EModelEndpoint.azureAssistants]: true,
|
|
620
810
|
[EModelEndpoint.azureOpenAI]: true,
|
|
811
|
+
[EModelEndpoint.bedrock]: true,
|
|
621
812
|
};
|
|
622
813
|
|
|
623
814
|
export const visionModels = [
|
|
815
|
+
'grok-3',
|
|
816
|
+
'grok-2-vision',
|
|
817
|
+
'grok-vision',
|
|
818
|
+
'gpt-4.5',
|
|
624
819
|
'gpt-4o',
|
|
625
820
|
'gpt-4o-mini',
|
|
821
|
+
'o1',
|
|
626
822
|
'gpt-4-turbo',
|
|
627
823
|
'gpt-4-vision',
|
|
628
824
|
'llava',
|
|
629
825
|
'llava-13b',
|
|
630
826
|
'gemini-pro-vision',
|
|
631
827
|
'claude-3',
|
|
828
|
+
'gemini-2.0',
|
|
632
829
|
'gemini-1.5',
|
|
830
|
+
'gemini-exp',
|
|
831
|
+
'moondream',
|
|
832
|
+
'llama3.2-vision',
|
|
833
|
+
'llama-3.2-90b-vision',
|
|
834
|
+
'llama-3.2-11b-vision',
|
|
835
|
+
'llama-3-2-90b-vision',
|
|
836
|
+
'llama-3-2-11b-vision',
|
|
633
837
|
];
|
|
634
838
|
export enum VisionModes {
|
|
635
839
|
generative = 'generative',
|
|
840
|
+
agents = 'agents',
|
|
636
841
|
}
|
|
637
842
|
|
|
638
843
|
export function validateVisionModel({
|
|
@@ -648,7 +853,7 @@ export function validateVisionModel({
|
|
|
648
853
|
return false;
|
|
649
854
|
}
|
|
650
855
|
|
|
651
|
-
if (model
|
|
856
|
+
if (model.includes('gpt-4-turbo-preview') || model.includes('o1-mini')) {
|
|
652
857
|
return false;
|
|
653
858
|
}
|
|
654
859
|
|
|
@@ -659,7 +864,7 @@ export function validateVisionModel({
|
|
|
659
864
|
return visionModels.concat(additionalModels).some((visionModel) => model.includes(visionModel));
|
|
660
865
|
}
|
|
661
866
|
|
|
662
|
-
export const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion']);
|
|
867
|
+
export const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion', 'flux']);
|
|
663
868
|
|
|
664
869
|
/**
|
|
665
870
|
* Enum for collections using infinite queries
|
|
@@ -679,6 +884,7 @@ export enum InfiniteCollections {
|
|
|
679
884
|
* Enum for time intervals
|
|
680
885
|
*/
|
|
681
886
|
export enum Time {
|
|
887
|
+
ONE_HOUR = 3600000,
|
|
682
888
|
THIRTY_MINUTES = 1800000,
|
|
683
889
|
TEN_MINUTES = 600000,
|
|
684
890
|
FIVE_MINUTES = 300000,
|
|
@@ -761,6 +967,10 @@ export enum CacheKeys {
|
|
|
761
967
|
* Key for in-progress messages.
|
|
762
968
|
*/
|
|
763
969
|
MESSAGES = 'messages',
|
|
970
|
+
/**
|
|
971
|
+
* Key for in-progress flow states.
|
|
972
|
+
*/
|
|
973
|
+
FLOWS = 'flows',
|
|
764
974
|
}
|
|
765
975
|
|
|
766
976
|
/**
|
|
@@ -799,6 +1009,14 @@ export enum ViolationTypes {
|
|
|
799
1009
|
* Verify Email Limit Violation.
|
|
800
1010
|
*/
|
|
801
1011
|
VERIFY_EMAIL_LIMIT = 'verify_email_limit',
|
|
1012
|
+
/**
|
|
1013
|
+
* Verify Conversation Access violation.
|
|
1014
|
+
*/
|
|
1015
|
+
CONVO_ACCESS = 'convo_access',
|
|
1016
|
+
/**
|
|
1017
|
+
* Tool Call Limit Violation.
|
|
1018
|
+
*/
|
|
1019
|
+
TOOL_CALL_LIMIT = 'tool_call_limit',
|
|
802
1020
|
}
|
|
803
1021
|
|
|
804
1022
|
/**
|
|
@@ -825,6 +1043,26 @@ export enum ErrorTypes {
|
|
|
825
1043
|
* Moderation error
|
|
826
1044
|
*/
|
|
827
1045
|
MODERATION = 'moderation',
|
|
1046
|
+
/**
|
|
1047
|
+
* Prompt exceeds max length
|
|
1048
|
+
*/
|
|
1049
|
+
INPUT_LENGTH = 'INPUT_LENGTH',
|
|
1050
|
+
/**
|
|
1051
|
+
* Invalid request error, API rejected request
|
|
1052
|
+
*/
|
|
1053
|
+
INVALID_REQUEST = 'invalid_request_error',
|
|
1054
|
+
/**
|
|
1055
|
+
* Invalid action request error, likely not on list of allowed domains
|
|
1056
|
+
*/
|
|
1057
|
+
INVALID_ACTION = 'invalid_action_error',
|
|
1058
|
+
/**
|
|
1059
|
+
* Invalid request error, API rejected request
|
|
1060
|
+
*/
|
|
1061
|
+
NO_SYSTEM_MESSAGES = 'no_system_messages',
|
|
1062
|
+
/**
|
|
1063
|
+
* Google provider returned an error
|
|
1064
|
+
*/
|
|
1065
|
+
GOOGLE_ERROR = 'google_error',
|
|
828
1066
|
}
|
|
829
1067
|
|
|
830
1068
|
/**
|
|
@@ -864,6 +1102,7 @@ export enum ImageDetailCost {
|
|
|
864
1102
|
/**
|
|
865
1103
|
* Additional Cost added to High Resolution Total Cost
|
|
866
1104
|
*/
|
|
1105
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
867
1106
|
ADDITIONAL = 85,
|
|
868
1107
|
}
|
|
869
1108
|
|
|
@@ -895,6 +1134,10 @@ export enum SettingsTabValues {
|
|
|
895
1134
|
* Tab for Account Settings
|
|
896
1135
|
*/
|
|
897
1136
|
ACCOUNT = 'account',
|
|
1137
|
+
/**
|
|
1138
|
+
* Chat input commands
|
|
1139
|
+
*/
|
|
1140
|
+
COMMANDS = 'commands',
|
|
898
1141
|
}
|
|
899
1142
|
|
|
900
1143
|
export enum STTProviders {
|
|
@@ -930,13 +1173,15 @@ export enum TTSProviders {
|
|
|
930
1173
|
/** Enum for app-wide constants */
|
|
931
1174
|
export enum Constants {
|
|
932
1175
|
/** Key for the app's version. */
|
|
933
|
-
VERSION = 'v0.7.
|
|
1176
|
+
VERSION = 'v0.7.7',
|
|
934
1177
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
935
|
-
CONFIG_VERSION = '1.1
|
|
1178
|
+
CONFIG_VERSION = '1.2.1',
|
|
936
1179
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
937
1180
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
938
1181
|
/** Standard value for the initial conversationId before a request is sent */
|
|
939
1182
|
NEW_CONVO = 'new',
|
|
1183
|
+
/** Standard value for the conversationId used for search queries */
|
|
1184
|
+
SEARCH = 'search',
|
|
940
1185
|
/** Fixed, encoded domain length for Azure OpenAI Assistants Function name parsing. */
|
|
941
1186
|
ENCODED_DOMAIN_LENGTH = 10,
|
|
942
1187
|
/** Identifier for using current_model in multi-model requests. */
|
|
@@ -947,6 +1192,14 @@ export enum Constants {
|
|
|
947
1192
|
COMMANDS_MAX_LENGTH = 56,
|
|
948
1193
|
/** Default Stream Rate (ms) */
|
|
949
1194
|
DEFAULT_STREAM_RATE = 1,
|
|
1195
|
+
/** Saved Tag */
|
|
1196
|
+
SAVED_TAG = 'Saved',
|
|
1197
|
+
/** Max number of Conversation starters for Agents/Assistants */
|
|
1198
|
+
MAX_CONVO_STARTERS = 4,
|
|
1199
|
+
/** Global/instance Project Name */
|
|
1200
|
+
GLOBAL_PROJECT_NAME = 'instance',
|
|
1201
|
+
/** Delimiter for MCP tools */
|
|
1202
|
+
mcp_delimiter = '_mcp_',
|
|
950
1203
|
}
|
|
951
1204
|
|
|
952
1205
|
export enum LocalStorageKeys {
|
|
@@ -954,8 +1207,6 @@ export enum LocalStorageKeys {
|
|
|
954
1207
|
APP_TITLE = 'appTitle',
|
|
955
1208
|
/** Key for the last conversation setup. */
|
|
956
1209
|
LAST_CONVO_SETUP = 'lastConversationSetup',
|
|
957
|
-
/** Key for the last BingAI Settings */
|
|
958
|
-
LAST_BING = 'lastBingSettings',
|
|
959
1210
|
/** Key for the last selected model. */
|
|
960
1211
|
LAST_MODEL = 'lastSelectedModel',
|
|
961
1212
|
/** Key for the last selected tools. */
|
|
@@ -966,10 +1217,12 @@ export enum LocalStorageKeys {
|
|
|
966
1217
|
FILES_TO_DELETE = 'filesToDelete',
|
|
967
1218
|
/** Prefix key for the last selected assistant ID by index */
|
|
968
1219
|
ASST_ID_PREFIX = 'assistant_id__',
|
|
1220
|
+
/** Prefix key for the last selected agent ID by index */
|
|
1221
|
+
AGENT_ID_PREFIX = 'agent_id__',
|
|
969
1222
|
/** Key for the last selected fork setting */
|
|
970
1223
|
FORK_SETTING = 'forkSetting',
|
|
971
1224
|
/** Key for remembering the last selected option, instead of manually selecting */
|
|
972
|
-
REMEMBER_FORK_OPTION = '
|
|
1225
|
+
REMEMBER_FORK_OPTION = 'rememberDefaultFork',
|
|
973
1226
|
/** Key for remembering the split at target fork option modifier */
|
|
974
1227
|
FORK_SPLIT_AT_TARGET = 'splitAtTarget',
|
|
975
1228
|
/** Key for saving text drafts */
|
|
@@ -978,6 +1231,10 @@ export enum LocalStorageKeys {
|
|
|
978
1231
|
FILES_DRAFT = 'filesDraft_',
|
|
979
1232
|
/** Key for last Selected Prompt Category */
|
|
980
1233
|
LAST_PROMPT_CATEGORY = 'lastPromptCategory',
|
|
1234
|
+
/** Key for rendering User Messages as Markdown */
|
|
1235
|
+
ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',
|
|
1236
|
+
/** Key for displaying analysis tool code input */
|
|
1237
|
+
SHOW_ANALYSIS_CODE = 'showAnalysisCode',
|
|
981
1238
|
}
|
|
982
1239
|
|
|
983
1240
|
export enum ForkOptions {
|
|
@@ -986,7 +1243,9 @@ export enum ForkOptions {
|
|
|
986
1243
|
/** Key for including branches */
|
|
987
1244
|
INCLUDE_BRANCHES = 'includeBranches',
|
|
988
1245
|
/** Key for target level fork (default) */
|
|
989
|
-
TARGET_LEVEL = '',
|
|
1246
|
+
TARGET_LEVEL = 'targetLevel',
|
|
1247
|
+
/** Default option */
|
|
1248
|
+
DEFAULT = 'default',
|
|
990
1249
|
}
|
|
991
1250
|
|
|
992
1251
|
/**
|
|
@@ -1021,3 +1280,10 @@ export enum SystemCategories {
|
|
|
1021
1280
|
NO_CATEGORY = 'sys__no__category__sys',
|
|
1022
1281
|
SHARED_PROMPTS = 'sys__shared__prompts__sys',
|
|
1023
1282
|
}
|
|
1283
|
+
|
|
1284
|
+
export const providerEndpointMap = {
|
|
1285
|
+
[EModelEndpoint.openAI]: EModelEndpoint.openAI,
|
|
1286
|
+
[EModelEndpoint.bedrock]: EModelEndpoint.bedrock,
|
|
1287
|
+
[EModelEndpoint.anthropic]: EModelEndpoint.anthropic,
|
|
1288
|
+
[EModelEndpoint.azureOpenAI]: EModelEndpoint.azureOpenAI,
|
|
1289
|
+
};
|