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/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/package.json +1 -1
- package/specs/actions.spec.ts +43 -0
- package/src/actions.ts +5 -3
- package/src/config.ts +4 -0
- package/src/react-query/react-query-service.ts +2 -0
- package/src/schemas.ts +2 -0
- package/src/types.ts +3 -0
package/package.json
CHANGED
package/specs/actions.spec.ts
CHANGED
|
@@ -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
|
|
36
|
-
|
|
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
|
-
|
|
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