@bavard/agent-config
Advanced tools
Comparing version 0.0.59 to 0.0.60
@@ -12,3 +12,3 @@ "use strict"; | ||
const utterance_action_1 = require("./actions/agent/utterance-action"); | ||
const limits_1 = require("./limits"); | ||
const constants_1 = require("./constants"); | ||
const form_action_1 = require("./actions/agent/form-action"); | ||
@@ -25,3 +25,3 @@ const packageJson = require('../package.json'); | ||
this.language = 'EN_US'; | ||
this.intentConfidenceThreshold = 0.6; | ||
this.intentConfidenceThreshold = constants_1.DEFAULT_CONFIDENCE_THRESHOLD; | ||
this.disabled = false; | ||
@@ -69,4 +69,4 @@ this.slots = []; | ||
addIntent(name, defaultActionName) { | ||
if (this.intents.length >= limits_1.MAX_INTENT_COUNT) { | ||
throw new Error(`Intent count exceeds maximum count: ${limits_1.MAX_INTENT_COUNT}`); | ||
if (this.intents.length >= constants_1.MAX_INTENT_COUNT) { | ||
throw new Error(`Intent count exceeds maximum count: ${constants_1.MAX_INTENT_COUNT}`); | ||
} | ||
@@ -88,4 +88,4 @@ if (this.intents.find((x) => x.name === name)) { | ||
addTagType(tagType) { | ||
if (this.tagTypes.size >= limits_1.MAX_TAG_TYPE_COUNT) { | ||
throw new Error(`Tag type count exceeds maximum count: ${limits_1.MAX_TAG_TYPE_COUNT}`); | ||
if (this.tagTypes.size >= constants_1.MAX_TAG_TYPE_COUNT) { | ||
throw new Error(`Tag type count exceeds maximum count: ${constants_1.MAX_TAG_TYPE_COUNT}`); | ||
} | ||
@@ -131,4 +131,4 @@ this.tagTypes.add(tagType); | ||
addGraphPolicy(policy) { | ||
if (this.graphPolicies.size >= limits_1.MAX_GRAPH_POLICY_COUNT) { | ||
throw new Error(`Graph Policy count exceeds maximum count: ${limits_1.MAX_GRAPH_POLICY_COUNT}`); | ||
if (this.graphPolicies.size >= constants_1.MAX_GRAPH_POLICY_COUNT) { | ||
throw new Error(`Graph Policy count exceeds maximum count: ${constants_1.MAX_GRAPH_POLICY_COUNT}`); | ||
} | ||
@@ -188,3 +188,3 @@ this.graphPolicies.set(policy.policyName, policy); | ||
config.language = jsonObj.language; | ||
config.intentConfidenceThreshold = jsonObj.intentConfidenceThreshold; | ||
config.intentConfidenceThreshold = jsonObj.intentConfidenceThreshold || constants_1.DEFAULT_CONFIDENCE_THRESHOLD; | ||
config.setDisabled(jsonObj.disabled); | ||
@@ -191,0 +191,0 @@ for (const slot of jsonObj.slots || []) { |
@@ -16,3 +16,3 @@ "use strict"; | ||
const sanitize_html_1 = __importDefault(require("sanitize-html")); | ||
const limits_1 = require("../limits"); | ||
const constants_1 = require("../constants"); | ||
const form_node_1 = require("./nodes/form-node"); | ||
@@ -73,4 +73,4 @@ class GraphPolicy { | ||
const node = frontier.shift(); | ||
if (this.nodes.size >= limits_1.MAX_GRAPH_POLICY_NODE_COUNT) { | ||
throw new Error(`Graph Policy node count exceeds maximum count: ${limits_1.MAX_GRAPH_POLICY_NODE_COUNT}`); | ||
if (this.nodes.size >= constants_1.MAX_GRAPH_POLICY_NODE_COUNT) { | ||
throw new Error(`Graph Policy node count exceeds maximum count: ${constants_1.MAX_GRAPH_POLICY_NODE_COUNT}`); | ||
} | ||
@@ -220,4 +220,4 @@ this.nodes.add(node); | ||
if (!policy.getNodeById(node.nodeId)) { | ||
if (policy.nodes.size >= limits_1.MAX_GRAPH_POLICY_NODE_COUNT) { | ||
throw new Error(`Graph Policy node count exceeds maximum count: ${limits_1.MAX_GRAPH_POLICY_NODE_COUNT}`); | ||
if (policy.nodes.size >= constants_1.MAX_GRAPH_POLICY_NODE_COUNT) { | ||
throw new Error(`Graph Policy node count exceeds maximum count: ${constants_1.MAX_GRAPH_POLICY_NODE_COUNT}`); | ||
} | ||
@@ -224,0 +224,0 @@ policy.nodes.add(node); |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.0.59", | ||
"version": "0.0.60", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,3 +7,3 @@ import { BaseAgentAction } from './actions/agent/base-action'; | ||
import { UtteranceAction } from './actions/agent/utterance-action'; | ||
import { MAX_INTENT_COUNT, MAX_TAG_TYPE_COUNT, MAX_GRAPH_POLICY_COUNT } from './limits'; | ||
import { MAX_INTENT_COUNT, MAX_TAG_TYPE_COUNT, MAX_GRAPH_POLICY_COUNT, DEFAULT_CONFIDENCE_THRESHOLD } from './constants'; | ||
import { FormAction } from './actions/agent/form-action'; | ||
@@ -22,3 +22,3 @@ const packageJson = require('../package.json'); | ||
public language = 'EN_US'; | ||
public intentConfidenceThreshold = 0.6; | ||
public intentConfidenceThreshold = DEFAULT_CONFIDENCE_THRESHOLD; | ||
private disabled = false; | ||
@@ -221,3 +221,3 @@ private slots: ISlot[] = []; | ||
config.language = jsonObj.language; | ||
config.intentConfidenceThreshold = jsonObj.intentConfidenceThreshold; | ||
config.intentConfidenceThreshold = jsonObj.intentConfidenceThreshold || DEFAULT_CONFIDENCE_THRESHOLD; | ||
@@ -224,0 +224,0 @@ config.setDisabled(jsonObj.disabled); |
@@ -24,3 +24,3 @@ import GraphPolicyNode from './nodes/base-node'; | ||
import { IHyperlinkOption } from '../response-options'; | ||
import { MAX_GRAPH_POLICY_NODE_COUNT } from '../limits'; | ||
import { MAX_GRAPH_POLICY_NODE_COUNT } from '../constants'; | ||
import { FormNode } from './nodes/form-node'; | ||
@@ -27,0 +27,0 @@ |
@@ -9,3 +9,3 @@ import { assert } from 'chai'; | ||
import UtteranceNode from '../src/graph-policy/nodes/utterance-node'; | ||
import { MAX_GRAPH_POLICY_COUNT, MAX_INTENT_COUNT, MAX_TAG_TYPE_COUNT } from '../src/limits'; | ||
import { MAX_GRAPH_POLICY_COUNT, MAX_INTENT_COUNT, MAX_TAG_TYPE_COUNT } from '../src/constants'; | ||
@@ -12,0 +12,0 @@ describe('Agent Config', () => { |
@@ -13,3 +13,3 @@ import { FormNode, UtteranceNode } from '../src/graph-policy'; | ||
import { ImageOption, TextOption } from '../src/response-options'; | ||
import { MAX_GRAPH_POLICY_NODE_COUNT } from '../src/limits'; | ||
import { MAX_GRAPH_POLICY_NODE_COUNT } from '../src/constants'; | ||
import { EFormFieldTypes } from '../src'; | ||
@@ -16,0 +16,0 @@ import { FormNodeShema } from '../src/graph-policy/validator'; |
210293
5896