mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: enforce typing
This commit is contained in:
@@ -363,7 +363,7 @@ describe('BlockService', () => {
|
||||
});
|
||||
|
||||
describe('matchBestNLP', () => {
|
||||
const nlpPenaltyFactor = 2;
|
||||
const nlpPenaltyFactor = 0.95;
|
||||
it('should return the block with the highest NLP score', async () => {
|
||||
jest
|
||||
.spyOn(nlpEntityService, 'getNlpMap')
|
||||
@@ -417,7 +417,7 @@ describe('BlockService', () => {
|
||||
// Restore the spy after the test
|
||||
calculateBlockScoreSpy.mockRestore();
|
||||
// Assert that the block with the highest NLP score is selected
|
||||
expect(bestBlock).toEqual(mockModifiedNlpBlock);
|
||||
expect(bestBlock).toEqual(mockNlpBlock);
|
||||
});
|
||||
|
||||
it('should return undefined if no blocks match or the list is empty', async () => {
|
||||
|
||||
@@ -215,7 +215,12 @@ export class BlockService extends BaseService<
|
||||
);
|
||||
|
||||
// Retrieve Nlu Penalty Factor from global settings
|
||||
const nluPenaltyFactor = await this.getDefaultNluPenaltyFactor();
|
||||
const nluPenaltyFactor: number =
|
||||
await this.getDefaultNluPenaltyFactor();
|
||||
|
||||
if (nluPenaltyFactor < 0 || nluPenaltyFactor > 1) {
|
||||
throw new Error('Penalty Factor must be between 0 and 1.');
|
||||
}
|
||||
|
||||
// Proceed with matching the best NLP block
|
||||
if (matchesWithPatterns.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user