fix: enforce nlp entity weight restrictions

This commit is contained in:
MohamedAliBouhaouala
2025-04-23 15:12:50 +01:00
parent df9f192635
commit 5a775a25c8
2 changed files with 2 additions and 2 deletions

View File

@@ -82,7 +82,7 @@ For each entity in the block's pattern:
- `Confidence` is a value between 0 and 1, returned by the NLU engine.
- `Weight` is a configured importance factor for that specific entity type.
- If the match is a wildcard (i.e., the block accepts any value):
- A **penalty factor** is applied to slightly reduce its contribution:
- A **penalty factor** is applied to slightly reduce its contribution:
``confidence × weight × penaltyFactor``. This encourages more specific matches when available.
### Scoring Formula Summary

View File

@@ -61,7 +61,7 @@ export class NlpEntityStub extends BaseSchema {
/**
* Entity's weight used to determine the next block to trigger in the conversational flow.
*/
@Prop({ type: Number, default: 1 })
@Prop({ type: Number, default: 1, min: 0 })
weight: number;
/**