@memori.ai/memori-api-client 5.3.1 → 5.4.0
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/CHANGELOG.md +7 -0
- package/dist/backend/asset.d.ts +3 -0
- package/dist/backend/asset.js +4 -0
- package/dist/backend/asset.js.map +1 -1
- package/dist/backend/completionConfig.d.ts +7 -1
- package/dist/backend/completionConfig.js.map +1 -1
- package/dist/backend/tenant.d.ts +17 -0
- package/dist/backend/tenant.js +25 -0
- package/dist/backend/tenant.js.map +1 -0
- package/dist/backend/tenant.test.d.ts +1 -0
- package/dist/backend/tenant.test.js +14 -0
- package/dist/backend/tenant.test.js.map +1 -0
- package/dist/backend/user.d.ts +1 -4
- package/dist/backend/user.js +0 -3
- package/dist/backend/user.js.map +1 -1
- package/dist/backend.d.ts +48 -8
- package/dist/backend.js +3 -0
- package/dist/backend.js.map +1 -1
- package/dist/engine/nlp.d.ts +9 -0
- package/dist/engine/nlp.js +15 -0
- package/dist/engine/nlp.js.map +1 -1
- package/dist/engine/stats.d.ts +3 -0
- package/dist/engine/stats.js +4 -0
- package/dist/engine/stats.js.map +1 -1
- package/dist/engine.d.ts +24 -0
- package/dist/index.d.ts +72 -8
- package/esm/backend/asset.d.ts +3 -0
- package/esm/backend/asset.js +4 -0
- package/esm/backend/asset.js.map +1 -1
- package/esm/backend/completionConfig.d.ts +7 -1
- package/esm/backend/completionConfig.js.map +1 -1
- package/esm/backend/tenant.d.ts +17 -0
- package/esm/backend/tenant.js +23 -0
- package/esm/backend/tenant.js.map +1 -0
- package/esm/backend/tenant.test.d.ts +1 -0
- package/esm/backend/tenant.test.js +11 -0
- package/esm/backend/tenant.test.js.map +1 -0
- package/esm/backend/user.d.ts +1 -4
- package/esm/backend/user.js +0 -3
- package/esm/backend/user.js.map +1 -1
- package/esm/backend.d.ts +48 -8
- package/esm/backend.js +3 -0
- package/esm/backend.js.map +1 -1
- package/esm/engine/nlp.d.ts +9 -0
- package/esm/engine/nlp.js +15 -0
- package/esm/engine/nlp.js.map +1 -1
- package/esm/engine/stats.d.ts +3 -0
- package/esm/engine/stats.js +4 -0
- package/esm/engine/stats.js.map +1 -1
- package/esm/engine.d.ts +24 -0
- package/esm/index.d.ts +72 -8
- package/package.json +1 -1
- package/src/backend/asset.ts +11 -0
- package/src/backend/completionConfig.ts +14 -2
- package/src/backend/tenant.test.ts +17 -0
- package/src/backend/tenant.ts +74 -0
- package/src/backend/user.ts +0 -13
- package/src/backend.ts +3 -0
- package/src/engine/nlp.ts +66 -0
- package/src/engine/stats.ts +15 -0
package/esm/index.d.ts
CHANGED
|
@@ -311,6 +311,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
311
311
|
getIntentEventLogs: (sessionId: string, intentId: string, strDateFrom: string, strDateTo: string) => Promise<import("./types").ResponseSpec & {
|
|
312
312
|
eventLogs: import("./types").EventLog[];
|
|
313
313
|
}>;
|
|
314
|
+
getSessionEventLogs: (sessionID: string, eventLogSessionID: string) => Promise<import("./types").ResponseSpec & {
|
|
315
|
+
eventLogs: import("./types").EventLog[];
|
|
316
|
+
}>;
|
|
314
317
|
stats: {
|
|
315
318
|
getTextQualityIndexes: (sessionId: string) => Promise<import("./types").ResponseSpec & {
|
|
316
319
|
textQualityIndex: number;
|
|
@@ -327,6 +330,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
327
330
|
getIntentEventLogs: (sessionId: string, intentId: string, strDateFrom: string, strDateTo: string) => Promise<import("./types").ResponseSpec & {
|
|
328
331
|
eventLogs: import("./types").EventLog[];
|
|
329
332
|
}>;
|
|
333
|
+
getSessionEventLogs: (sessionID: string, eventLogSessionID: string) => Promise<import("./types").ResponseSpec & {
|
|
334
|
+
eventLogs: import("./types").EventLog[];
|
|
335
|
+
}>;
|
|
330
336
|
};
|
|
331
337
|
initSession: (params: import("./types").OpenSession) => Promise<import("./types").ResponseSpec & {
|
|
332
338
|
sessionID: string;
|
|
@@ -444,6 +450,15 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
444
450
|
checkWords: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
445
451
|
undefinedWords: string[];
|
|
446
452
|
}>;
|
|
453
|
+
suggestAnswer: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
454
|
+
answer: string;
|
|
455
|
+
}>;
|
|
456
|
+
suggestTags: (sessionId: string, question: string, answer: string, questionVariants?: string[] | undefined) => Promise<import("./types").ResponseSpec & {
|
|
457
|
+
tags: string[];
|
|
458
|
+
}>;
|
|
459
|
+
suggestQuestions: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
460
|
+
questions: string[];
|
|
461
|
+
}>;
|
|
447
462
|
nlp: {
|
|
448
463
|
getWordVector: (sessionId: string, word: string) => Promise<import("./types").ResponseSpec & {
|
|
449
464
|
vector: number[];
|
|
@@ -463,6 +478,15 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
463
478
|
checkWords: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
464
479
|
undefinedWords: string[];
|
|
465
480
|
}>;
|
|
481
|
+
suggestAnswer: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
482
|
+
answer: string;
|
|
483
|
+
}>;
|
|
484
|
+
suggestTags: (sessionId: string, question: string, answer: string, questionVariants?: string[] | undefined) => Promise<import("./types").ResponseSpec & {
|
|
485
|
+
tags: string[];
|
|
486
|
+
}>;
|
|
487
|
+
suggestQuestions: (sessionId: string, text: string) => Promise<import("./types").ResponseSpec & {
|
|
488
|
+
questions: string[];
|
|
489
|
+
}>;
|
|
466
490
|
};
|
|
467
491
|
getMemories: (sessionId: string, type?: "ALL" | "CONTENTS" | "DEFAULTS" | "DRAFTS" | "EXPERT_REFERENCES" | undefined) => Promise<import("./types").ResponseSpec & {
|
|
468
492
|
memories: import("./types").Memory[];
|
|
@@ -685,6 +709,19 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
685
709
|
deleteCorrelationPair: (sessionId: string, pairId: string) => Promise<import("./types").ResponseSpec>;
|
|
686
710
|
};
|
|
687
711
|
backend: {
|
|
712
|
+
healthCheck: () => Promise<import("./types").ResponseSpec>;
|
|
713
|
+
getTenantConfig: (tenantName: string) => Promise<import("./types").ResponseSpec & {
|
|
714
|
+
tenant: import("./types").TenantBase;
|
|
715
|
+
}>;
|
|
716
|
+
getTenantList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
717
|
+
tenants: import("./types").TenantBase[];
|
|
718
|
+
}>;
|
|
719
|
+
createTenant: (authToken: string, name: string, tenant: Partial<import("./types").TenantBase>) => Promise<import("./types").ResponseSpec & {
|
|
720
|
+
tenant: import("./types").TenantBase;
|
|
721
|
+
}>;
|
|
722
|
+
patchTenant: (authToken: string, name: string, tenant: Partial<import("./types").TenantBase>) => Promise<import("./types").ResponseSpec & {
|
|
723
|
+
tenant: import("./types").TenantBase;
|
|
724
|
+
}>;
|
|
688
725
|
postOutcome: (authToken: string, outcomeCode: string) => Promise<import("./types").ResponseSpec>;
|
|
689
726
|
getUserBadges: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
690
727
|
badges: import("./types").Badge[];
|
|
@@ -700,12 +737,18 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
700
737
|
}>;
|
|
701
738
|
updateCompletionConfig: (authToken: string, config: Partial<import("./types").CompletionConfig> & {
|
|
702
739
|
completionConfigID: string;
|
|
703
|
-
}) => Promise<import("./types").ResponseSpec
|
|
740
|
+
}) => Promise<import("./types").ResponseSpec & {
|
|
741
|
+
config: import("./types").CompletionConfig;
|
|
742
|
+
appliedMemoriIDs?: string[] | undefined;
|
|
743
|
+
appliedMemoriNames?: string[] | undefined;
|
|
744
|
+
}>;
|
|
704
745
|
deleteCompletionConfig: (authToken: string, configID: string) => Promise<import("./types").ResponseSpec>;
|
|
705
746
|
createCompletionConfig: (authToken: string, config: import("./types").CompletionConfig & {
|
|
706
747
|
completionConfigID?: string | undefined;
|
|
707
748
|
}) => Promise<import("./types").ResponseSpec & {
|
|
708
749
|
config: import("./types").CompletionConfig;
|
|
750
|
+
appliedMemoriIDs?: string[] | undefined;
|
|
751
|
+
appliedMemoriNames?: string[] | undefined;
|
|
709
752
|
}>;
|
|
710
753
|
analyzeUserQuery: (authToken: string, memoriID: string, params: import("./types").AnalysisParams) => Promise<import("./types").ResponseSpec & {
|
|
711
754
|
status: import("./types").AnalysisStatus;
|
|
@@ -832,9 +875,6 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
832
875
|
flowID?: string | undefined;
|
|
833
876
|
}>;
|
|
834
877
|
recoverUsername: (user: import("./types").User) => Promise<import("./types").ResponseSpec>;
|
|
835
|
-
getTenantConfig: (tenantName: string) => Promise<import("./types").ResponseSpec & {
|
|
836
|
-
tenant: import("./types").Tenant;
|
|
837
|
-
}>;
|
|
838
878
|
resendVerificationCode: (user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec>;
|
|
839
879
|
createUser: (authToken: string, user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec & {
|
|
840
880
|
user: import("./types").User;
|
|
@@ -900,6 +940,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
900
940
|
asset: import("./types").Asset;
|
|
901
941
|
}>;
|
|
902
942
|
getAsset: (fileName: string, sessionID: string) => Promise<any>;
|
|
943
|
+
getAssetList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
944
|
+
assets: import("./types").Asset[];
|
|
945
|
+
}>;
|
|
903
946
|
updateAsset: (authToken: string, assetURL: string, asset: import("./types").Asset) => Promise<import("./types").ResponseSpec & {
|
|
904
947
|
asset: import("./types").Asset;
|
|
905
948
|
}>;
|
|
@@ -910,6 +953,9 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
910
953
|
asset: import("./types").Asset;
|
|
911
954
|
}>;
|
|
912
955
|
getAsset: (fileName: string, sessionID: string) => Promise<any>;
|
|
956
|
+
getAssetList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
957
|
+
assets: import("./types").Asset[];
|
|
958
|
+
}>;
|
|
913
959
|
updateAsset: (authToken: string, assetURL: string, asset: import("./types").Asset) => Promise<import("./types").ResponseSpec & {
|
|
914
960
|
asset: import("./types").Asset;
|
|
915
961
|
}>;
|
|
@@ -1011,9 +1057,6 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1011
1057
|
flowID?: string | undefined;
|
|
1012
1058
|
}>;
|
|
1013
1059
|
recoverUsername: (user: import("./types").User) => Promise<import("./types").ResponseSpec>;
|
|
1014
|
-
getTenantConfig: (tenantName: string) => Promise<import("./types").ResponseSpec & {
|
|
1015
|
-
tenant: import("./types").Tenant;
|
|
1016
|
-
}>;
|
|
1017
1060
|
resendVerificationCode: (user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec>;
|
|
1018
1061
|
createUser: (authToken: string, user: Partial<import("./types").User>) => Promise<import("./types").ResponseSpec & {
|
|
1019
1062
|
user: import("./types").User;
|
|
@@ -1130,12 +1173,18 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1130
1173
|
}>;
|
|
1131
1174
|
updateCompletionConfig: (authToken: string, config: Partial<import("./types").CompletionConfig> & {
|
|
1132
1175
|
completionConfigID: string;
|
|
1133
|
-
}) => Promise<import("./types").ResponseSpec
|
|
1176
|
+
}) => Promise<import("./types").ResponseSpec & {
|
|
1177
|
+
config: import("./types").CompletionConfig;
|
|
1178
|
+
appliedMemoriIDs?: string[] | undefined;
|
|
1179
|
+
appliedMemoriNames?: string[] | undefined;
|
|
1180
|
+
}>;
|
|
1134
1181
|
deleteCompletionConfig: (authToken: string, configID: string) => Promise<import("./types").ResponseSpec>;
|
|
1135
1182
|
createCompletionConfig: (authToken: string, config: import("./types").CompletionConfig & {
|
|
1136
1183
|
completionConfigID?: string | undefined;
|
|
1137
1184
|
}) => Promise<import("./types").ResponseSpec & {
|
|
1138
1185
|
config: import("./types").CompletionConfig;
|
|
1186
|
+
appliedMemoriIDs?: string[] | undefined;
|
|
1187
|
+
appliedMemoriNames?: string[] | undefined;
|
|
1139
1188
|
}>;
|
|
1140
1189
|
};
|
|
1141
1190
|
badge: {
|
|
@@ -1147,6 +1196,21 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
1147
1196
|
badge: import("./types").Badge;
|
|
1148
1197
|
}>;
|
|
1149
1198
|
};
|
|
1199
|
+
tenant: {
|
|
1200
|
+
healthCheck: () => Promise<import("./types").ResponseSpec>;
|
|
1201
|
+
getTenantConfig: (tenantName: string) => Promise<import("./types").ResponseSpec & {
|
|
1202
|
+
tenant: import("./types").TenantBase;
|
|
1203
|
+
}>;
|
|
1204
|
+
getTenantList: (authToken: string) => Promise<import("./types").ResponseSpec & {
|
|
1205
|
+
tenants: import("./types").TenantBase[];
|
|
1206
|
+
}>;
|
|
1207
|
+
createTenant: (authToken: string, name: string, tenant: Partial<import("./types").TenantBase>) => Promise<import("./types").ResponseSpec & {
|
|
1208
|
+
tenant: import("./types").TenantBase;
|
|
1209
|
+
}>;
|
|
1210
|
+
patchTenant: (authToken: string, name: string, tenant: Partial<import("./types").TenantBase>) => Promise<import("./types").ResponseSpec & {
|
|
1211
|
+
tenant: import("./types").TenantBase;
|
|
1212
|
+
}>;
|
|
1213
|
+
};
|
|
1150
1214
|
};
|
|
1151
1215
|
};
|
|
1152
1216
|
export default api;
|
package/package.json
CHANGED
package/src/backend/asset.ts
CHANGED
|
@@ -66,6 +66,17 @@ export default (apiUrl: string) => ({
|
|
|
66
66
|
method: 'GET',
|
|
67
67
|
}),
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Gets a list of Asset objects owned the currently logged in User.
|
|
71
|
+
* @param {string} authToken - The login token
|
|
72
|
+
* @returns The list of Asset objects.
|
|
73
|
+
*/
|
|
74
|
+
getAssetList: (authToken: string) =>
|
|
75
|
+
apiFetcher(`/Assets/${authToken}`, {
|
|
76
|
+
apiUrl,
|
|
77
|
+
method: 'GET',
|
|
78
|
+
}) as Promise<ResponseSpec & { assets: Asset[] }>,
|
|
79
|
+
|
|
69
80
|
/**
|
|
70
81
|
* Updates an Asset object
|
|
71
82
|
* @param {string} authToken - The login token
|
|
@@ -49,7 +49,13 @@ export default (apiUrl: string) => ({
|
|
|
49
49
|
apiUrl,
|
|
50
50
|
method: 'PATCH',
|
|
51
51
|
body: config,
|
|
52
|
-
}) as Promise<
|
|
52
|
+
}) as Promise<
|
|
53
|
+
ResponseSpec & {
|
|
54
|
+
config: CompletionConfig;
|
|
55
|
+
appliedMemoriIDs?: string[];
|
|
56
|
+
appliedMemoriNames?: string[];
|
|
57
|
+
}
|
|
58
|
+
>,
|
|
53
59
|
|
|
54
60
|
/**
|
|
55
61
|
* Deletes an existing Completion Config object.
|
|
@@ -73,5 +79,11 @@ export default (apiUrl: string) => ({
|
|
|
73
79
|
apiUrl,
|
|
74
80
|
method: 'POST',
|
|
75
81
|
body: config,
|
|
76
|
-
}) as Promise<
|
|
82
|
+
}) as Promise<
|
|
83
|
+
ResponseSpec & {
|
|
84
|
+
config: CompletionConfig;
|
|
85
|
+
appliedMemoriIDs?: string[];
|
|
86
|
+
appliedMemoriNames?: string[];
|
|
87
|
+
}
|
|
88
|
+
>,
|
|
77
89
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import memori from '../index';
|
|
2
|
+
|
|
3
|
+
const client = memori('https://backend.memori.ai');
|
|
4
|
+
|
|
5
|
+
describe('backend/tenant api', () => {
|
|
6
|
+
it('works on tenant apis', async () => {
|
|
7
|
+
expect(
|
|
8
|
+
await client.backend.tenant.getTenantConfig('www.aisuru.com')
|
|
9
|
+
).not.toBeNull();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('works on tenant apis with shorthand version', async () => {
|
|
13
|
+
expect(
|
|
14
|
+
await client.backend.getTenantConfig('www.aisuru.com')
|
|
15
|
+
).not.toBeNull();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ResponseSpec, TenantBase } from '../types';
|
|
2
|
+
import { apiFetcher } from '../apiFetcher';
|
|
3
|
+
|
|
4
|
+
export default (apiUrl: string) => ({
|
|
5
|
+
/**
|
|
6
|
+
* Health check for the backend
|
|
7
|
+
*/
|
|
8
|
+
healthCheck: () =>
|
|
9
|
+
apiFetcher(`/HealthCheck`, {
|
|
10
|
+
apiUrl,
|
|
11
|
+
method: 'GET',
|
|
12
|
+
}) as Promise<ResponseSpec>,
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the details of a Tenant object.
|
|
16
|
+
* @param tenantName - The name of the tenant
|
|
17
|
+
*/
|
|
18
|
+
getTenantConfig: (tenantName: string) =>
|
|
19
|
+
apiFetcher(`/Tenant/${tenantName}`, { apiUrl }) as Promise<
|
|
20
|
+
ResponseSpec & {
|
|
21
|
+
tenant: TenantBase;
|
|
22
|
+
}
|
|
23
|
+
>,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Gets the list of of all Tenant objects.
|
|
27
|
+
* @param authToken - The login token
|
|
28
|
+
*/
|
|
29
|
+
getTenantList: (authToken: string) =>
|
|
30
|
+
apiFetcher(`/Tenants/${authToken}`, {
|
|
31
|
+
apiUrl,
|
|
32
|
+
method: 'GET',
|
|
33
|
+
}) as Promise<ResponseSpec & { tenants: TenantBase[] }>,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Duplicates a Tenant object.
|
|
37
|
+
* @param {string} authToken - The login token
|
|
38
|
+
* @param {string} name - The name of the Tenant to duplicate
|
|
39
|
+
* @param {TenantBase} tenant
|
|
40
|
+
* @returns The specifications of the new Tenant object
|
|
41
|
+
*/
|
|
42
|
+
createTenant: (
|
|
43
|
+
authToken: string,
|
|
44
|
+
name: string,
|
|
45
|
+
tenant: Partial<TenantBase>
|
|
46
|
+
) =>
|
|
47
|
+
apiFetcher(`/Tenant/${authToken}/${name}`, {
|
|
48
|
+
apiUrl,
|
|
49
|
+
method: 'POST',
|
|
50
|
+
body: tenant,
|
|
51
|
+
}) as Promise<
|
|
52
|
+
ResponseSpec & {
|
|
53
|
+
tenant: TenantBase;
|
|
54
|
+
}
|
|
55
|
+
>,
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Updates the details of a Tenant object.
|
|
59
|
+
* @param {string} authToken - The login token
|
|
60
|
+
* @param {string} name - The name of the Tenant to update
|
|
61
|
+
* @param {TenantBase} tenant
|
|
62
|
+
* @returns The new specifications of the Tenant object
|
|
63
|
+
*/
|
|
64
|
+
patchTenant: (authToken: string, name: string, tenant: Partial<TenantBase>) =>
|
|
65
|
+
apiFetcher(`/Tenant/${authToken}/${name}`, {
|
|
66
|
+
apiUrl,
|
|
67
|
+
method: 'PATCH',
|
|
68
|
+
body: tenant,
|
|
69
|
+
}) as Promise<
|
|
70
|
+
ResponseSpec & {
|
|
71
|
+
tenant: TenantBase;
|
|
72
|
+
}
|
|
73
|
+
>,
|
|
74
|
+
});
|
package/src/backend/user.ts
CHANGED
|
@@ -182,19 +182,6 @@ export default (apiUrl: string) => ({
|
|
|
182
182
|
method: 'POST',
|
|
183
183
|
}) as Promise<ResponseSpec>,
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
* Gets the details of a Tenant object.
|
|
187
|
-
* @param tenantName - The name of the tenant
|
|
188
|
-
*/
|
|
189
|
-
getTenantConfig: (tenantName: string) =>
|
|
190
|
-
apiFetcher(`/Tenant/${tenantName}`, {
|
|
191
|
-
apiUrl,
|
|
192
|
-
}) as Promise<
|
|
193
|
-
ResponseSpec & {
|
|
194
|
-
tenant: Tenant;
|
|
195
|
-
}
|
|
196
|
-
>,
|
|
197
|
-
|
|
198
185
|
/**
|
|
199
186
|
* Re-sends the verification code to confirm a pending User registration.
|
|
200
187
|
* @param {User} user - The user object
|
package/src/backend.ts
CHANGED
|
@@ -10,6 +10,7 @@ import process from './backend/process';
|
|
|
10
10
|
import analysis from './backend/analysis';
|
|
11
11
|
import completionConfig from './backend/completionConfig';
|
|
12
12
|
import badge from './backend/badge';
|
|
13
|
+
import tenant from './backend/tenant';
|
|
13
14
|
|
|
14
15
|
const backendAPI = (apiUrl: string) => ({
|
|
15
16
|
asset: asset(apiUrl),
|
|
@@ -24,6 +25,7 @@ const backendAPI = (apiUrl: string) => ({
|
|
|
24
25
|
analysis: analysis(apiUrl),
|
|
25
26
|
completionConfig: completionConfig(apiUrl),
|
|
26
27
|
badge: badge(apiUrl),
|
|
28
|
+
tenant: tenant(apiUrl),
|
|
27
29
|
...asset(apiUrl),
|
|
28
30
|
...memori(apiUrl),
|
|
29
31
|
...user(apiUrl),
|
|
@@ -36,6 +38,7 @@ const backendAPI = (apiUrl: string) => ({
|
|
|
36
38
|
...analysis(apiUrl),
|
|
37
39
|
...completionConfig(apiUrl),
|
|
38
40
|
...badge(apiUrl),
|
|
41
|
+
...tenant(apiUrl),
|
|
39
42
|
});
|
|
40
43
|
|
|
41
44
|
export default backendAPI;
|
package/src/engine/nlp.ts
CHANGED
|
@@ -113,4 +113,70 @@ export default (apiUrl: string) => ({
|
|
|
113
113
|
undefinedWords: string[];
|
|
114
114
|
}
|
|
115
115
|
>,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Tries to suggest the answer for a question, using as much content as possible from the session's associated Memori object.
|
|
119
|
+
* @param {string} sessionId The session ID
|
|
120
|
+
* @param {string} text Text of the sentence.
|
|
121
|
+
*/
|
|
122
|
+
suggestAnswer: async (sessionId: string, text: string) =>
|
|
123
|
+
apiFetcher(`/SuggestAnswer/${sessionId}`, {
|
|
124
|
+
method: 'POST',
|
|
125
|
+
apiUrl,
|
|
126
|
+
body: { text },
|
|
127
|
+
}) as Promise<
|
|
128
|
+
ResponseSpec & {
|
|
129
|
+
/**
|
|
130
|
+
* Suggested answer. May be null if no answer could be suggested.
|
|
131
|
+
*/
|
|
132
|
+
answer: string;
|
|
133
|
+
}
|
|
134
|
+
>,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Tries to suggest tags for a a question and its answer.
|
|
138
|
+
* Differently from ```SuggestAnswer```, no content from the session's associated Memori object is used.
|
|
139
|
+
* @param {string} sessionId The session ID
|
|
140
|
+
* @param {string} question Text of question.
|
|
141
|
+
* @param {string} answer Answer to the question (and its variants).
|
|
142
|
+
* @param {string[]=} questionVariants Optional list of question variants.
|
|
143
|
+
*/
|
|
144
|
+
suggestTags: async (
|
|
145
|
+
sessionId: string,
|
|
146
|
+
question: string,
|
|
147
|
+
answer: string,
|
|
148
|
+
questionVariants?: string[]
|
|
149
|
+
) =>
|
|
150
|
+
apiFetcher(`/SuggestTags/${sessionId}`, {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
apiUrl,
|
|
153
|
+
body: { question, answer, questionVariants },
|
|
154
|
+
}) as Promise<
|
|
155
|
+
ResponseSpec & {
|
|
156
|
+
/**
|
|
157
|
+
* Suggested tags. May be null or empty if no tags could be suggested.
|
|
158
|
+
*/
|
|
159
|
+
tags: string[];
|
|
160
|
+
}
|
|
161
|
+
>,
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Tries to suggest questions for an answer.
|
|
165
|
+
* Differently from ```SuggestAnswer```, no content from the session's associated Memori object is used.
|
|
166
|
+
* @param {string} sessionId The session ID
|
|
167
|
+
* @param {string} text Text of the sentence.
|
|
168
|
+
*/
|
|
169
|
+
suggestQuestions: async (sessionId: string, text: string) =>
|
|
170
|
+
apiFetcher(`/SuggestQuestions/${sessionId}`, {
|
|
171
|
+
method: 'POST',
|
|
172
|
+
apiUrl,
|
|
173
|
+
body: { text },
|
|
174
|
+
}) as Promise<
|
|
175
|
+
ResponseSpec & {
|
|
176
|
+
/**
|
|
177
|
+
* Suggested questions. May be null or empty if no questions could be suggested.
|
|
178
|
+
*/
|
|
179
|
+
questions: string[];
|
|
180
|
+
}
|
|
181
|
+
>,
|
|
116
182
|
});
|
package/src/engine/stats.ts
CHANGED
|
@@ -113,4 +113,19 @@ export default (apiUrl: string) => ({
|
|
|
113
113
|
eventLogs: EventLog[];
|
|
114
114
|
}
|
|
115
115
|
>,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Gets the Event Log objects for the Memori of the current session recorded during a specific other session.
|
|
119
|
+
* @param {string} sessionID The session ID
|
|
120
|
+
* @param {string} eventLogSessionID The session ID for which Event Log objects are being searched
|
|
121
|
+
*/
|
|
122
|
+
getSessionEventLogs: async (sessionID: string, eventLogSessionID: string) =>
|
|
123
|
+
apiFetcher(`/SessionEventLogs/${sessionID}/${eventLogSessionID}`, {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
apiUrl,
|
|
126
|
+
}) as Promise<
|
|
127
|
+
ResponseSpec & {
|
|
128
|
+
eventLogs: EventLog[];
|
|
129
|
+
}
|
|
130
|
+
>,
|
|
116
131
|
});
|