我正在设计Watson对话框以支持以下场景:用户选择意图1,2或3.当用户选择意图2时,Watson将要求用户指定选项1或2或其他有效意图。
以下是我当前的对话文件:
<?xml version="1.0" encoding="UTF-8"?>
<dialog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="WatsonDialogDocument_1.0.xsd">
<flow>
<folder label="Main" id="Main">
<output id="start">
<prompt selectionType="RANDOM">
<item>DIALOG START - asking for user input</item>
</prompt>
<goto ref="processUserInput_start"/>
</output>
<getUserInput id="processUserInput_start">
<search ref="library_supported-intents"/>
<default>
<output>
<prompt selectionType="RANDOM">
<item>I am sorry, I did not understand your intents. Please choose intent1, intent2, or intent3.</item>
</prompt>
</output>
</default>
</getUserInput>
<getUserInput id="processUserInput_intent2">
<search ref="library_supported-intents"/>
<input>
<grammar>
<item>option1</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>OK. Executing intent 2 with option 1</item>
</prompt>
</output>
<goto ref="processUserInput_start"/>
</input>
<input>
<grammar>
<item>option2</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>OK. Executing intent 2 with option 2</item>
</prompt>
</output>
<goto ref="processUserInput_start"/>
</input>
<output>
<prompt selectionType="RANDOM">
<item>Sorry, I can only understand option1 and option2 for intent2. Try again</item>
</prompt>
<goto ref="processUserInput_intent2"/>
</output>
</getUserInput>
</folder>
<folder label="Library" id="Library">
<folder label="Main Input" id="library_supported-intents">
<input>
<grammar>
<item>intent1</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>OK. Executing intent 1</item>
</prompt>
</output>
</input>
<input>
<grammar>
<item>intent2</item>
</grammar>
<goto ref="intent2-detail"/>
</input>
<input>
<grammar>
<item>intent3</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>OK. Executing intent 3</item>
</prompt>
</output>
</input>
</folder>
<folder label="Intent 2 Input" id="library_intent2">
<output id="intent2-detail">
<prompt selectionType="RANDOM">
<item>OK. I need further info to execute intent 2. Choose option1 or option2</item>
</prompt>
<goto ref="processUserInput_intent2"/>
</output>
</folder>
</folder>
<folder label="Concepts" id="Concepts"></folder>
</flow>
</dialog>
不幸的是,我无法显示正确的无效对话框消息 - 例如Watson显示无效选项而不是无效意图消息,如下所示:
如何构建恢复对话框流以实现上述方案?
答案 0 :(得分:0)
尝试将goto放在输出节点
中 <input>
<grammar>
<item>option1</item>
</grammar>
<output>
<prompt selectionType="RANDOM">
<item>OK. Executing intent 2 with option 1</item>
</prompt>
<goto ref="processUserInput_start"/>
</output>
</input>