librechat-data-provider 0.7.76 → 0.7.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "librechat-data-provider",
3
- "version": "0.7.76",
3
+ "version": "0.7.77",
4
4
  "description": "data services for librechat apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
package/src/config.ts CHANGED
@@ -1006,6 +1006,10 @@ export enum CacheKeys {
1006
1006
  * Key for in-progress flow states.
1007
1007
  */
1008
1008
  FLOWS = 'flows',
1009
+ /**
1010
+ * Key for s3 check intervals per user
1011
+ */
1012
+ S3_EXPIRY_INTERVAL = 'S3_EXPIRY_INTERVAL',
1009
1013
  }
1010
1014
 
1011
1015
  /**
package/src/mcp.ts CHANGED
@@ -65,6 +65,7 @@ export const WebSocketOptionsSchema = BaseOptionsSchema.extend({
65
65
 
66
66
  export const SSEOptionsSchema = BaseOptionsSchema.extend({
67
67
  type: z.literal('sse').optional(),
68
+ headers: z.record(z.string(), z.string()).optional(),
68
69
  url: z
69
70
  .string()
70
71
  .url()
@@ -92,9 +93,10 @@ export type MCPOptions = z.infer<typeof MCPOptionsSchema>;
92
93
  /**
93
94
  * Recursively processes an object to replace environment variables in string values
94
95
  * @param {MCPOptions} obj - The object to process
96
+ * @param {string} [userId] - The user ID
95
97
  * @returns {MCPOptions} - The processed object with environment variables replaced
96
98
  */
97
- export function processMCPEnv(obj: MCPOptions): MCPOptions {
99
+ export function processMCPEnv(obj: MCPOptions, userId?: string): MCPOptions {
98
100
  if (obj === null || obj === undefined) {
99
101
  return obj;
100
102
  }
@@ -105,6 +107,16 @@ export function processMCPEnv(obj: MCPOptions): MCPOptions {
105
107
  processedEnv[key] = extractEnvVariable(value);
106
108
  }
107
109
  obj.env = processedEnv;
110
+ } else if ('headers' in obj && obj.headers) {
111
+ const processedHeaders: Record<string, string> = {};
112
+ for (const [key, value] of Object.entries(obj.headers)) {
113
+ if (value === '{{LIBRECHAT_USER_ID}}' && userId != null && userId) {
114
+ processedHeaders[key] = userId;
115
+ continue;
116
+ }
117
+ processedHeaders[key] = extractEnvVariable(value);
118
+ }
119
+ obj.headers = processedHeaders;
108
120
  }
109
121
 
110
122
  return obj;
package/src/parsers.ts CHANGED
@@ -375,9 +375,23 @@ export function parseTextParts(contentParts: a.TMessageContentParts[]): string {
375
375
  let result = '';
376
376
 
377
377
  for (const part of contentParts) {
378
+ if (!part.type) {
379
+ continue;
380
+ }
378
381
  if (part.type === ContentTypes.TEXT) {
379
382
  const textValue = typeof part.text === 'string' ? part.text : part.text.value;
380
383
 
384
+ if (
385
+ result.length > 0 &&
386
+ textValue.length > 0 &&
387
+ result[result.length - 1] !== ' ' &&
388
+ textValue[0] !== ' '
389
+ ) {
390
+ result += ' ';
391
+ }
392
+ result += textValue;
393
+ } else if (part.type === ContentTypes.THINK) {
394
+ const textValue = typeof part.think === 'string' ? part.think : '';
381
395
  if (
382
396
  result.length > 0 &&
383
397
  textValue.length > 0 &&
@@ -4,6 +4,7 @@ export enum FileSources {
4
4
  local = 'local',
5
5
  firebase = 'firebase',
6
6
  azure = 'azure',
7
+ azure_blob = 'azure_blob',
7
8
  openai = 'openai',
8
9
  s3 = 's3',
9
10
  vectordb = 'vectordb',