【发布时间】:2020-01-09 04:45:58
【问题描述】:
我应该做哪些修改才能为 Alexa 运行相同的操作
我需要通过单个规范文件运行 convo 文件,就像 botium-core 项目中给出的相同示例一样。因为我发现很难为 Alexa 配置规范文件,而 Botium-core 中没有给出示例
像 botium core 的 fillScriptingMemoryFromFile.spec.js 一样为 Amazon Alexa 设置 Botium 规范
Convos 文件夹
• 包含 2 个文件
1.product.xlsx - product1 维也纳炸肉排
2. 购买.convo
Examplefile.spec
Note - I want the configuration for Amazon.In botium core its not give for Alexa
const path = require('path')
const assert = require('chai').assert
const BotDriver = require('../../../').BotDriver
const Capabilities = require('../../../').Capabilities
const echoConnector = ({ queueBotSays }) => {
return {
UserSays (msg) {
const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: `You said: ${msg.messageText}` }
queueBotSays(botMsg)
}
}
describe('scripting.scriptingmemory.memoryenabled.originalkept', function () {
beforeEach(async function () {
const myCaps = {
[Capabilities.PROJECTNAME]: 'scripting.scriptingmemory', // "my project name here i've given" . Is this correct ??
[Capabilities.CONTAINERMODE]: echoConnector, // "alexa-smapi",
[Capabilities.SCRIPTING_XLSX_SHEETNAMES_SCRIPTING_MEMORY]: 'ScriptingMemory', // What should I give here ??
[Capabilities.SCRIPTING_XLSX_SHEETNAMES]: 'Convos', // What should I give here ??
[Capabilities.SCRIPTING_ENABLE_MEMORY]: true,
[Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: true
}
const driver = new BotDriver(myCaps)
this.compiler = driver.BuildCompiler()
this.container = await driver.Build()
})
afterEach(async function () {
this.container && await this.container.Clean()
})
it('Original convo kept', async function () {
this.compiler.ReadScriptsFromDirectory(path.resolve(__dirname, 'convosSimple')) // This is the folder in which i have convo file
this.compiler.ExpandScriptingMemoryToConvos()
assert.equal(this.compiler.convos.length, 2) // why 2 ???
})
})
最后我们使用 mocha run "spec file name" 运行规范
我需要帮助来配置它,以便我可以在 package.json 中的“脚本标签”下为每个场景创建单独的测试运行。所以当我有 10 个意图时,我可以将每个意图分类为唯一的规范名称并使用“mocha 规范名称”
【问题讨论】:
标签: javascript bots chatbot