【发布时间】:2019-02-04 17:15:32
【问题描述】:
如何从另一个意图返回具有槽值的意图?
我想通过在另一个意图中返回它的槽值来触发一个意图。
这是我的 JSON 文件的示例:
{
"interactionModel": {
"languageModel": {
"invocationName": "movie antakshari",
"intents": [
{
"name": "SchoolIntent",
"slots": [
{
"name": "Subject",
"type": "subjects"
}
],
"samples": ["{subjects}"]
},
{
"name": "teachersIntent",
"slots": [],
"samples": ["teachers"]
},
],
"types": [
{
"name": "subjects",
"values": [
{
"name": {"value": "maths"}
},
{
"name": {"value": "english"}
}
]
}
]
}
}
}
这是我的 index.js 文件:
const teacherIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'teacherIntent';
},
handle(handlerInput) {
if (some condition) {
// Here I want to return the schoolIntentHandler with a slot value maths
}
}
}
【问题讨论】:
-
你想从teacherIntent触发schoolIntentHandler吗?