librechat-data-provider 0.7.0 → 0.7.1

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.0",
3
+ "version": "0.7.1",
4
4
  "description": "data services for librechat apps",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -1,6 +1,7 @@
1
1
  import axios from 'axios';
2
2
  import { OpenAPIV3 } from 'openapi-types';
3
3
  import {
4
+ createURL,
4
5
  resolveRef,
5
6
  ActionRequest,
6
7
  openapiToFunction,
@@ -506,3 +507,45 @@ describe('validateAndParseOpenAPISpec', () => {
506
507
  expect(requestBuilders).toHaveProperty('saveCitation');
507
508
  });
508
509
  });
510
+
511
+ describe('createURL', () => {
512
+ it('correctly combines domain and path', () => {
513
+ expect(createURL('https://example.com', '/api/v1/users')).toBe(
514
+ 'https://example.com/api/v1/users',
515
+ );
516
+ });
517
+
518
+ it('handles domain with trailing slash', () => {
519
+ expect(createURL('https://example.com/', '/api/v1/users')).toBe(
520
+ 'https://example.com/api/v1/users',
521
+ );
522
+ });
523
+
524
+ it('handles path with leading slash', () => {
525
+ expect(createURL('https://example.com', 'api/v1/users')).toBe(
526
+ 'https://example.com/api/v1/users',
527
+ );
528
+ });
529
+
530
+ it('handles domain with trailing slash and path with leading slash', () => {
531
+ expect(createURL('https://example.com/', '/api/v1/users')).toBe(
532
+ 'https://example.com/api/v1/users',
533
+ );
534
+ });
535
+
536
+ it('handles domain without trailing slash and path without leading slash', () => {
537
+ expect(createURL('https://example.com', 'api/v1/users')).toBe(
538
+ 'https://example.com/api/v1/users',
539
+ );
540
+ });
541
+
542
+ it('handles empty path', () => {
543
+ expect(createURL('https://example.com', '')).toBe('https://example.com/');
544
+ });
545
+
546
+ it('handles domain with subdirectory', () => {
547
+ expect(createURL('https://example.com/subdirectory', '/api/v1/users')).toBe(
548
+ 'https://example.com/subdirectory/api/v1/users',
549
+ );
550
+ });
551
+ });
package/src/actions.ts CHANGED
@@ -32,8 +32,10 @@ export function sha1(input: string) {
32
32
  }
33
33
 
34
34
  export function createURL(domain: string, path: string) {
35
- const myURL = new URL(path, domain);
36
- return myURL.toString();
35
+ const cleanDomain = domain.replace(/\/$/, '');
36
+ const cleanPath = path.replace(/^\//, '');
37
+ const fullURL = `${cleanDomain}/${cleanPath}`;
38
+ return new URL(fullURL).toString();
37
39
  }
38
40
 
39
41
  export class FunctionSignature {
@@ -92,7 +94,7 @@ export class ActionRequest {
92
94
  private authHeaders: Record<string, string> = {};
93
95
  private authToken?: string;
94
96
 
95
- async setParams(params: object) {
97
+ setParams(params: object) {
96
98
  this.operationHash = sha1(JSON.stringify(params));
97
99
  this.params = params;
98
100
 
package/src/config.ts CHANGED
@@ -814,10 +814,14 @@ export enum Constants {
814
814
  CONFIG_VERSION = '1.1.4',
815
815
  /** Standard value for the first message's `parentMessageId` value, to indicate no parent exists. */
816
816
  NO_PARENT = '00000000-0000-0000-0000-000000000000',
817
+ /** Standard value for the initial conversationId before a request is sent */
818
+ NEW_CONVO = 'new',
817
819
  /** Fixed, encoded domain length for Azure OpenAI Assistants Function name parsing. */
818
820
  ENCODED_DOMAIN_LENGTH = 10,
819
821
  /** Identifier for using current_model in multi-model requests. */
820
822
  CURRENT_MODEL = 'current_model',
823
+ /** Common divider for text values */
824
+ COMMON_DIVIDER = '__',
821
825
  }
822
826
 
823
827
  export enum LocalStorageKeys {
@@ -298,6 +298,8 @@ export const useLoginUserMutation = (): UseMutationResult<
298
298
  onMutate: () => {
299
299
  queryClient.removeQueries();
300
300
  localStorage.removeItem(LocalStorageKeys.LAST_CONVO_SETUP);
301
+ localStorage.removeItem(`${LocalStorageKeys.LAST_CONVO_SETUP}_0`);
302
+ localStorage.removeItem(`${LocalStorageKeys.LAST_CONVO_SETUP}_1`);
301
303
  localStorage.removeItem(LocalStorageKeys.LAST_MODEL);
302
304
  localStorage.removeItem(LocalStorageKeys.LAST_TOOLS);
303
305
  localStorage.removeItem(LocalStorageKeys.FILES_TO_DELETE);
package/src/schemas.ts CHANGED
@@ -286,6 +286,8 @@ export type TMessage = z.input<typeof tMessageSchema> & {
286
286
  plugins?: TResPlugin[];
287
287
  content?: TMessageContentParts[];
288
288
  files?: Partial<TFile>[];
289
+ depth?: number;
290
+ siblingIndex?: number;
289
291
  };
290
292
 
291
293
  export const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {
package/src/types.ts CHANGED
@@ -36,6 +36,9 @@ export type TEndpointOption = {
36
36
  key?: string | null;
37
37
  /* assistant */
38
38
  thread_id?: string;
39
+ /* multi-response stream */
40
+ overrideConvoId?: string;
41
+ overrideUserMessageId?: string;
39
42
  };
40
43
 
41
44
  export type TPayload = Partial<TMessage> &