@hexabot-ai/api 3.2.1-alpha.0 → 3.2.2-alpha.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/README.md +1 -1
- package/dist/config/i18n/en/global_settings.json +7 -0
- package/dist/config/i18n/fr/global_settings.json +7 -0
- package/dist/extensions/actions/web/i18n/en.translations.json +9 -0
- package/dist/extensions/actions/web/i18n/fr.translations.json +9 -0
- package/dist/extensions/actions/web/send-mail.action.d.ts +30 -0
- package/dist/extensions/actions/web/send-mail.action.js +79 -0
- package/dist/extensions/actions/web/send-mail.action.js.map +1 -0
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.js +1 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/helper/helper.controller.js +2 -3
- package/dist/helper/helper.controller.js.map +1 -1
- package/dist/helper/helper.service.d.ts +0 -1
- package/dist/helper/helper.service.js +2 -10
- package/dist/helper/helper.service.js.map +1 -1
- package/dist/helper/index.d.ts +0 -1
- package/dist/helper/index.js +0 -1
- package/dist/helper/index.js.map +1 -1
- package/dist/helper/types.d.ts +0 -26
- package/dist/helper/types.js +1 -14
- package/dist/helper/types.js.map +1 -1
- package/dist/license/services/license.service.js +2 -2
- package/dist/license/services/license.service.js.map +1 -1
- package/dist/setting/default.settings.d.ts +5 -20
- package/dist/setting/default.settings.js +10 -63
- package/dist/setting/default.settings.js.map +1 -1
- package/dist/static/assets/{cssMode-CMCoflUW.js → cssMode-ClQbC1-G.js} +1 -1
- package/dist/static/assets/{freemarker2-xrKobLW0.js → freemarker2-DRxgvoL0.js} +1 -1
- package/dist/static/assets/{handlebars-B001x0dl.js → handlebars-CTQECjcj.js} +1 -1
- package/dist/static/assets/{html-HBIKRg6X.js → html-DvVbNWXL.js} +1 -1
- package/dist/static/assets/{htmlMode-D_O4-Va4.js → htmlMode-DHCoon1T.js} +1 -1
- package/dist/static/assets/{index-3E05C6mQ.css → index-BI1BtkYv.css} +1 -1
- package/dist/static/assets/{index-Ca-L_Bhg.js → index-BgFwJPy7.js} +2046 -2046
- package/dist/static/assets/{javascript-BtGFPGHv.js → javascript-CiEs6Ej5.js} +1 -1
- package/dist/static/assets/{jsonMode-Cgpaamyt.js → jsonMode-DTfAuumC.js} +1 -1
- package/dist/static/assets/{liquid-NlTZnkhA.js → liquid-B714yIaN.js} +1 -1
- package/dist/static/assets/{lspLanguageFeatures-CxA7MNHw.js → lspLanguageFeatures-r73pyfl4.js} +1 -1
- package/dist/static/assets/{mdx-CO_P9sLj.js → mdx-D5IAs7yq.js} +1 -1
- package/dist/static/assets/{python-p9cJ1T8V.js → python-ehBpsG6S.js} +1 -1
- package/dist/static/assets/{razor-b6daQ7Gs.js → razor-V-Gitx5J.js} +1 -1
- package/dist/static/assets/{tsMode-qFS4LhFG.js → tsMode-D_iFxZ-O.js} +1 -1
- package/dist/static/assets/{typescript-CVF7hkOS.js → typescript-CEGzsf5j.js} +1 -1
- package/dist/static/assets/{xml-3_BTeML3.js → xml-N5EKZaXL.js} +1 -1
- package/dist/static/assets/{yaml-CdBNONt5.js → yaml-IWZvbW4T.js} +1 -1
- package/dist/static/index.html +2 -2
- package/dist/static/locales/en/translation.json +22 -335
- package/dist/static/locales/fr/translation.json +22 -333
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/helpers/safe-property-path.d.ts +1 -0
- package/dist/utils/helpers/safe-property-path.js +12 -0
- package/dist/utils/helpers/safe-property-path.js.map +1 -0
- package/dist/utils/pipes/typeorm-search-filter.pipe.js +4 -3
- package/dist/utils/pipes/typeorm-search-filter.pipe.js.map +1 -1
- package/dist/utils/test/fixtures/setting.js +1 -1
- package/dist/utils/test/fixtures/setting.js.map +1 -1
- package/dist/utils/test/providers/setting-service.provider.d.ts +0 -1
- package/dist/utils/test/providers/setting-service.provider.js +4 -15
- package/dist/utils/test/providers/setting-service.provider.js.map +1 -1
- package/dist/websocket/services/socket-event-dispatcher.service.js +6 -3
- package/dist/websocket/services/socket-event-dispatcher.service.js.map +1 -1
- package/package.json +4 -4
- package/src/config/i18n/en/global_settings.json +7 -0
- package/src/config/i18n/fr/global_settings.json +7 -0
- package/src/extensions/actions/web/i18n/en.translations.json +9 -0
- package/src/extensions/actions/web/i18n/fr.translations.json +9 -0
- package/src/extensions/actions/web/send-mail.action.ts +89 -0
- package/src/extensions/index.ts +2 -0
- package/src/helper/helper.controller.ts +3 -4
- package/src/helper/helper.service.ts +3 -23
- package/src/helper/index.ts +0 -2
- package/src/helper/types.ts +0 -57
- package/src/license/services/license.service.spec.ts +13 -13
- package/src/license/services/license.service.ts +3 -3
- package/src/setting/default.settings.ts +10 -63
- package/src/utils/helpers/safe-property-path.ts +13 -0
- package/src/utils/pipes/typeorm-search-filter.pipe.ts +4 -3
- package/src/utils/test/fixtures/setting.ts +1 -1
- package/src/utils/test/providers/setting-service.provider.ts +4 -19
- package/src/websocket/services/socket-event-dispatcher.service.ts +7 -5
- package/dist/config/i18n/en/chatbot_settings.json +0 -17
- package/dist/config/i18n/fr/chatbot_settings.json +0 -17
- package/dist/helper/lib/base-llm-helper.d.ts +0 -10
- package/dist/helper/lib/base-llm-helper.js +0 -16
- package/dist/helper/lib/base-llm-helper.js.map +0 -1
- package/src/config/i18n/en/chatbot_settings.json +0 -17
- package/src/config/i18n/fr/chatbot_settings.json +0 -17
- package/src/helper/lib/base-llm-helper.ts +0 -74
|
@@ -168,7 +168,7 @@ const createActivationResponse = (
|
|
|
168
168
|
const createSettingUpdateEvent = ({
|
|
169
169
|
oldValue,
|
|
170
170
|
newValue,
|
|
171
|
-
group = '
|
|
171
|
+
group = 'global_settings',
|
|
172
172
|
label = 'license_key',
|
|
173
173
|
}: {
|
|
174
174
|
oldValue?: unknown;
|
|
@@ -203,7 +203,7 @@ const createEnv = (overrides: CreateEnvOptions = {}): ServiceEnv => {
|
|
|
203
203
|
...overrides.apiService,
|
|
204
204
|
};
|
|
205
205
|
const settingService: MockSettingService = {
|
|
206
|
-
getSettings: jest.fn().mockResolvedValue({
|
|
206
|
+
getSettings: jest.fn().mockResolvedValue({ global_settings: {} }),
|
|
207
207
|
clearCache: jest.fn().mockResolvedValue(undefined),
|
|
208
208
|
...overrides.settingService,
|
|
209
209
|
};
|
|
@@ -295,7 +295,7 @@ describe('LicenseService', () => {
|
|
|
295
295
|
it('marks state invalid when validation fails', async () => {
|
|
296
296
|
const { service, settingService, apiService } = createEnv();
|
|
297
297
|
settingService.getSettings.mockResolvedValueOnce({
|
|
298
|
-
|
|
298
|
+
global_settings: { license_key: 'invalid-key' },
|
|
299
299
|
});
|
|
300
300
|
apiService.validate.mockResolvedValue(
|
|
301
301
|
createValidationResponse({ valid: false, license_key: null }),
|
|
@@ -316,7 +316,7 @@ describe('LicenseService', () => {
|
|
|
316
316
|
it('marks state expired when the license has expired', async () => {
|
|
317
317
|
const { service, settingService, apiService } = createEnv();
|
|
318
318
|
settingService.getSettings.mockResolvedValueOnce({
|
|
319
|
-
|
|
319
|
+
global_settings: { license_key: 'expired-key' },
|
|
320
320
|
});
|
|
321
321
|
apiService.validate.mockResolvedValue(
|
|
322
322
|
createValidationResponse({
|
|
@@ -352,7 +352,7 @@ describe('LicenseService', () => {
|
|
|
352
352
|
it('marks state disabled when the license has been disabled', async () => {
|
|
353
353
|
const { service, settingService, apiService } = createEnv();
|
|
354
354
|
settingService.getSettings.mockResolvedValueOnce({
|
|
355
|
-
|
|
355
|
+
global_settings: { license_key: 'disabled-key' },
|
|
356
356
|
});
|
|
357
357
|
apiService.validate.mockResolvedValue(
|
|
358
358
|
createValidationResponse({
|
|
@@ -385,7 +385,7 @@ describe('LicenseService', () => {
|
|
|
385
385
|
const { service, settingService, apiService, metadataService } =
|
|
386
386
|
createEnv();
|
|
387
387
|
settingService.getSettings.mockResolvedValueOnce({
|
|
388
|
-
|
|
388
|
+
global_settings: { license_key: 'active-key' },
|
|
389
389
|
});
|
|
390
390
|
apiService.validate.mockResolvedValue(
|
|
391
391
|
createValidationResponse({
|
|
@@ -410,7 +410,7 @@ describe('LicenseService', () => {
|
|
|
410
410
|
it('keeps user management disabled for starter plan', async () => {
|
|
411
411
|
const { service, settingService, apiService } = createEnv();
|
|
412
412
|
settingService.getSettings.mockResolvedValueOnce({
|
|
413
|
-
|
|
413
|
+
global_settings: { license_key: 'starter-key' },
|
|
414
414
|
});
|
|
415
415
|
apiService.validate.mockResolvedValue(
|
|
416
416
|
createValidationResponse({
|
|
@@ -434,7 +434,7 @@ describe('LicenseService', () => {
|
|
|
434
434
|
workflowCount: 150,
|
|
435
435
|
});
|
|
436
436
|
settingService.getSettings.mockResolvedValueOnce({
|
|
437
|
-
|
|
437
|
+
global_settings: { license_key: 'active-pro' },
|
|
438
438
|
});
|
|
439
439
|
apiService.validate.mockResolvedValue(
|
|
440
440
|
createValidationResponse({
|
|
@@ -463,7 +463,7 @@ describe('LicenseService', () => {
|
|
|
463
463
|
workflowCount: 2,
|
|
464
464
|
});
|
|
465
465
|
settingService.getSettings.mockResolvedValueOnce({
|
|
466
|
-
|
|
466
|
+
global_settings: { license_key: 'active-unknown' },
|
|
467
467
|
});
|
|
468
468
|
apiService.validate.mockResolvedValue(
|
|
469
469
|
createValidationResponse({
|
|
@@ -495,7 +495,7 @@ describe('LicenseService', () => {
|
|
|
495
495
|
workflowCount: 600,
|
|
496
496
|
});
|
|
497
497
|
settingService.getSettings.mockResolvedValueOnce({
|
|
498
|
-
|
|
498
|
+
global_settings: { license_key: 'active-unlimited' },
|
|
499
499
|
});
|
|
500
500
|
apiService.validate.mockResolvedValue(
|
|
501
501
|
createValidationResponse({
|
|
@@ -525,7 +525,7 @@ describe('LicenseService', () => {
|
|
|
525
525
|
const { service, settingService, apiService, metadataService } =
|
|
526
526
|
createEnv();
|
|
527
527
|
settingService.getSettings.mockResolvedValueOnce({
|
|
528
|
-
|
|
528
|
+
global_settings: { license_key: 'to-activate' },
|
|
529
529
|
});
|
|
530
530
|
apiService.validate.mockResolvedValue(
|
|
531
531
|
createValidationResponse({
|
|
@@ -578,7 +578,7 @@ describe('LicenseService', () => {
|
|
|
578
578
|
it('stores an error when activation slots are exhausted', async () => {
|
|
579
579
|
const { service, settingService, apiService } = createEnv();
|
|
580
580
|
settingService.getSettings.mockResolvedValueOnce({
|
|
581
|
-
|
|
581
|
+
global_settings: { license_key: 'full' },
|
|
582
582
|
});
|
|
583
583
|
apiService.validate.mockResolvedValue(
|
|
584
584
|
createValidationResponse({
|
|
@@ -611,7 +611,7 @@ describe('LicenseService', () => {
|
|
|
611
611
|
it('uses Axios extractor when refresh throws', async () => {
|
|
612
612
|
const { service, settingService, apiService } = createEnv();
|
|
613
613
|
settingService.getSettings.mockResolvedValueOnce({
|
|
614
|
-
|
|
614
|
+
global_settings: { license_key: 'network' },
|
|
615
615
|
});
|
|
616
616
|
apiService.extractAxiosError.mockReturnValue('Detailed');
|
|
617
617
|
apiService.validate.mockRejectedValue(new Error('fail'));
|
|
@@ -14,7 +14,7 @@ import { InjectDataSource } from '@nestjs/typeorm';
|
|
|
14
14
|
import { DataSource } from 'typeorm';
|
|
15
15
|
|
|
16
16
|
import { LoggerService } from '@/logger/logger.service';
|
|
17
|
-
import {
|
|
17
|
+
import { GLOBAL_SETTINGS_GROUP } from '@/setting/default.settings';
|
|
18
18
|
import { SettingOrmEntity } from '@/setting/entities/setting.entity';
|
|
19
19
|
import { MetadataService } from '@/setting/services/metadata.service';
|
|
20
20
|
import { SettingService } from '@/setting/services/setting.service';
|
|
@@ -256,7 +256,7 @@ export class LicenseService implements OnApplicationBootstrap {
|
|
|
256
256
|
const group = next?.group ?? previous?.group;
|
|
257
257
|
const label = next?.label ?? previous?.label;
|
|
258
258
|
|
|
259
|
-
if (group !==
|
|
259
|
+
if (group !== GLOBAL_SETTINGS_GROUP || label !== 'license_key') {
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -474,7 +474,7 @@ export class LicenseService implements OnApplicationBootstrap {
|
|
|
474
474
|
await this.settingService.clearCache();
|
|
475
475
|
const settings = await this.settingService.getSettings();
|
|
476
476
|
|
|
477
|
-
return this.normalizeLicenseKey(settings.
|
|
477
|
+
return this.normalizeLicenseKey(settings.global_settings?.license_key);
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
private async getInstanceId(): Promise<string | undefined> {
|
|
@@ -9,13 +9,13 @@ import z from 'zod';
|
|
|
9
9
|
import { createSettingGroup } from '@/setting/create-setting-group';
|
|
10
10
|
import { RuntimeSettingGroupSchema } from '@/setting/runtime-settings';
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const GLOBAL_SETTINGS_GROUP = 'global_settings' as const;
|
|
13
13
|
|
|
14
14
|
export const RAG_SETTINGS_GROUP = 'rag_settings' as const;
|
|
15
15
|
|
|
16
16
|
export const CONTACT_SETTINGS_GROUP = 'contact' as const;
|
|
17
17
|
|
|
18
|
-
export const
|
|
18
|
+
export const globalSettingsSchema = z
|
|
19
19
|
.strictObject({
|
|
20
20
|
license_key: z.string().default('').meta({
|
|
21
21
|
title: 'License key',
|
|
@@ -23,51 +23,12 @@ export const chatbotSettingsSchema = z
|
|
|
23
23
|
'Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.',
|
|
24
24
|
'ui:widget': 'password',
|
|
25
25
|
}),
|
|
26
|
-
default_nlu_helper: z
|
|
27
|
-
.string()
|
|
28
|
-
.default('llm-nlu')
|
|
29
|
-
.meta({
|
|
30
|
-
title: 'Default NLU helper',
|
|
31
|
-
description: 'Helper used by default to run NLU tasks.',
|
|
32
|
-
'ui:widget': 'AutoCompleteWidget',
|
|
33
|
-
'ui:options': {
|
|
34
|
-
entity: 'NluHelper',
|
|
35
|
-
valueKey: 'name',
|
|
36
|
-
labelKey: 'name',
|
|
37
|
-
},
|
|
38
|
-
}),
|
|
39
|
-
default_nlu_penalty_factor: z
|
|
40
|
-
.number()
|
|
41
|
-
.min(0)
|
|
42
|
-
.max(1)
|
|
43
|
-
.multipleOf(0.01)
|
|
44
|
-
.default(0.95)
|
|
45
|
-
.meta({
|
|
46
|
-
title: 'Default NLU penalty factor',
|
|
47
|
-
description: 'Penalty factor applied to NLU confidence scoring.',
|
|
48
|
-
'ui:options': {
|
|
49
|
-
step: 0.01,
|
|
50
|
-
},
|
|
51
|
-
}),
|
|
52
|
-
default_llm_helper: z
|
|
53
|
-
.string()
|
|
54
|
-
.default('ollama')
|
|
55
|
-
.meta({
|
|
56
|
-
title: 'Default LLM helper',
|
|
57
|
-
description: 'Helper used by default for LLM generation tasks.',
|
|
58
|
-
'ui:widget': 'AutoCompleteWidget',
|
|
59
|
-
'ui:options': {
|
|
60
|
-
entity: 'LlmHelper',
|
|
61
|
-
valueKey: 'name',
|
|
62
|
-
labelKey: 'name',
|
|
63
|
-
},
|
|
64
|
-
}),
|
|
65
26
|
default_storage_helper: z
|
|
66
27
|
.string()
|
|
67
28
|
.default('local-storage')
|
|
68
29
|
.meta({
|
|
69
30
|
title: 'Default storage helper',
|
|
70
|
-
description: 'Helper used to persist
|
|
31
|
+
description: 'Helper used to persist workflow data by default.',
|
|
71
32
|
'ui:widget': 'AutoCompleteWidget',
|
|
72
33
|
'ui:options': {
|
|
73
34
|
entity: 'StorageHelper',
|
|
@@ -75,23 +36,9 @@ export const chatbotSettingsSchema = z
|
|
|
75
36
|
labelKey: 'name',
|
|
76
37
|
},
|
|
77
38
|
}),
|
|
78
|
-
global_fallback: z.boolean().default(true).meta({
|
|
79
|
-
title: 'Enable global fallback',
|
|
80
|
-
description: 'Enable fallback handling when no intent or flow matches.',
|
|
81
|
-
}),
|
|
82
|
-
fallback_message: z
|
|
83
|
-
.array(z.string())
|
|
84
|
-
.default([
|
|
85
|
-
"Sorry but i didn't understand your request. Maybe you can check the menu",
|
|
86
|
-
"I'm really sorry but i don't quite understand what you are saying :(",
|
|
87
|
-
])
|
|
88
|
-
.meta({
|
|
89
|
-
title: 'Fallback messages',
|
|
90
|
-
description: 'Messages shown when fallback handling is triggered.',
|
|
91
|
-
}),
|
|
92
39
|
})
|
|
93
40
|
.meta({
|
|
94
|
-
title: '
|
|
41
|
+
title: 'Global settings',
|
|
95
42
|
});
|
|
96
43
|
|
|
97
44
|
export const ragSettingsSchema = z
|
|
@@ -207,15 +154,15 @@ export const contactSettingsSchema = z
|
|
|
207
154
|
|
|
208
155
|
declare global {
|
|
209
156
|
interface RuntimeSettingRegistry {
|
|
210
|
-
[
|
|
157
|
+
[GLOBAL_SETTINGS_GROUP]: typeof globalSettingsSchema;
|
|
211
158
|
[RAG_SETTINGS_GROUP]: typeof ragSettingsSchema;
|
|
212
159
|
[CONTACT_SETTINGS_GROUP]: typeof contactSettingsSchema;
|
|
213
160
|
}
|
|
214
161
|
}
|
|
215
162
|
|
|
216
|
-
export const
|
|
217
|
-
group:
|
|
218
|
-
schema:
|
|
163
|
+
export const GlobalSettingsGroup = createSettingGroup({
|
|
164
|
+
group: GLOBAL_SETTINGS_GROUP,
|
|
165
|
+
schema: globalSettingsSchema,
|
|
219
166
|
scope: 'global',
|
|
220
167
|
});
|
|
221
168
|
|
|
@@ -233,8 +180,8 @@ export const ContactSettingsGroup = createSettingGroup({
|
|
|
233
180
|
|
|
234
181
|
export const DEFAULT_GLOBAL_SETTING_SCHEMAS = [
|
|
235
182
|
{
|
|
236
|
-
group:
|
|
237
|
-
schema:
|
|
183
|
+
group: GLOBAL_SETTINGS_GROUP,
|
|
184
|
+
schema: globalSettingsSchema,
|
|
238
185
|
},
|
|
239
186
|
{
|
|
240
187
|
group: RAG_SETTINGS_GROUP,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
3
|
+
* Copyright (c) 2025 Hexastack.
|
|
4
|
+
* Full terms: see LICENSE.md.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import toPath from 'lodash/toPath';
|
|
8
|
+
|
|
9
|
+
const FORBIDDEN_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
10
|
+
|
|
11
|
+
export function hasForbiddenSegment(path: string): boolean {
|
|
12
|
+
return toPath(path).some((segment) => FORBIDDEN_SEGMENTS.has(segment));
|
|
13
|
+
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
Not,
|
|
23
23
|
} from 'typeorm';
|
|
24
24
|
|
|
25
|
+
import { hasForbiddenSegment } from '../helpers/safe-property-path';
|
|
25
26
|
import {
|
|
26
27
|
TFilterNestedKeysOfType,
|
|
27
28
|
TSearchFilterValue,
|
|
@@ -200,7 +201,7 @@ export class TypeOrmSearchFilterPipe<T>
|
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
const [field = '', direction = 'desc'] = sort.trim().split(/\s+/);
|
|
203
|
-
if (!field) {
|
|
204
|
+
if (!field || hasForbiddenSegment(field)) {
|
|
204
205
|
return undefined;
|
|
205
206
|
}
|
|
206
207
|
|
|
@@ -396,7 +397,7 @@ export class TypeOrmSearchFilterPipe<T>
|
|
|
396
397
|
path: string,
|
|
397
398
|
value: unknown,
|
|
398
399
|
): void {
|
|
399
|
-
if (value === undefined) return;
|
|
400
|
+
if (value === undefined || hasForbiddenSegment(path)) return;
|
|
400
401
|
const segments = path.split('.');
|
|
401
402
|
let cursor = target;
|
|
402
403
|
|
|
@@ -416,7 +417,7 @@ export class TypeOrmSearchFilterPipe<T>
|
|
|
416
417
|
right: FindOptionsWhere<T>,
|
|
417
418
|
): FindOptionsWhere<T> {
|
|
418
419
|
for (const [key, value] of Object.entries(right)) {
|
|
419
|
-
if (value === undefined) {
|
|
420
|
+
if (value === undefined || hasForbiddenSegment(key)) {
|
|
420
421
|
continue;
|
|
421
422
|
}
|
|
422
423
|
|
|
@@ -9,27 +9,12 @@ import { SettingService } from '@/setting';
|
|
|
9
9
|
export const SettingServiceProvider = {
|
|
10
10
|
provide: SettingService,
|
|
11
11
|
useValue: {
|
|
12
|
-
default_nlu_helper: 'llm-nlu',
|
|
13
12
|
getSettings: jest.fn().mockResolvedValue({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fallback_message: ['Global fallback message'],
|
|
13
|
+
global_settings: {
|
|
14
|
+
license_key: '',
|
|
15
|
+
default_storage_helper: 'local-storage',
|
|
18
16
|
},
|
|
19
17
|
}),
|
|
20
|
-
find: jest.fn().
|
|
21
|
-
[
|
|
22
|
-
{
|
|
23
|
-
translatable: true,
|
|
24
|
-
group: 'default',
|
|
25
|
-
value: 'Global fallback message',
|
|
26
|
-
label: 'fallback_message',
|
|
27
|
-
},
|
|
28
|
-
].filter((s) =>
|
|
29
|
-
criteria && 'translatable' in criteria
|
|
30
|
-
? s.translatable === criteria.translatable
|
|
31
|
-
: true,
|
|
32
|
-
),
|
|
33
|
-
),
|
|
18
|
+
find: jest.fn().mockReturnValue([]),
|
|
34
19
|
},
|
|
35
20
|
};
|
|
@@ -144,12 +144,14 @@ export class SocketEventDispatcherService implements OnModuleInit {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
const withLeadingSlash = path.startsWith('/') ? path : `/${path}`;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
let end = withLeadingSlash.length;
|
|
148
|
+
while (end > 1 && withLeadingSlash.charCodeAt(end - 1) === 0x2f) {
|
|
149
|
+
end--;
|
|
150
|
+
}
|
|
151
151
|
|
|
152
|
-
return
|
|
152
|
+
return end < withLeadingSlash.length
|
|
153
|
+
? withLeadingSlash.slice(0, end)
|
|
154
|
+
: withLeadingSlash;
|
|
153
155
|
}
|
|
154
156
|
|
|
155
157
|
private matchPath(
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Chatbot": "Chatbot",
|
|
3
|
-
"Default NLU helper": "Default NLU helper",
|
|
4
|
-
"Helper used by default to run NLU tasks.": "Helper used by default to run NLU tasks.",
|
|
5
|
-
"Default NLU penalty factor": "Default NLU penalty factor",
|
|
6
|
-
"Penalty factor applied to NLU confidence scoring.": "Penalty factor applied to NLU confidence scoring.",
|
|
7
|
-
"Default LLM helper": "Default LLM helper",
|
|
8
|
-
"Helper used by default for LLM generation tasks.": "Helper used by default for LLM generation tasks.",
|
|
9
|
-
"Default storage helper": "Default storage helper",
|
|
10
|
-
"Helper used to persist chatbot data by default.": "Helper used to persist chatbot data by default.",
|
|
11
|
-
"License key": "License key",
|
|
12
|
-
"Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.": "Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.",
|
|
13
|
-
"Enable global fallback": "Enable global fallback",
|
|
14
|
-
"Enable fallback handling when no intent or flow matches.": "Enable fallback handling when no intent or flow matches.",
|
|
15
|
-
"Fallback messages": "Fallback messages",
|
|
16
|
-
"Messages shown when fallback handling is triggered.": "Messages shown when fallback handling is triggered."
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Chatbot": "Chatbot",
|
|
3
|
-
"Default NLU helper": "Utilitaire NLU par défaut",
|
|
4
|
-
"Helper used by default to run NLU tasks.": "Utilitaire utilisé par défaut pour exécuter les tâches NLU.",
|
|
5
|
-
"Default NLU penalty factor": "Facteur de pénalité NLU par défaut",
|
|
6
|
-
"Penalty factor applied to NLU confidence scoring.": "Facteur de pénalité appliqué au score de confiance NLU.",
|
|
7
|
-
"Default LLM helper": "Utilitaire LLM par défaut",
|
|
8
|
-
"Helper used by default for LLM generation tasks.": "Utilitaire utilisé par défaut pour les tâches de génération LLM.",
|
|
9
|
-
"Default storage helper": "Utilitaire de stockage par défaut",
|
|
10
|
-
"Helper used to persist chatbot data by default.": "Utilitaire utilisé par défaut pour persister les données du chatbot.",
|
|
11
|
-
"License key": "Clé de licence",
|
|
12
|
-
"Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.": "Indiquez la clé de licence liée à votre abonnement. Découvrez nos offres sur https://hexabot.ai/pricing#pricing.",
|
|
13
|
-
"Enable global fallback": "Activer le fallback global",
|
|
14
|
-
"Enable fallback handling when no intent or flow matches.": "Activer la gestion du fallback lorsqu'aucune intention ou aucun flux ne correspond.",
|
|
15
|
-
"Fallback messages": "Messages de fallback",
|
|
16
|
-
"Messages shown when fallback handling is triggered.": "Messages affichés lorsque la gestion du fallback est déclenchée."
|
|
17
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AnyMessage } from '@hexabot-ai/types';
|
|
2
|
-
import { HelperName, HelperType, LLM } from '../types';
|
|
3
|
-
import BaseHelper from './base-helper';
|
|
4
|
-
export declare abstract class BaseLlmHelper<N extends HelperName = HelperName> extends BaseHelper<N> {
|
|
5
|
-
protected readonly type: HelperType;
|
|
6
|
-
constructor(name: N);
|
|
7
|
-
abstract generateResponse(prompt: string, model: string, systemPrompt: string, extra?: any): Promise<string>;
|
|
8
|
-
generateStructuredResponse?<T>(prompt: string, model: string, systemPrompt: string, schema: LLM.ResponseSchema, extra?: any): Promise<T>;
|
|
9
|
-
abstract generateChatCompletion(prompt: string, model: string, systemPrompt?: string, history?: AnyMessage[], extra?: any): Promise<string>;
|
|
10
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BaseLlmHelper = void 0;
|
|
7
|
-
const types_1 = require("../types");
|
|
8
|
-
const base_helper_1 = __importDefault(require("./base-helper"));
|
|
9
|
-
class BaseLlmHelper extends base_helper_1.default {
|
|
10
|
-
constructor(name) {
|
|
11
|
-
super(name);
|
|
12
|
-
this.type = types_1.HelperType.LLM;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.BaseLlmHelper = BaseLlmHelper;
|
|
16
|
-
//# sourceMappingURL=base-llm-helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-llm-helper.js","sourceRoot":"","sources":["../../../src/helper/lib/base-llm-helper.ts"],"names":[],"mappings":";;;;;;AAQA,oCAAuD;AAEvD,gEAAuC;AAEvC,MAAsB,aAEpB,SAAQ,qBAAa;IAGrB,YAAY,IAAO;QACjB,KAAK,CAAC,IAAI,CAAC,CAAC;QAHK,SAAI,GAAe,kBAAU,CAAC,GAAG,CAAC;IAIrD,CAAC;CAsDF;AA7DD,sCA6DC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Chatbot": "Chatbot",
|
|
3
|
-
"Default NLU helper": "Default NLU helper",
|
|
4
|
-
"Helper used by default to run NLU tasks.": "Helper used by default to run NLU tasks.",
|
|
5
|
-
"Default NLU penalty factor": "Default NLU penalty factor",
|
|
6
|
-
"Penalty factor applied to NLU confidence scoring.": "Penalty factor applied to NLU confidence scoring.",
|
|
7
|
-
"Default LLM helper": "Default LLM helper",
|
|
8
|
-
"Helper used by default for LLM generation tasks.": "Helper used by default for LLM generation tasks.",
|
|
9
|
-
"Default storage helper": "Default storage helper",
|
|
10
|
-
"Helper used to persist chatbot data by default.": "Helper used to persist chatbot data by default.",
|
|
11
|
-
"License key": "License key",
|
|
12
|
-
"Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.": "Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.",
|
|
13
|
-
"Enable global fallback": "Enable global fallback",
|
|
14
|
-
"Enable fallback handling when no intent or flow matches.": "Enable fallback handling when no intent or flow matches.",
|
|
15
|
-
"Fallback messages": "Fallback messages",
|
|
16
|
-
"Messages shown when fallback handling is triggered.": "Messages shown when fallback handling is triggered."
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Chatbot": "Chatbot",
|
|
3
|
-
"Default NLU helper": "Utilitaire NLU par défaut",
|
|
4
|
-
"Helper used by default to run NLU tasks.": "Utilitaire utilisé par défaut pour exécuter les tâches NLU.",
|
|
5
|
-
"Default NLU penalty factor": "Facteur de pénalité NLU par défaut",
|
|
6
|
-
"Penalty factor applied to NLU confidence scoring.": "Facteur de pénalité appliqué au score de confiance NLU.",
|
|
7
|
-
"Default LLM helper": "Utilitaire LLM par défaut",
|
|
8
|
-
"Helper used by default for LLM generation tasks.": "Utilitaire utilisé par défaut pour les tâches de génération LLM.",
|
|
9
|
-
"Default storage helper": "Utilitaire de stockage par défaut",
|
|
10
|
-
"Helper used to persist chatbot data by default.": "Utilitaire utilisé par défaut pour persister les données du chatbot.",
|
|
11
|
-
"License key": "Clé de licence",
|
|
12
|
-
"Provide the license key associated with your subscription. Learn more about available plans at https://hexabot.ai/pricing#pricing.": "Indiquez la clé de licence liée à votre abonnement. Découvrez nos offres sur https://hexabot.ai/pricing#pricing.",
|
|
13
|
-
"Enable global fallback": "Activer le fallback global",
|
|
14
|
-
"Enable fallback handling when no intent or flow matches.": "Activer la gestion du fallback lorsqu'aucune intention ou aucun flux ne correspond.",
|
|
15
|
-
"Fallback messages": "Messages de fallback",
|
|
16
|
-
"Messages shown when fallback handling is triggered.": "Messages affichés lorsque la gestion du fallback est déclenchée."
|
|
17
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
3
|
-
* Copyright (c) 2025 Hexastack.
|
|
4
|
-
* Full terms: see LICENSE.md.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { AnyMessage } from '@hexabot-ai/types';
|
|
8
|
-
|
|
9
|
-
import { HelperName, HelperType, LLM } from '../types';
|
|
10
|
-
|
|
11
|
-
import BaseHelper from './base-helper';
|
|
12
|
-
|
|
13
|
-
export abstract class BaseLlmHelper<
|
|
14
|
-
N extends HelperName = HelperName,
|
|
15
|
-
> extends BaseHelper<N> {
|
|
16
|
-
protected readonly type: HelperType = HelperType.LLM;
|
|
17
|
-
|
|
18
|
-
constructor(name: N) {
|
|
19
|
-
super(name);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Generates a text response using LLM
|
|
24
|
-
*
|
|
25
|
-
* @param prompt - The input text from the user
|
|
26
|
-
* @param model - The model to be used
|
|
27
|
-
* @param systemPrompt - The input text from the system
|
|
28
|
-
* @param extra - Extra options
|
|
29
|
-
* @returns {Promise<string>} - The generated response from the LLM
|
|
30
|
-
*/
|
|
31
|
-
abstract generateResponse(
|
|
32
|
-
prompt: string,
|
|
33
|
-
model: string,
|
|
34
|
-
systemPrompt: string,
|
|
35
|
-
extra?: any,
|
|
36
|
-
): Promise<string>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Generates a structured response using LLM
|
|
40
|
-
*
|
|
41
|
-
* @param prompt - The input text from the user
|
|
42
|
-
* @param model - The model to be used
|
|
43
|
-
* @param systemPrompt - The input text from the system
|
|
44
|
-
* @param schema - The OpenAPI data schema
|
|
45
|
-
* @param extra - Extra options
|
|
46
|
-
* @returns {Promise<string>} - The generated response from the LLM
|
|
47
|
-
*/
|
|
48
|
-
generateStructuredResponse?<T>(
|
|
49
|
-
prompt: string,
|
|
50
|
-
model: string,
|
|
51
|
-
systemPrompt: string,
|
|
52
|
-
schema: LLM.ResponseSchema,
|
|
53
|
-
extra?: any,
|
|
54
|
-
): Promise<T>;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Send a chat completion request with the running dialogue history.
|
|
58
|
-
* You can use this same approach to start the exchange
|
|
59
|
-
* using multi-shot or chain-of-thought prompting.
|
|
60
|
-
*
|
|
61
|
-
* @param prompt - The input text from the user
|
|
62
|
-
* @param model - The model to be used
|
|
63
|
-
* @param history - Array of messages
|
|
64
|
-
* @param extra - Extra options
|
|
65
|
-
* @returns {Promise<string>} - The generated response from the LLM
|
|
66
|
-
*/
|
|
67
|
-
abstract generateChatCompletion(
|
|
68
|
-
prompt: string,
|
|
69
|
-
model: string,
|
|
70
|
-
systemPrompt?: string,
|
|
71
|
-
history?: AnyMessage[],
|
|
72
|
-
extra?: any,
|
|
73
|
-
): Promise<string>;
|
|
74
|
-
}
|