0

我正在设计 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 显示无效选项而不是无效意图消息,如下所示:

在此处输入图像描述

我应该如何构建恢复对话流程来实现上述场景?

4

1 回答 1

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>
于 2016-03-26T19:04:58.773 回答