librechat-data-provider 0.7.69 → 0.7.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react-query/index.es.js +1 -1
- package/dist/react-query/index.es.js.map +1 -1
- package/dist/react-query/package.json +1 -1
- package/package.json +2 -2
- package/server-rollup.config.js +1 -1
- package/specs/actions.spec.ts +125 -7
- package/specs/filetypes.spec.ts +1 -7
- package/specs/mcp.spec.ts +52 -0
- package/specs/utils.spec.ts +129 -0
- package/src/actions.ts +100 -44
- package/src/api-endpoints.ts +23 -5
- package/src/azure.ts +2 -1
- package/src/bedrock.ts +84 -4
- package/src/config.ts +169 -69
- package/src/createPayload.ts +3 -1
- package/src/data-service.ts +54 -15
- package/src/file-config.ts +7 -0
- package/src/generate.ts +1 -1
- package/src/index.ts +2 -0
- package/src/keys.ts +4 -0
- package/src/mcp.ts +17 -1
- package/src/models.ts +1 -1
- package/src/ocr.ts +14 -0
- package/src/parsers.ts +43 -43
- package/src/react-query/react-query-service.ts +33 -119
- package/src/request.ts +7 -0
- package/src/roles.ts +33 -1
- package/src/schemas.ts +163 -184
- package/src/types/agents.ts +45 -1
- package/src/types/assistants.ts +20 -4
- package/src/types/files.ts +2 -0
- package/src/types/mutations.ts +41 -3
- package/src/types/queries.ts +24 -13
- package/src/types/runs.ts +1 -0
- package/src/types.ts +78 -77
- package/src/utils.ts +44 -0
- package/src/zod.spec.ts +86 -27
- package/src/zod.ts +22 -2
- package/tsconfig.json +1 -2
- package/specs/parsers.spec.ts +0 -48
package/src/api-endpoints.ts
CHANGED
|
@@ -10,14 +10,24 @@ export const userPlugins = () => '/api/user/plugins';
|
|
|
10
10
|
export const deleteUser = () => '/api/user/delete';
|
|
11
11
|
|
|
12
12
|
export const messages = (conversationId: string, messageId?: string) =>
|
|
13
|
-
`/api/messages/${conversationId}${messageId ? `/${messageId}` : ''}`;
|
|
13
|
+
`/api/messages/${conversationId}${messageId != null && messageId ? `/${messageId}` : ''}`;
|
|
14
14
|
|
|
15
15
|
const shareRoot = '/api/share';
|
|
16
16
|
export const shareMessages = (shareId: string) => `${shareRoot}/${shareId}`;
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export const getSharedLink = (conversationId: string) => `${shareRoot}/link/${conversationId}`;
|
|
18
|
+
export const getSharedLinks = (
|
|
19
|
+
pageSize: number,
|
|
20
|
+
isPublic: boolean,
|
|
21
|
+
sortBy: 'title' | 'createdAt',
|
|
22
|
+
sortDirection: 'asc' | 'desc',
|
|
23
|
+
search?: string,
|
|
24
|
+
cursor?: string,
|
|
25
|
+
) =>
|
|
26
|
+
`${shareRoot}?pageSize=${pageSize}&isPublic=${isPublic}&sortBy=${sortBy}&sortDirection=${sortDirection}${
|
|
27
|
+
search ? `&search=${search}` : ''
|
|
28
|
+
}${cursor ? `&cursor=${cursor}` : ''}`;
|
|
29
|
+
export const createSharedLink = (conversationId: string) => `${shareRoot}/${conversationId}`;
|
|
30
|
+
export const updateSharedLink = (shareId: string) => `${shareRoot}/${shareId}`;
|
|
21
31
|
|
|
22
32
|
const keysEndpoint = '/api/keys';
|
|
23
33
|
|
|
@@ -227,3 +237,11 @@ export const addTagToConversation = (conversationId: string) =>
|
|
|
227
237
|
export const userTerms = () => '/api/user/terms';
|
|
228
238
|
export const acceptUserTerms = () => '/api/user/terms/accept';
|
|
229
239
|
export const banner = () => '/api/banner';
|
|
240
|
+
|
|
241
|
+
// Two-Factor Endpoints
|
|
242
|
+
export const enableTwoFactor = () => '/api/auth/2fa/enable';
|
|
243
|
+
export const verifyTwoFactor = () => '/api/auth/2fa/verify';
|
|
244
|
+
export const confirmTwoFactor = () => '/api/auth/2fa/confirm';
|
|
245
|
+
export const disableTwoFactor = () => '/api/auth/2fa/disable';
|
|
246
|
+
export const regenerateBackupCodes = () => '/api/auth/2fa/backup/regenerate';
|
|
247
|
+
export const verifyTwoFactorTemp = () => '/api/auth/2fa/verify-temp';
|
package/src/azure.ts
CHANGED
|
@@ -6,8 +6,9 @@ import type {
|
|
|
6
6
|
TValidatedAzureConfig,
|
|
7
7
|
TAzureConfigValidationResult,
|
|
8
8
|
} from '../src/config';
|
|
9
|
-
import {
|
|
9
|
+
import { extractEnvVariable, envVarRegex } from '../src/utils';
|
|
10
10
|
import { azureGroupConfigsSchema } from '../src/config';
|
|
11
|
+
import { errorsToString } from '../src/parsers';
|
|
11
12
|
|
|
12
13
|
export const deprecatedAzureVariables = [
|
|
13
14
|
/* "related to" precedes description text */
|
package/src/bedrock.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import * as s from './schemas';
|
|
3
3
|
|
|
4
|
+
type ThinkingConfig = {
|
|
5
|
+
type: 'enabled';
|
|
6
|
+
budget_tokens: number;
|
|
7
|
+
};
|
|
8
|
+
type AnthropicReasoning = {
|
|
9
|
+
thinking?: ThinkingConfig | boolean;
|
|
10
|
+
thinkingBudget?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type AnthropicInput = BedrockConverseInput & {
|
|
14
|
+
additionalModelRequestFields: BedrockConverseInput['additionalModelRequestFields'] &
|
|
15
|
+
AnthropicReasoning;
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
export const bedrockInputSchema = s.tConversationSchema
|
|
5
19
|
.pick({
|
|
6
20
|
/* LibreChat params; optionType: 'conversation' */
|
|
@@ -21,11 +35,24 @@ export const bedrockInputSchema = s.tConversationSchema
|
|
|
21
35
|
temperature: true,
|
|
22
36
|
topP: true,
|
|
23
37
|
stop: true,
|
|
38
|
+
thinking: true,
|
|
39
|
+
thinkingBudget: true,
|
|
24
40
|
/* Catch-all fields */
|
|
25
41
|
topK: true,
|
|
26
42
|
additionalModelRequestFields: true,
|
|
27
43
|
})
|
|
28
|
-
.transform(
|
|
44
|
+
.transform((obj) => {
|
|
45
|
+
if ((obj as AnthropicInput).additionalModelRequestFields?.thinking != null) {
|
|
46
|
+
const _obj = obj as AnthropicInput;
|
|
47
|
+
obj.thinking = !!_obj.additionalModelRequestFields.thinking;
|
|
48
|
+
obj.thinkingBudget =
|
|
49
|
+
typeof _obj.additionalModelRequestFields.thinking === 'object'
|
|
50
|
+
? (_obj.additionalModelRequestFields.thinking as ThinkingConfig)?.budget_tokens
|
|
51
|
+
: undefined;
|
|
52
|
+
delete obj.additionalModelRequestFields;
|
|
53
|
+
}
|
|
54
|
+
return s.removeNullishValues(obj);
|
|
55
|
+
})
|
|
29
56
|
.catch(() => ({}));
|
|
30
57
|
|
|
31
58
|
export type BedrockConverseInput = z.infer<typeof bedrockInputSchema>;
|
|
@@ -49,6 +76,8 @@ export const bedrockInputParser = s.tConversationSchema
|
|
|
49
76
|
temperature: true,
|
|
50
77
|
topP: true,
|
|
51
78
|
stop: true,
|
|
79
|
+
thinking: true,
|
|
80
|
+
thinkingBudget: true,
|
|
52
81
|
/* Catch-all fields */
|
|
53
82
|
topK: true,
|
|
54
83
|
additionalModelRequestFields: true,
|
|
@@ -87,6 +116,27 @@ export const bedrockInputParser = s.tConversationSchema
|
|
|
87
116
|
}
|
|
88
117
|
});
|
|
89
118
|
|
|
119
|
+
/** Default thinking and thinkingBudget for 'anthropic.claude-3-7-sonnet' models, if not defined */
|
|
120
|
+
if (
|
|
121
|
+
typeof typedData.model === 'string' &&
|
|
122
|
+
typedData.model.includes('anthropic.claude-3-7-sonnet')
|
|
123
|
+
) {
|
|
124
|
+
if (additionalFields.thinking === undefined) {
|
|
125
|
+
additionalFields.thinking = true;
|
|
126
|
+
} else if (additionalFields.thinking === false) {
|
|
127
|
+
delete additionalFields.thinking;
|
|
128
|
+
delete additionalFields.thinkingBudget;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (additionalFields.thinking === true && additionalFields.thinkingBudget === undefined) {
|
|
132
|
+
additionalFields.thinkingBudget = 2000;
|
|
133
|
+
}
|
|
134
|
+
additionalFields.anthropic_beta = ['output-128k-2025-02-19'];
|
|
135
|
+
} else if (additionalFields.thinking != null || additionalFields.thinkingBudget != null) {
|
|
136
|
+
delete additionalFields.thinking;
|
|
137
|
+
delete additionalFields.thinkingBudget;
|
|
138
|
+
}
|
|
139
|
+
|
|
90
140
|
if (Object.keys(additionalFields).length > 0) {
|
|
91
141
|
typedData.additionalModelRequestFields = {
|
|
92
142
|
...((typedData.additionalModelRequestFields as Record<string, unknown> | undefined) || {}),
|
|
@@ -104,9 +154,34 @@ export const bedrockInputParser = s.tConversationSchema
|
|
|
104
154
|
})
|
|
105
155
|
.catch(() => ({}));
|
|
106
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Configures the "thinking" parameter based on given input and thinking options.
|
|
159
|
+
*
|
|
160
|
+
* @param data - The parsed Bedrock request options object
|
|
161
|
+
* @returns The object with thinking configured appropriately
|
|
162
|
+
*/
|
|
163
|
+
function configureThinking(data: AnthropicInput): AnthropicInput {
|
|
164
|
+
const updatedData = { ...data };
|
|
165
|
+
if (updatedData.additionalModelRequestFields?.thinking === true) {
|
|
166
|
+
updatedData.maxTokens = updatedData.maxTokens ?? updatedData.maxOutputTokens ?? 8192;
|
|
167
|
+
delete updatedData.maxOutputTokens;
|
|
168
|
+
const thinkingConfig: AnthropicReasoning['thinking'] = {
|
|
169
|
+
type: 'enabled',
|
|
170
|
+
budget_tokens: updatedData.additionalModelRequestFields.thinkingBudget ?? 2000,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
if (thinkingConfig.budget_tokens > updatedData.maxTokens) {
|
|
174
|
+
thinkingConfig.budget_tokens = Math.floor(updatedData.maxTokens * 0.9);
|
|
175
|
+
}
|
|
176
|
+
updatedData.additionalModelRequestFields.thinking = thinkingConfig;
|
|
177
|
+
delete updatedData.additionalModelRequestFields.thinkingBudget;
|
|
178
|
+
}
|
|
179
|
+
return updatedData;
|
|
180
|
+
}
|
|
181
|
+
|
|
107
182
|
export const bedrockOutputParser = (data: Record<string, unknown>) => {
|
|
108
183
|
const knownKeys = [...Object.keys(s.tConversationSchema.shape), 'topK', 'top_k'];
|
|
109
|
-
|
|
184
|
+
let result: Record<string, unknown> = {};
|
|
110
185
|
|
|
111
186
|
// Extract known fields from the root level
|
|
112
187
|
Object.entries(data).forEach(([key, value]) => {
|
|
@@ -125,6 +200,8 @@ export const bedrockOutputParser = (data: Record<string, unknown>) => {
|
|
|
125
200
|
if (knownKeys.includes(key)) {
|
|
126
201
|
if (key === 'top_k') {
|
|
127
202
|
result['topK'] = value;
|
|
203
|
+
} else if (key === 'thinking' || key === 'thinkingBudget') {
|
|
204
|
+
return;
|
|
128
205
|
} else {
|
|
129
206
|
result[key] = value;
|
|
130
207
|
}
|
|
@@ -140,8 +217,11 @@ export const bedrockOutputParser = (data: Record<string, unknown>) => {
|
|
|
140
217
|
result.maxTokens = result.maxOutputTokens;
|
|
141
218
|
}
|
|
142
219
|
|
|
143
|
-
|
|
144
|
-
|
|
220
|
+
result = configureThinking(result as AnthropicInput);
|
|
221
|
+
// Remove additionalModelRequestFields from the result if it doesn't thinking config
|
|
222
|
+
if ((result as AnthropicInput).additionalModelRequestFields?.thinking == null) {
|
|
223
|
+
delete result.additionalModelRequestFields;
|
|
224
|
+
}
|
|
145
225
|
|
|
146
226
|
return result;
|
|
147
227
|
};
|
package/src/config.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
import type { ZodError } from 'zod';
|
|
4
3
|
import type { TModelsConfig } from './types';
|
|
5
4
|
import { EModelEndpoint, eModelEndpointSchema } from './schemas';
|
|
5
|
+
import { specsConfigSchema, TSpecsConfig } from './models';
|
|
6
6
|
import { fileConfigSchema } from './file-config';
|
|
7
|
-
import { specsConfigSchema } from './models';
|
|
8
7
|
import { FileSources } from './types/files';
|
|
9
8
|
import { MCPServersSchema } from './mcp';
|
|
10
9
|
|
|
@@ -16,6 +15,7 @@ export const defaultRetrievalModels = [
|
|
|
16
15
|
'o1-preview',
|
|
17
16
|
'o1-mini-2024-09-12',
|
|
18
17
|
'o1-mini',
|
|
18
|
+
'o3-mini',
|
|
19
19
|
'chatgpt-4o-latest',
|
|
20
20
|
'gpt-4o-2024-05-13',
|
|
21
21
|
'gpt-4o-2024-08-06',
|
|
@@ -32,6 +32,27 @@ export const defaultRetrievalModels = [
|
|
|
32
32
|
'gpt-4-1106',
|
|
33
33
|
];
|
|
34
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
|
+
|
|
35
56
|
export enum SettingsViews {
|
|
36
57
|
default = 'default',
|
|
37
58
|
advanced = 'advanced',
|
|
@@ -43,9 +64,8 @@ export const fileSourceSchema = z.nativeEnum(FileSources);
|
|
|
43
64
|
type SchemaShape<T> = T extends z.ZodObject<infer U> ? U : never;
|
|
44
65
|
|
|
45
66
|
// Helper type to determine the default value or undefined based on whether the field has a default
|
|
46
|
-
type DefaultValue<T> =
|
|
47
|
-
? ReturnType<T['_def']['defaultValue']>
|
|
48
|
-
: undefined;
|
|
67
|
+
type DefaultValue<T> =
|
|
68
|
+
T extends z.ZodDefault<z.ZodTypeAny> ? ReturnType<T['_def']['defaultValue']> : undefined;
|
|
49
69
|
|
|
50
70
|
// Extract default values or undefined from the schema shape
|
|
51
71
|
type ExtractDefaults<T> = {
|
|
@@ -145,8 +165,10 @@ export enum AgentCapabilities {
|
|
|
145
165
|
end_after_tools = 'end_after_tools',
|
|
146
166
|
execute_code = 'execute_code',
|
|
147
167
|
file_search = 'file_search',
|
|
168
|
+
artifacts = 'artifacts',
|
|
148
169
|
actions = 'actions',
|
|
149
170
|
tools = 'tools',
|
|
171
|
+
ocr = 'ocr',
|
|
150
172
|
}
|
|
151
173
|
|
|
152
174
|
export const defaultAssistantsVersion = {
|
|
@@ -218,8 +240,10 @@ export const agentsEndpointSChema = baseEndpointSchema.merge(
|
|
|
218
240
|
.default([
|
|
219
241
|
AgentCapabilities.execute_code,
|
|
220
242
|
AgentCapabilities.file_search,
|
|
243
|
+
AgentCapabilities.artifacts,
|
|
221
244
|
AgentCapabilities.actions,
|
|
222
245
|
AgentCapabilities.tools,
|
|
246
|
+
AgentCapabilities.ocr,
|
|
223
247
|
]),
|
|
224
248
|
}),
|
|
225
249
|
);
|
|
@@ -427,52 +451,113 @@ export enum EImageOutputType {
|
|
|
427
451
|
JPEG = 'jpeg',
|
|
428
452
|
}
|
|
429
453
|
|
|
454
|
+
const termsOfServiceSchema = z.object({
|
|
455
|
+
externalUrl: z.string().optional(),
|
|
456
|
+
openNewTab: z.boolean().optional(),
|
|
457
|
+
modalAcceptance: z.boolean().optional(),
|
|
458
|
+
modalTitle: z.string().optional(),
|
|
459
|
+
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
export type TTermsOfService = z.infer<typeof termsOfServiceSchema>;
|
|
463
|
+
|
|
464
|
+
export const intefaceSchema = z
|
|
465
|
+
.object({
|
|
466
|
+
privacyPolicy: z
|
|
467
|
+
.object({
|
|
468
|
+
externalUrl: z.string().optional(),
|
|
469
|
+
openNewTab: z.boolean().optional(),
|
|
470
|
+
})
|
|
471
|
+
.optional(),
|
|
472
|
+
termsOfService: termsOfServiceSchema.optional(),
|
|
473
|
+
customWelcome: z.string().optional(),
|
|
474
|
+
endpointsMenu: z.boolean().optional(),
|
|
475
|
+
modelSelect: z.boolean().optional(),
|
|
476
|
+
parameters: z.boolean().optional(),
|
|
477
|
+
sidePanel: z.boolean().optional(),
|
|
478
|
+
multiConvo: z.boolean().optional(),
|
|
479
|
+
bookmarks: z.boolean().optional(),
|
|
480
|
+
presets: z.boolean().optional(),
|
|
481
|
+
prompts: z.boolean().optional(),
|
|
482
|
+
agents: z.boolean().optional(),
|
|
483
|
+
temporaryChat: z.boolean().optional(),
|
|
484
|
+
runCode: z.boolean().optional(),
|
|
485
|
+
})
|
|
486
|
+
.default({
|
|
487
|
+
endpointsMenu: true,
|
|
488
|
+
modelSelect: true,
|
|
489
|
+
parameters: true,
|
|
490
|
+
sidePanel: true,
|
|
491
|
+
presets: true,
|
|
492
|
+
multiConvo: true,
|
|
493
|
+
bookmarks: true,
|
|
494
|
+
prompts: true,
|
|
495
|
+
agents: true,
|
|
496
|
+
temporaryChat: true,
|
|
497
|
+
runCode: true,
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
export type TInterfaceConfig = z.infer<typeof intefaceSchema>;
|
|
501
|
+
|
|
502
|
+
export type TStartupConfig = {
|
|
503
|
+
appTitle: string;
|
|
504
|
+
socialLogins?: string[];
|
|
505
|
+
interface?: TInterfaceConfig;
|
|
506
|
+
discordLoginEnabled: boolean;
|
|
507
|
+
facebookLoginEnabled: boolean;
|
|
508
|
+
githubLoginEnabled: boolean;
|
|
509
|
+
googleLoginEnabled: boolean;
|
|
510
|
+
openidLoginEnabled: boolean;
|
|
511
|
+
appleLoginEnabled: boolean;
|
|
512
|
+
openidLabel: string;
|
|
513
|
+
openidImageUrl: string;
|
|
514
|
+
/** LDAP Auth Configuration */
|
|
515
|
+
ldap?: {
|
|
516
|
+
/** LDAP enabled */
|
|
517
|
+
enabled: boolean;
|
|
518
|
+
/** Whether LDAP uses username vs. email */
|
|
519
|
+
username?: boolean;
|
|
520
|
+
};
|
|
521
|
+
serverDomain: string;
|
|
522
|
+
emailLoginEnabled: boolean;
|
|
523
|
+
registrationEnabled: boolean;
|
|
524
|
+
socialLoginEnabled: boolean;
|
|
525
|
+
passwordResetEnabled: boolean;
|
|
526
|
+
emailEnabled: boolean;
|
|
527
|
+
checkBalance: boolean;
|
|
528
|
+
showBirthdayIcon: boolean;
|
|
529
|
+
helpAndFaqURL: string;
|
|
530
|
+
customFooter?: string;
|
|
531
|
+
modelSpecs?: TSpecsConfig;
|
|
532
|
+
sharedLinksEnabled: boolean;
|
|
533
|
+
publicSharedLinksEnabled: boolean;
|
|
534
|
+
analyticsGtmId?: string;
|
|
535
|
+
instanceProjectId: string;
|
|
536
|
+
bundlerURL?: string;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
export enum OCRStrategy {
|
|
540
|
+
MISTRAL_OCR = 'mistral_ocr',
|
|
541
|
+
CUSTOM_OCR = 'custom_ocr',
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export const ocrSchema = z.object({
|
|
545
|
+
mistralModel: z.string().optional(),
|
|
546
|
+
apiKey: z.string().optional().default('OCR_API_KEY'),
|
|
547
|
+
baseURL: z.string().optional().default('OCR_BASEURL'),
|
|
548
|
+
strategy: z.nativeEnum(OCRStrategy).default(OCRStrategy.MISTRAL_OCR),
|
|
549
|
+
});
|
|
550
|
+
|
|
430
551
|
export const configSchema = z.object({
|
|
431
552
|
version: z.string(),
|
|
432
553
|
cache: z.boolean().default(true),
|
|
554
|
+
ocr: ocrSchema.optional(),
|
|
433
555
|
secureImageLinks: z.boolean().optional(),
|
|
434
556
|
imageOutputType: z.nativeEnum(EImageOutputType).default(EImageOutputType.PNG),
|
|
435
557
|
includedTools: z.array(z.string()).optional(),
|
|
436
558
|
filteredTools: z.array(z.string()).optional(),
|
|
437
559
|
mcpServers: MCPServersSchema.optional(),
|
|
438
|
-
interface:
|
|
439
|
-
.object({
|
|
440
|
-
privacyPolicy: z
|
|
441
|
-
.object({
|
|
442
|
-
externalUrl: z.string().optional(),
|
|
443
|
-
openNewTab: z.boolean().optional(),
|
|
444
|
-
})
|
|
445
|
-
.optional(),
|
|
446
|
-
termsOfService: z
|
|
447
|
-
.object({
|
|
448
|
-
externalUrl: z.string().optional(),
|
|
449
|
-
openNewTab: z.boolean().optional(),
|
|
450
|
-
modalAcceptance: z.boolean().optional(),
|
|
451
|
-
modalTitle: z.string().optional(),
|
|
452
|
-
modalContent: z.string().or(z.array(z.string())).optional(),
|
|
453
|
-
})
|
|
454
|
-
.optional(),
|
|
455
|
-
endpointsMenu: z.boolean().optional(),
|
|
456
|
-
modelSelect: z.boolean().optional(),
|
|
457
|
-
parameters: z.boolean().optional(),
|
|
458
|
-
sidePanel: z.boolean().optional(),
|
|
459
|
-
multiConvo: z.boolean().optional(),
|
|
460
|
-
bookmarks: z.boolean().optional(),
|
|
461
|
-
presets: z.boolean().optional(),
|
|
462
|
-
prompts: z.boolean().optional(),
|
|
463
|
-
agents: z.boolean().optional(),
|
|
464
|
-
})
|
|
465
|
-
.default({
|
|
466
|
-
endpointsMenu: true,
|
|
467
|
-
modelSelect: true,
|
|
468
|
-
parameters: true,
|
|
469
|
-
sidePanel: true,
|
|
470
|
-
presets: true,
|
|
471
|
-
multiConvo: true,
|
|
472
|
-
bookmarks: true,
|
|
473
|
-
prompts: true,
|
|
474
|
-
agents: true,
|
|
475
|
-
}),
|
|
560
|
+
interface: intefaceSchema,
|
|
476
561
|
fileStrategy: fileSourceSchema.default(FileSources.local),
|
|
477
562
|
actions: z
|
|
478
563
|
.object({
|
|
@@ -555,7 +640,6 @@ export const defaultEndpoints: EModelEndpoint[] = [
|
|
|
555
640
|
EModelEndpoint.azureAssistants,
|
|
556
641
|
EModelEndpoint.azureOpenAI,
|
|
557
642
|
EModelEndpoint.agents,
|
|
558
|
-
EModelEndpoint.bingAI,
|
|
559
643
|
EModelEndpoint.chatGPTBrowser,
|
|
560
644
|
EModelEndpoint.gptPlugins,
|
|
561
645
|
EModelEndpoint.google,
|
|
@@ -570,7 +654,6 @@ export const alternateName = {
|
|
|
570
654
|
[EModelEndpoint.agents]: 'Agents',
|
|
571
655
|
[EModelEndpoint.azureAssistants]: 'Azure Assistants',
|
|
572
656
|
[EModelEndpoint.azureOpenAI]: 'Azure OpenAI',
|
|
573
|
-
[EModelEndpoint.bingAI]: 'Bing',
|
|
574
657
|
[EModelEndpoint.chatGPTBrowser]: 'ChatGPT',
|
|
575
658
|
[EModelEndpoint.gptPlugins]: 'Plugins',
|
|
576
659
|
[EModelEndpoint.google]: 'Google',
|
|
@@ -578,12 +661,15 @@ export const alternateName = {
|
|
|
578
661
|
[EModelEndpoint.custom]: 'Custom',
|
|
579
662
|
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
|
580
663
|
[KnownEndpoints.ollama]: 'Ollama',
|
|
664
|
+
[KnownEndpoints.deepseek]: 'DeepSeek',
|
|
581
665
|
[KnownEndpoints.xai]: 'xAI',
|
|
582
666
|
};
|
|
583
667
|
|
|
584
668
|
const sharedOpenAIModels = [
|
|
585
669
|
'gpt-4o-mini',
|
|
586
670
|
'gpt-4o',
|
|
671
|
+
'gpt-4.5-preview',
|
|
672
|
+
'gpt-4.5-preview-2025-02-27',
|
|
587
673
|
'gpt-3.5-turbo',
|
|
588
674
|
'gpt-3.5-turbo-0125',
|
|
589
675
|
'gpt-4-turbo',
|
|
@@ -602,6 +688,8 @@ const sharedOpenAIModels = [
|
|
|
602
688
|
];
|
|
603
689
|
|
|
604
690
|
const sharedAnthropicModels = [
|
|
691
|
+
'claude-3-7-sonnet-latest',
|
|
692
|
+
'claude-3-7-sonnet-20250219',
|
|
605
693
|
'claude-3-5-haiku-20241022',
|
|
606
694
|
'claude-3-5-sonnet-20241022',
|
|
607
695
|
'claude-3-5-sonnet-20240620',
|
|
@@ -654,26 +742,27 @@ export const bedrockModels = [
|
|
|
654
742
|
|
|
655
743
|
export const defaultModels = {
|
|
656
744
|
[EModelEndpoint.azureAssistants]: sharedOpenAIModels,
|
|
657
|
-
[EModelEndpoint.assistants]: ['chatgpt-4o-latest'
|
|
745
|
+
[EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],
|
|
658
746
|
[EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)
|
|
659
747
|
[EModelEndpoint.google]: [
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
'
|
|
663
|
-
'
|
|
664
|
-
'
|
|
665
|
-
'
|
|
666
|
-
|
|
667
|
-
'
|
|
668
|
-
'
|
|
669
|
-
'
|
|
670
|
-
'
|
|
671
|
-
|
|
748
|
+
// Shared Google Models between Vertex AI & Gen AI
|
|
749
|
+
// Gemini 2.0 Models
|
|
750
|
+
'gemini-2.0-flash-001',
|
|
751
|
+
'gemini-2.0-flash-exp',
|
|
752
|
+
'gemini-2.0-flash-lite',
|
|
753
|
+
'gemini-2.0-pro-exp-02-05',
|
|
754
|
+
// Gemini 1.5 Models
|
|
755
|
+
'gemini-1.5-flash-001',
|
|
756
|
+
'gemini-1.5-flash-002',
|
|
757
|
+
'gemini-1.5-pro-001',
|
|
758
|
+
'gemini-1.5-pro-002',
|
|
759
|
+
// Gemini 1.0 Models
|
|
760
|
+
'gemini-1.0-pro-001',
|
|
672
761
|
],
|
|
673
762
|
[EModelEndpoint.anthropic]: sharedAnthropicModels,
|
|
674
763
|
[EModelEndpoint.openAI]: [
|
|
675
|
-
'chatgpt-4o-latest',
|
|
676
764
|
...sharedOpenAIModels,
|
|
765
|
+
'chatgpt-4o-latest',
|
|
677
766
|
'gpt-4-vision-preview',
|
|
678
767
|
'gpt-3.5-turbo-instruct-0914',
|
|
679
768
|
'gpt-3.5-turbo-instruct',
|
|
@@ -694,7 +783,6 @@ export const initialModelsConfig: TModelsConfig = {
|
|
|
694
783
|
[EModelEndpoint.agents]: openAIModels, // TODO: Add agent models (agentsModels)
|
|
695
784
|
[EModelEndpoint.gptPlugins]: openAIModels,
|
|
696
785
|
[EModelEndpoint.azureOpenAI]: openAIModels,
|
|
697
|
-
[EModelEndpoint.bingAI]: ['BingAI', 'Sydney'],
|
|
698
786
|
[EModelEndpoint.chatGPTBrowser]: ['text-davinci-002-render-sha'],
|
|
699
787
|
[EModelEndpoint.google]: defaultModels[EModelEndpoint.google],
|
|
700
788
|
[EModelEndpoint.anthropic]: defaultModels[EModelEndpoint.anthropic],
|
|
@@ -703,7 +791,6 @@ export const initialModelsConfig: TModelsConfig = {
|
|
|
703
791
|
|
|
704
792
|
export const EndpointURLs: { [key in EModelEndpoint]: string } = {
|
|
705
793
|
[EModelEndpoint.openAI]: `/api/ask/${EModelEndpoint.openAI}`,
|
|
706
|
-
[EModelEndpoint.bingAI]: `/api/ask/${EModelEndpoint.bingAI}`,
|
|
707
794
|
[EModelEndpoint.google]: `/api/ask/${EModelEndpoint.google}`,
|
|
708
795
|
[EModelEndpoint.custom]: `/api/ask/${EModelEndpoint.custom}`,
|
|
709
796
|
[EModelEndpoint.anthropic]: `/api/ask/${EModelEndpoint.anthropic}`,
|
|
@@ -740,9 +827,13 @@ export const supportsBalanceCheck = {
|
|
|
740
827
|
};
|
|
741
828
|
|
|
742
829
|
export const visionModels = [
|
|
743
|
-
'
|
|
830
|
+
'grok-3',
|
|
831
|
+
'grok-2-vision',
|
|
832
|
+
'grok-vision',
|
|
833
|
+
'gpt-4.5',
|
|
744
834
|
'gpt-4o',
|
|
745
835
|
'gpt-4o-mini',
|
|
836
|
+
'o1',
|
|
746
837
|
'gpt-4-turbo',
|
|
747
838
|
'gpt-4-vision',
|
|
748
839
|
'llava',
|
|
@@ -788,7 +879,7 @@ export function validateVisionModel({
|
|
|
788
879
|
return visionModels.concat(additionalModels).some((visionModel) => model.includes(visionModel));
|
|
789
880
|
}
|
|
790
881
|
|
|
791
|
-
export const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion']);
|
|
882
|
+
export const imageGenTools = new Set(['dalle', 'dall-e', 'stable-diffusion', 'flux']);
|
|
792
883
|
|
|
793
884
|
/**
|
|
794
885
|
* Enum for collections using infinite queries
|
|
@@ -891,6 +982,10 @@ export enum CacheKeys {
|
|
|
891
982
|
* Key for in-progress messages.
|
|
892
983
|
*/
|
|
893
984
|
MESSAGES = 'messages',
|
|
985
|
+
/**
|
|
986
|
+
* Key for in-progress flow states.
|
|
987
|
+
*/
|
|
988
|
+
FLOWS = 'flows',
|
|
894
989
|
}
|
|
895
990
|
|
|
896
991
|
/**
|
|
@@ -979,6 +1074,10 @@ export enum ErrorTypes {
|
|
|
979
1074
|
* Invalid request error, API rejected request
|
|
980
1075
|
*/
|
|
981
1076
|
NO_SYSTEM_MESSAGES = 'no_system_messages',
|
|
1077
|
+
/**
|
|
1078
|
+
* Google provider returned an error
|
|
1079
|
+
*/
|
|
1080
|
+
GOOGLE_ERROR = 'google_error',
|
|
982
1081
|
}
|
|
983
1082
|
|
|
984
1083
|
/**
|
|
@@ -1018,6 +1117,7 @@ export enum ImageDetailCost {
|
|
|
1018
1117
|
/**
|
|
1019
1118
|
* Additional Cost added to High Resolution Total Cost
|
|
1020
1119
|
*/
|
|
1120
|
+
// eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values
|
|
1021
1121
|
ADDITIONAL = 85,
|
|
1022
1122
|
}
|
|
1023
1123
|
|
|
@@ -1088,9 +1188,9 @@ export enum TTSProviders {
|
|
|
1088
1188
|
/** Enum for app-wide constants */
|
|
1089
1189
|
export enum Constants {
|
|
1090
1190
|
/** Key for the app's version. */
|
|
1091
|
-
VERSION = 'v0.7.
|
|
1191
|
+
VERSION = 'v0.7.7',
|
|
1092
1192
|
/** Key for the Custom Config's version (librechat.yaml). */
|
|
1093
|
-
CONFIG_VERSION = '1.2.
|
|
1193
|
+
CONFIG_VERSION = '1.2.2',
|
|
1094
1194
|
/** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
|
|
1095
1195
|
NO_PARENT = '00000000-0000-0000-0000-000000000000',
|
|
1096
1196
|
/** Standard value for the initial conversationId before a request is sent */
|
|
@@ -1122,8 +1222,6 @@ export enum LocalStorageKeys {
|
|
|
1122
1222
|
APP_TITLE = 'appTitle',
|
|
1123
1223
|
/** Key for the last conversation setup. */
|
|
1124
1224
|
LAST_CONVO_SETUP = 'lastConversationSetup',
|
|
1125
|
-
/** Key for the last BingAI Settings */
|
|
1126
|
-
LAST_BING = 'lastBingSettings',
|
|
1127
1225
|
/** Key for the last selected model. */
|
|
1128
1226
|
LAST_MODEL = 'lastSelectedModel',
|
|
1129
1227
|
/** Key for the last selected tools. */
|
|
@@ -1160,7 +1258,9 @@ export enum ForkOptions {
|
|
|
1160
1258
|
/** Key for including branches */
|
|
1161
1259
|
INCLUDE_BRANCHES = 'includeBranches',
|
|
1162
1260
|
/** Key for target level fork (default) */
|
|
1163
|
-
TARGET_LEVEL = '',
|
|
1261
|
+
TARGET_LEVEL = 'targetLevel',
|
|
1262
|
+
/** Default option */
|
|
1263
|
+
DEFAULT = 'default',
|
|
1164
1264
|
}
|
|
1165
1265
|
|
|
1166
1266
|
/**
|
|
@@ -1199,6 +1299,6 @@ export enum SystemCategories {
|
|
|
1199
1299
|
export const providerEndpointMap = {
|
|
1200
1300
|
[EModelEndpoint.openAI]: EModelEndpoint.openAI,
|
|
1201
1301
|
[EModelEndpoint.bedrock]: EModelEndpoint.bedrock,
|
|
1202
|
-
[EModelEndpoint.azureOpenAI]: EModelEndpoint.openAI,
|
|
1203
1302
|
[EModelEndpoint.anthropic]: EModelEndpoint.anthropic,
|
|
1303
|
+
[EModelEndpoint.azureOpenAI]: EModelEndpoint.azureOpenAI,
|
|
1204
1304
|
};
|
package/src/createPayload.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { EndpointURLs } from './config';
|
|
|
3
3
|
import * as s from './schemas';
|
|
4
4
|
|
|
5
5
|
export default function createPayload(submission: t.TSubmission) {
|
|
6
|
-
const { conversation, userMessage, endpointOption, isEdited, isContinued } =
|
|
6
|
+
const { conversation, userMessage, endpointOption, isEdited, isContinued, isTemporary } =
|
|
7
|
+
submission;
|
|
7
8
|
const { conversationId } = s.tConvoUpdateSchema.parse(conversation);
|
|
8
9
|
const { endpoint, endpointType } = endpointOption as {
|
|
9
10
|
endpoint: s.EModelEndpoint;
|
|
@@ -23,6 +24,7 @@ export default function createPayload(submission: t.TSubmission) {
|
|
|
23
24
|
...endpointOption,
|
|
24
25
|
isContinued: !!(isEdited && isContinued),
|
|
25
26
|
conversationId,
|
|
27
|
+
isTemporary,
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
return { server, payload };
|