@bavard/agent-config
Advanced tools
Comparing version 0.0.37 to 0.0.38
@@ -49,3 +49,3 @@ "use strict"; | ||
const result = { | ||
id: action.nodeId, | ||
nodeId: action.nodeId, | ||
name: action.actionName, | ||
@@ -62,3 +62,3 @@ type: __1.EAgentActionTypes.EMAIL_ACTION, | ||
const result = { | ||
id: action.nodeId, | ||
nodeId: action.nodeId, | ||
name: action.actionName, | ||
@@ -65,0 +65,0 @@ type: __1.EAgentActionTypes[action.type], |
@@ -9,3 +9,3 @@ import { IResponseOption } from './response-options'; | ||
interface IBaseAgentAction { | ||
id?: number; | ||
nodeId?: number; | ||
name: string; | ||
@@ -12,0 +12,0 @@ type: EAgentActionTypes; |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.0.37", | ||
"version": "0.0.38", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -49,3 +49,3 @@ import { EAgentActionTypes, IAgentAction, IEmailAction } from '../..'; | ||
const result: IEmailAction = { | ||
id: action.nodeId, | ||
nodeId: action.nodeId, | ||
name: action.actionName, | ||
@@ -62,3 +62,3 @@ type: EAgentActionTypes.EMAIL_ACTION, | ||
const result: IAgentAction = { | ||
id: action.nodeId, | ||
nodeId: action.nodeId, | ||
name: action.actionName, | ||
@@ -65,0 +65,0 @@ type: EAgentActionTypes[action.type], |
@@ -12,3 +12,3 @@ import { IResponseOption } from './response-options'; | ||
interface IBaseAgentAction { | ||
id?: number; | ||
nodeId?: number; // Used for graph policies only. Identifies the node corresponding to this action. | ||
name: string; | ||
@@ -15,0 +15,0 @@ type: EAgentActionTypes; |
import { assert } from 'chai'; | ||
import { EmailAction } from '../src/actions/agent/email-action'; | ||
import { AgentConfig, UtteranceAction } from '../src'; | ||
import { AgentConfig, UtteranceAction, TextOption } from '../src'; | ||
@@ -62,2 +62,13 @@ describe('Agent Config', () => { | ||
}); | ||
it('Test Action Options', async () => { | ||
const config = new AgentConfig('test', 'test'); | ||
config.addIntent('greeting', 'greeting'); | ||
config.addAction(new UtteranceAction('greeting', 'greeting')); | ||
config.getActionByName('greeting')?.options.push(new TextOption('x', 'x')); | ||
const jsonConfig = config.toJsonObj(); | ||
const fromConfig = AgentConfig.fromJsonObj(jsonConfig); | ||
assert.equal(fromConfig.getActionByName('greeting')?.options.length, 1); | ||
}); | ||
}); |
153097
391
4337