librechat-data-provider 0.8.300 → 0.8.301

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.
@@ -164,6 +164,25 @@ export const verifyEmail = () => `${BASE_URL}/api/user/verify`;
164
164
  export const loginPage = () => `${BASE_URL}/login`;
165
165
  export const registerPage = () => `${BASE_URL}/register`;
166
166
 
167
+ const REDIRECT_PARAM = 'redirect_to';
168
+ const LOGIN_PATH_RE = /(?:^|\/)login(?:\/|$)/;
169
+
170
+ /**
171
+ * Builds a `/login?redirect_to=...` URL from the given or current location.
172
+ * Returns plain `/login` (no param) when already on a login route to prevent recursive nesting.
173
+ */
174
+ export function buildLoginRedirectUrl(pathname?: string, search?: string, hash?: string): string {
175
+ const p = pathname ?? window.location.pathname;
176
+ if (LOGIN_PATH_RE.test(p)) {
177
+ return `${BASE_URL}/login`;
178
+ }
179
+ const s = search ?? window.location.search;
180
+ const h = hash ?? window.location.hash;
181
+ const currentPath = `${p}${s}${h}`;
182
+ const encoded = encodeURIComponent(currentPath || '/');
183
+ return `${BASE_URL}/login?${REDIRECT_PARAM}=${encoded}`;
184
+ }
185
+
167
186
  export const resendVerificationEmail = () => `${BASE_URL}/api/user/verify/resend`;
168
187
 
169
188
  export const plugins = () => `${BASE_URL}/api/plugins`;
package/src/bedrock.ts CHANGED
@@ -4,6 +4,8 @@ import * as s from './schemas';
4
4
  const DEFAULT_ENABLED_MAX_TOKENS = 8192;
5
5
  const DEFAULT_THINKING_BUDGET = 2000;
6
6
 
7
+ const bedrockReasoningConfigValues = new Set<string>(Object.values(s.BedrockReasoningConfig));
8
+
7
9
  type ThinkingConfig = { type: 'enabled'; budget_tokens: number } | { type: 'adaptive' };
8
10
 
9
11
  type AnthropicReasoning = {
@@ -134,6 +136,7 @@ export const bedrockInputSchema = s.tConversationSchema
134
136
  thinking: true,
135
137
  thinkingBudget: true,
136
138
  effort: true,
139
+ reasoning_effort: true,
137
140
  promptCache: true,
138
141
  /* Catch-all fields */
139
142
  topK: true,
@@ -178,6 +181,7 @@ export const bedrockInputParser = s.tConversationSchema
178
181
  thinking: true,
179
182
  thinkingBudget: true,
180
183
  effort: true,
184
+ reasoning_effort: true,
181
185
  promptCache: true,
182
186
  /* Catch-all fields */
183
187
  topK: true,
@@ -256,6 +260,9 @@ export const bedrockInputParser = s.tConversationSchema
256
260
  delete additionalFields.effort;
257
261
  }
258
262
 
263
+ /** Anthropic uses 'effort' via output_config, not reasoning_config */
264
+ delete additionalFields.reasoning_effort;
265
+
259
266
  if ((typedData.model as string).includes('anthropic.')) {
260
267
  const betaHeaders = getBedrockAnthropicBetaHeaders(typedData.model as string);
261
268
  if (betaHeaders.length > 0) {
@@ -268,23 +275,37 @@ export const bedrockInputParser = s.tConversationSchema
268
275
  delete additionalFields.effort;
269
276
  delete additionalFields.output_config;
270
277
  delete additionalFields.anthropic_beta;
278
+
279
+ const reasoningEffort = additionalFields.reasoning_effort;
280
+ delete additionalFields.reasoning_effort;
281
+ if (
282
+ typeof reasoningEffort === 'string' &&
283
+ bedrockReasoningConfigValues.has(reasoningEffort)
284
+ ) {
285
+ additionalFields.reasoning_config = reasoningEffort;
286
+ }
271
287
  }
272
288
 
273
289
  const isAnthropicModel =
274
290
  typeof typedData.model === 'string' && typedData.model.includes('anthropic.');
275
291
 
276
- /** Strip stale anthropic_beta from previously-persisted additionalModelRequestFields */
292
+ /** Strip stale fields from previously-persisted additionalModelRequestFields */
277
293
  if (
278
- !isAnthropicModel &&
279
294
  typeof typedData.additionalModelRequestFields === 'object' &&
280
295
  typedData.additionalModelRequestFields != null
281
296
  ) {
282
297
  const amrf = typedData.additionalModelRequestFields as Record<string, unknown>;
283
- delete amrf.anthropic_beta;
284
- delete amrf.thinking;
285
- delete amrf.thinkingBudget;
286
- delete amrf.effort;
287
- delete amrf.output_config;
298
+ if (!isAnthropicModel) {
299
+ delete amrf.anthropic_beta;
300
+ delete amrf.thinking;
301
+ delete amrf.thinkingBudget;
302
+ delete amrf.effort;
303
+ delete amrf.output_config;
304
+ delete amrf.reasoning_config;
305
+ } else {
306
+ delete amrf.reasoning_config;
307
+ delete amrf.reasoning_effort;
308
+ }
288
309
  }
289
310
 
290
311
  /** Default promptCache for claude and nova models, if not defined */
package/src/config.ts CHANGED
@@ -820,6 +820,7 @@ export enum OCRStrategy {
820
820
  CUSTOM_OCR = 'custom_ocr',
821
821
  AZURE_MISTRAL_OCR = 'azure_mistral_ocr',
822
822
  VERTEXAI_MISTRAL_OCR = 'vertexai_mistral_ocr',
823
+ DOCUMENT_PARSER = 'document_parser',
823
824
  }
824
825
 
825
826
  export enum SearchCategories {
@@ -1192,6 +1193,13 @@ export const defaultModels = {
1192
1193
  [EModelEndpoint.assistants]: [...sharedOpenAIModels, 'chatgpt-4o-latest'],
1193
1194
  [EModelEndpoint.agents]: sharedOpenAIModels, // TODO: Add agent models (agentsModels)
1194
1195
  [EModelEndpoint.google]: [
1196
+ // Gemini 3.1 Models
1197
+ 'gemini-3.1-pro-preview',
1198
+ 'gemini-3.1-pro-preview-customtools',
1199
+ 'gemini-3.1-flash-lite-preview',
1200
+ // Gemini 3 Models
1201
+ 'gemini-3-pro-preview',
1202
+ 'gemini-3-flash-preview',
1195
1203
  // Gemini 2.5 Models
1196
1204
  'gemini-2.5-pro',
1197
1205
  'gemini-2.5-flash',
@@ -1723,9 +1731,9 @@ export enum TTSProviders {
1723
1731
  /** Enum for app-wide constants */
1724
1732
  export enum Constants {
1725
1733
  /** Key for the app's version. */
1726
- VERSION = 'v0.8.3-rc1',
1734
+ VERSION = 'v0.8.3-rc2',
1727
1735
  /** Key for the Custom Config's version (librechat.yaml). */
1728
- CONFIG_VERSION = '1.3.4',
1736
+ CONFIG_VERSION = '1.3.5',
1729
1737
  /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
1730
1738
  NO_PARENT = '00000000-0000-0000-0000-000000000000',
1731
1739
  /** Standard value to use whatever the submission prelim. `responseMessageId` is */
@@ -3,9 +3,122 @@ import {
3
3
  fileConfig as baseFileConfig,
4
4
  getEndpointFileConfig,
5
5
  mergeFileConfig,
6
+ applicationMimeTypes,
7
+ defaultOCRMimeTypes,
8
+ documentParserMimeTypes,
9
+ supportedMimeTypes,
6
10
  } from './file-config';
7
11
  import { EModelEndpoint } from './schemas';
8
12
 
13
+ describe('applicationMimeTypes', () => {
14
+ const odfTypes = [
15
+ 'application/vnd.oasis.opendocument.text',
16
+ 'application/vnd.oasis.opendocument.spreadsheet',
17
+ 'application/vnd.oasis.opendocument.presentation',
18
+ 'application/vnd.oasis.opendocument.graphics',
19
+ ];
20
+
21
+ it.each(odfTypes)('matches ODF type: %s', (mimeType) => {
22
+ expect(applicationMimeTypes.test(mimeType)).toBe(true);
23
+ });
24
+
25
+ const existingTypes = [
26
+ 'application/pdf',
27
+ 'application/json',
28
+ 'application/csv',
29
+ 'application/msword',
30
+ 'application/xml',
31
+ 'application/zip',
32
+ 'application/epub+zip',
33
+ 'application/x-tar',
34
+ 'application/x-sh',
35
+ 'application/typescript',
36
+ 'application/sql',
37
+ 'application/yaml',
38
+ 'application/x-parquet',
39
+ 'application/vnd.apache.parquet',
40
+ 'application/vnd.coffeescript',
41
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
42
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
43
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
44
+ ];
45
+
46
+ it.each(existingTypes)('matches existing type: %s', (mimeType) => {
47
+ expect(applicationMimeTypes.test(mimeType)).toBe(true);
48
+ });
49
+
50
+ const invalidTypes = [
51
+ 'application/vnd.oasis.opendocument.text-template',
52
+ 'application/vnd.oasis.opendocument.texts',
53
+ 'application/vnd.oasis.opendocument.chart',
54
+ 'application/vnd.oasis.opendocument.formula',
55
+ 'application/vnd.oasis.opendocument.image',
56
+ 'application/vnd.oasis.opendocument.text-master',
57
+ 'text/plain',
58
+ 'image/png',
59
+ ];
60
+
61
+ it.each(invalidTypes)('does not match invalid type: %s', (mimeType) => {
62
+ expect(applicationMimeTypes.test(mimeType)).toBe(false);
63
+ });
64
+ });
65
+
66
+ describe('defaultOCRMimeTypes', () => {
67
+ const checkOCRType = (mimeType: string): boolean =>
68
+ defaultOCRMimeTypes.some((regex) => regex.test(mimeType));
69
+
70
+ it.each([
71
+ 'application/vnd.oasis.opendocument.text',
72
+ 'application/vnd.oasis.opendocument.spreadsheet',
73
+ 'application/vnd.oasis.opendocument.presentation',
74
+ 'application/vnd.oasis.opendocument.graphics',
75
+ ])('matches ODF type for OCR: %s', (mimeType) => {
76
+ expect(checkOCRType(mimeType)).toBe(true);
77
+ });
78
+ });
79
+
80
+ describe('supportedMimeTypes', () => {
81
+ const checkSupported = (mimeType: string): boolean =>
82
+ supportedMimeTypes.some((regex) => regex.test(mimeType));
83
+
84
+ it.each([
85
+ 'application/vnd.oasis.opendocument.text',
86
+ 'application/vnd.oasis.opendocument.spreadsheet',
87
+ 'application/vnd.oasis.opendocument.presentation',
88
+ 'application/vnd.oasis.opendocument.graphics',
89
+ ])('ODF type flows through supportedMimeTypes: %s', (mimeType) => {
90
+ expect(checkSupported(mimeType)).toBe(true);
91
+ });
92
+ });
93
+
94
+ describe('documentParserMimeTypes', () => {
95
+ const check = (mimeType: string): boolean =>
96
+ documentParserMimeTypes.some((regex) => regex.test(mimeType));
97
+
98
+ it.each([
99
+ 'application/pdf',
100
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
101
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
102
+ 'application/vnd.ms-excel',
103
+ 'application/msexcel',
104
+ 'application/x-msexcel',
105
+ 'application/x-ms-excel',
106
+ 'application/vnd.oasis.opendocument.spreadsheet',
107
+ ])('matches natively parseable type: %s', (mimeType) => {
108
+ expect(check(mimeType)).toBe(true);
109
+ });
110
+
111
+ it.each([
112
+ 'application/vnd.oasis.opendocument.text',
113
+ 'application/vnd.oasis.opendocument.presentation',
114
+ 'application/vnd.oasis.opendocument.graphics',
115
+ 'text/plain',
116
+ 'image/png',
117
+ ])('does not match OCR-only or unsupported type: %s', (mimeType) => {
118
+ expect(check(mimeType)).toBe(false);
119
+ });
120
+ });
121
+
9
122
  describe('getEndpointFileConfig', () => {
10
123
  describe('custom endpoint lookup', () => {
11
124
  it('should find custom endpoint by direct lookup', () => {
@@ -61,6 +61,10 @@ export const fullMimeTypesList = [
61
61
  'application/xml',
62
62
  'application/zip',
63
63
  'application/x-parquet',
64
+ 'application/vnd.oasis.opendocument.text',
65
+ 'application/vnd.oasis.opendocument.spreadsheet',
66
+ 'application/vnd.oasis.opendocument.presentation',
67
+ 'application/vnd.oasis.opendocument.graphics',
64
68
  'image/svg',
65
69
  'image/svg+xml',
66
70
  // Video formats
@@ -139,6 +143,39 @@ export const retrievalMimeTypesList = [
139
143
 
140
144
  export const imageExtRegex = /\.(jpg|jpeg|png|gif|webp|heic|heif)$/i;
141
145
 
146
+ /** @see https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html */
147
+ export type BedrockDocumentFormat =
148
+ | 'pdf'
149
+ | 'csv'
150
+ | 'doc'
151
+ | 'docx'
152
+ | 'xls'
153
+ | 'xlsx'
154
+ | 'html'
155
+ | 'txt'
156
+ | 'md';
157
+
158
+ /** Maps MIME types to Bedrock Converse API document format values */
159
+ export const bedrockDocumentFormats: Record<string, BedrockDocumentFormat> = {
160
+ 'application/pdf': 'pdf',
161
+ 'text/csv': 'csv',
162
+ 'application/csv': 'csv',
163
+ 'application/msword': 'doc',
164
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
165
+ 'application/vnd.ms-excel': 'xls',
166
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
167
+ 'text/html': 'html',
168
+ 'text/plain': 'txt',
169
+ 'text/markdown': 'md',
170
+ };
171
+
172
+ export const isBedrockDocumentType = (mimeType?: string): boolean =>
173
+ mimeType != null && mimeType in bedrockDocumentFormats;
174
+
175
+ /** File extensions accepted by Bedrock document uploads (for input accept attributes) */
176
+ export const bedrockDocumentExtensions =
177
+ '.pdf,.csv,.doc,.docx,.xls,.xlsx,.html,.htm,.txt,.md,application/pdf,text/csv,application/csv,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,text/html,text/plain,text/markdown';
178
+
142
179
  export const excelMimeTypes =
143
180
  /^application\/(vnd\.ms-excel|msexcel|x-msexcel|x-ms-excel|x-excel|x-dos_ms_excel|xls|x-xls|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet)$/;
144
181
 
@@ -146,7 +183,7 @@ export const textMimeTypes =
146
183
  /^(text\/(x-c|x-csharp|tab-separated-values|x-c\+\+|x-h|x-java|html|markdown|x-php|x-python|x-script\.python|x-ruby|x-tex|plain|css|vtt|javascript|csv|xml))$/;
147
184
 
148
185
  export const applicationMimeTypes =
149
- /^(application\/(epub\+zip|csv|json|pdf|x-tar|x-sh|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|xml|zip))$/;
186
+ /^(application\/(epub\+zip|csv|json|msword|pdf|x-tar|x-sh|typescript|sql|yaml|x-parquet|vnd\.apache\.parquet|vnd\.coffeescript|vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)|vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)|xml|zip))$/;
150
187
 
151
188
  export const imageMimeTypes = /^image\/(jpeg|gif|png|webp|heic|heif)$/;
152
189
 
@@ -157,10 +194,20 @@ export const videoMimeTypes = /^video\/(mp4|avi|mov|wmv|flv|webm|mkv|m4v|3gp|ogv
157
194
 
158
195
  export const defaultOCRMimeTypes = [
159
196
  imageMimeTypes,
197
+ excelMimeTypes,
160
198
  /^application\/pdf$/,
161
- /^application\/vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation|spreadsheetml\.sheet)$/,
162
- /^application\/vnd\.ms-(word|powerpoint|excel)$/,
199
+ /^application\/vnd\.openxmlformats-officedocument\.(wordprocessingml\.document|presentationml\.presentation)$/,
200
+ /^application\/vnd\.ms-(word|powerpoint)$/,
163
201
  /^application\/epub\+zip$/,
202
+ /^application\/vnd\.oasis\.opendocument\.(text|spreadsheet|presentation|graphics)$/,
203
+ ];
204
+
205
+ /** MIME types handled by the built-in document parser (pdf, docx, excel variants, ods) */
206
+ export const documentParserMimeTypes = [
207
+ excelMimeTypes,
208
+ /^application\/pdf$/,
209
+ /^application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document$/,
210
+ /^application\/vnd\.oasis\.opendocument\.spreadsheet$/,
164
211
  ];
165
212
 
166
213
  export const defaultTextMimeTypes = [/^[\w.-]+\/[\w.-]+$/];
@@ -298,6 +345,10 @@ export const codeTypeMapping: { [key: string]: string } = {
298
345
  tcl: 'text/plain', // .tcl - Tcl source
299
346
  awk: 'text/plain', // .awk - AWK script
300
347
  sed: 'text/plain', // .sed - Sed script
348
+ odt: 'application/vnd.oasis.opendocument.text', // .odt - OpenDocument Text
349
+ ods: 'application/vnd.oasis.opendocument.spreadsheet', // .ods - OpenDocument Spreadsheet
350
+ odp: 'application/vnd.oasis.opendocument.presentation', // .odp - OpenDocument Presentation
351
+ odg: 'application/vnd.oasis.opendocument.graphics', // .odg - OpenDocument Graphics
301
352
  };
302
353
 
303
354
  /** Maps image extensions to MIME types for formats browsers may not recognize */
@@ -4,6 +4,10 @@ export function setAcceptLanguageHeader(value: string): void {
4
4
  axios.defaults.headers.common['Accept-Language'] = value;
5
5
  }
6
6
 
7
- export function setTokenHeader(token: string) {
8
- axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
7
+ export function setTokenHeader(token: string | undefined) {
8
+ if (token === undefined) {
9
+ delete axios.defaults.headers.common['Authorization'];
10
+ } else {
11
+ axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
12
+ }
9
13
  }
package/src/index.ts CHANGED
@@ -34,7 +34,7 @@ export * from './accessPermissions';
34
34
  export * from './keys';
35
35
  /* api call helpers */
36
36
  export * from './headers-helpers';
37
- export { loginPage, registerPage, apiBaseUrl } from './api-endpoints';
37
+ export { loginPage, registerPage, apiBaseUrl, buildLoginRedirectUrl } from './api-endpoints';
38
38
  export { default as request } from './request';
39
39
  export { dataService };
40
40
  import * as dataService from './data-service';
package/src/mcp.ts CHANGED
@@ -19,6 +19,8 @@ const BaseOptionsSchema = z.object({
19
19
  startup: z.boolean().optional(),
20
20
  iconPath: z.string().optional(),
21
21
  timeout: z.number().optional(),
22
+ /** Timeout (ms) for the long-lived SSE GET stream body before undici aborts it. Default: 300_000 (5 min). */
23
+ sseReadTimeout: z.number().positive().optional(),
22
24
  initTimeout: z.number().optional(),
23
25
  /** Controls visibility in chat dropdown menu (MCPSelect) */
24
26
  chatMenu: z.boolean().optional(),
@@ -212,6 +214,7 @@ const omitServerManagedFields = <T extends z.ZodObject<z.ZodRawShape>>(schema: T
212
214
  schema.omit({
213
215
  startup: true,
214
216
  timeout: true,
217
+ sseReadTimeout: true,
215
218
  initTimeout: true,
216
219
  chatMenu: true,
217
220
  serverInstructions: true,
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Verbosity,
3
3
  ImageDetail,
4
+ ThinkingLevel,
4
5
  EModelEndpoint,
5
6
  openAISettings,
6
7
  googleSettings,
@@ -530,6 +531,30 @@ const bedrock: Record<string, SettingDefinition> = {
530
531
  showDefault: false,
531
532
  columnSpan: 2,
532
533
  },
534
+ reasoning_effort: {
535
+ key: 'reasoning_effort',
536
+ label: 'com_endpoint_reasoning_effort',
537
+ labelCode: true,
538
+ description: 'com_endpoint_bedrock_reasoning_effort',
539
+ descriptionCode: true,
540
+ type: 'enum',
541
+ default: ReasoningEffort.unset,
542
+ component: 'slider',
543
+ options: [
544
+ ReasoningEffort.unset,
545
+ ReasoningEffort.low,
546
+ ReasoningEffort.medium,
547
+ ReasoningEffort.high,
548
+ ],
549
+ enumMappings: {
550
+ [ReasoningEffort.unset]: 'com_ui_off',
551
+ [ReasoningEffort.low]: 'com_ui_low',
552
+ [ReasoningEffort.medium]: 'com_ui_medium',
553
+ [ReasoningEffort.high]: 'com_ui_high',
554
+ },
555
+ optionType: 'model',
556
+ columnSpan: 4,
557
+ },
533
558
  };
534
559
 
535
560
  const mistral: Record<string, SettingDefinition> = {
@@ -648,6 +673,32 @@ const google: Record<string, SettingDefinition> = {
648
673
  optionType: 'conversation',
649
674
  columnSpan: 2,
650
675
  },
676
+ thinkingLevel: {
677
+ key: 'thinkingLevel',
678
+ label: 'com_endpoint_thinking_level',
679
+ labelCode: true,
680
+ description: 'com_endpoint_google_thinking_level',
681
+ descriptionCode: true,
682
+ type: 'enum',
683
+ default: ThinkingLevel.unset,
684
+ component: 'slider',
685
+ options: [
686
+ ThinkingLevel.unset,
687
+ ThinkingLevel.minimal,
688
+ ThinkingLevel.low,
689
+ ThinkingLevel.medium,
690
+ ThinkingLevel.high,
691
+ ],
692
+ enumMappings: {
693
+ [ThinkingLevel.unset]: 'com_ui_auto',
694
+ [ThinkingLevel.minimal]: 'com_ui_minimal',
695
+ [ThinkingLevel.low]: 'com_ui_low',
696
+ [ThinkingLevel.medium]: 'com_ui_medium',
697
+ [ThinkingLevel.high]: 'com_ui_high',
698
+ },
699
+ optionType: 'conversation',
700
+ columnSpan: 4,
701
+ },
651
702
  web_search: {
652
703
  key: 'web_search',
653
704
  label: 'com_endpoint_use_search_grounding',
@@ -674,6 +725,7 @@ const googleConfig: SettingsConfiguration = [
674
725
  librechat.resendFiles,
675
726
  google.thinking,
676
727
  google.thinkingBudget,
728
+ google.thinkingLevel,
677
729
  google.web_search,
678
730
  librechat.fileTokenLimit,
679
731
  ];
@@ -693,6 +745,7 @@ const googleCol2: SettingsConfiguration = [
693
745
  librechat.resendFiles,
694
746
  google.thinking,
695
747
  google.thinkingBudget,
748
+ google.thinkingLevel,
696
749
  google.web_search,
697
750
  librechat.fileTokenLimit,
698
751
  ];
@@ -905,6 +958,34 @@ const bedrockGeneralCol2: SettingsConfiguration = [
905
958
  librechat.fileTokenLimit,
906
959
  ];
907
960
 
961
+ const bedrockZAI: SettingsConfiguration = [
962
+ librechat.modelLabel,
963
+ librechat.promptPrefix,
964
+ librechat.maxContextTokens,
965
+ meta.temperature,
966
+ meta.topP,
967
+ librechat.resendFiles,
968
+ bedrock.region,
969
+ bedrock.reasoning_effort,
970
+ librechat.fileTokenLimit,
971
+ ];
972
+
973
+ const bedrockZAICol1: SettingsConfiguration = [
974
+ baseDefinitions.model as SettingDefinition,
975
+ librechat.modelLabel,
976
+ librechat.promptPrefix,
977
+ ];
978
+
979
+ const bedrockZAICol2: SettingsConfiguration = [
980
+ librechat.maxContextTokens,
981
+ meta.temperature,
982
+ meta.topP,
983
+ librechat.resendFiles,
984
+ bedrock.region,
985
+ bedrock.reasoning_effort,
986
+ librechat.fileTokenLimit,
987
+ ];
988
+
908
989
  const bedrockMoonshot: SettingsConfiguration = [
909
990
  librechat.modelLabel,
910
991
  bedrock.system,
@@ -917,6 +998,7 @@ const bedrockMoonshot: SettingsConfiguration = [
917
998
  baseDefinitions.stop,
918
999
  librechat.resendFiles,
919
1000
  bedrock.region,
1001
+ bedrock.reasoning_effort,
920
1002
  librechat.fileTokenLimit,
921
1003
  ];
922
1004
 
@@ -936,6 +1018,7 @@ const bedrockMoonshotCol2: SettingsConfiguration = [
936
1018
  bedrock.topP,
937
1019
  librechat.resendFiles,
938
1020
  bedrock.region,
1021
+ bedrock.reasoning_effort,
939
1022
  librechat.fileTokenLimit,
940
1023
  ];
941
1024
 
@@ -954,7 +1037,7 @@ export const paramSettings: Record<string, SettingsConfiguration | undefined> =
954
1037
  [`${EModelEndpoint.bedrock}-${BedrockProviders.Moonshot}`]: bedrockMoonshot,
955
1038
  [`${EModelEndpoint.bedrock}-${BedrockProviders.MoonshotAI}`]: bedrockMoonshot,
956
1039
  [`${EModelEndpoint.bedrock}-${BedrockProviders.OpenAI}`]: bedrockGeneral,
957
- [`${EModelEndpoint.bedrock}-${BedrockProviders.ZAI}`]: bedrockGeneral,
1040
+ [`${EModelEndpoint.bedrock}-${BedrockProviders.ZAI}`]: bedrockZAI,
958
1041
  [EModelEndpoint.google]: googleConfig,
959
1042
  };
960
1043
 
@@ -1008,7 +1091,10 @@ export const presetSettings: Record<
1008
1091
  col2: bedrockMoonshotCol2,
1009
1092
  },
1010
1093
  [`${EModelEndpoint.bedrock}-${BedrockProviders.OpenAI}`]: bedrockGeneralColumns,
1011
- [`${EModelEndpoint.bedrock}-${BedrockProviders.ZAI}`]: bedrockGeneralColumns,
1094
+ [`${EModelEndpoint.bedrock}-${BedrockProviders.ZAI}`]: {
1095
+ col1: bedrockZAICol1,
1096
+ col2: bedrockZAICol2,
1097
+ },
1012
1098
  [EModelEndpoint.google]: {
1013
1099
  col1: googleCol1,
1014
1100
  col2: googleCol2,
package/src/parsers.ts CHANGED
@@ -408,16 +408,16 @@ export function replaceSpecialVars({ text, user }: { text: string; user?: t.TUse
408
408
  return result;
409
409
  }
410
410
 
411
- // e.g., "2024-04-29 (1)" (1=Monday)
412
- const currentDate = dayjs().format('YYYY-MM-DD');
413
- const dayNumber = dayjs().day();
414
- const combinedDate = `${currentDate} (${dayNumber})`;
415
- result = result.replace(/{{current_date}}/gi, combinedDate);
411
+ const now = dayjs();
412
+ const weekdayName = now.format('dddd');
416
413
 
417
- const currentDatetime = dayjs().format('YYYY-MM-DD HH:mm:ss');
418
- result = result.replace(/{{current_datetime}}/gi, `${currentDatetime} (${dayNumber})`);
414
+ const currentDate = now.format('YYYY-MM-DD');
415
+ result = result.replace(/{{current_date}}/gi, `${currentDate} (${weekdayName})`);
419
416
 
420
- const isoDatetime = dayjs().toISOString();
417
+ const currentDatetime = now.format('YYYY-MM-DD HH:mm:ss Z');
418
+ result = result.replace(/{{current_datetime}}/gi, `${currentDatetime} (${weekdayName})`);
419
+
420
+ const isoDatetime = now.toISOString();
421
421
  result = result.replace(/{{iso_datetime}}/gi, isoDatetime);
422
422
 
423
423
  if (user && user.name) {
package/src/request.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import axios, { AxiosError, AxiosRequestConfig } from 'axios';
3
- import * as endpoints from './api-endpoints';
4
3
  import { setTokenHeader } from './headers-helpers';
4
+ import * as endpoints from './api-endpoints';
5
5
  import type * as t from './types';
6
6
 
7
7
  async function _get<T>(url: string, options?: AxiosRequestConfig): Promise<T> {
@@ -99,6 +99,15 @@ if (typeof window !== 'undefined') {
99
99
  return Promise.reject(error);
100
100
  }
101
101
 
102
+ /** Skip refresh when the Authorization header has been cleared (e.g. during logout),
103
+ * but allow shared link requests to proceed so auth recovery/redirect can happen */
104
+ if (
105
+ !axios.defaults.headers.common['Authorization'] &&
106
+ !window.location.pathname.startsWith('/share/')
107
+ ) {
108
+ return Promise.reject(error);
109
+ }
110
+
102
111
  if (error.response.status === 401 && !originalRequest._retry) {
103
112
  console.warn('401 error, refreshing token');
104
113
  originalRequest._retry = true;
@@ -130,12 +139,9 @@ if (typeof window !== 'undefined') {
130
139
  dispatchTokenUpdatedEvent(token);
131
140
  processQueue(null, token);
132
141
  return await axios(originalRequest);
133
- } else if (window.location.href.includes('share/')) {
134
- console.log(
135
- `Refresh token failed from shared link, attempting request to ${originalRequest.url}`,
136
- );
137
142
  } else {
138
- window.location.href = endpoints.loginPage();
143
+ processQueue(error, null);
144
+ window.location.href = endpoints.buildLoginRedirectUrl();
139
145
  }
140
146
  } catch (err) {
141
147
  processQueue(err as AxiosError, null);