IBM Watson Assistant:如何动态设置“跳转到"目标节点(即使用上下文变量) [英] IBM Watson Assistant: How to set a 'jump to' target node dynamically (i.e. using context variables)

查看:100
本文介绍了IBM Watson Assistant:如何动态设置“跳转到"目标节点(即使用上下文变量)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从对话框节点跳转到其ID存储在上下文变量中的节点.

I want to jump from a dialog node to a node the ID of which is stored in a context variable.

我正在尝试解决与题外话有关的问题,该问题已在此处进行了描述:

I'm trying to solve a problem that has to do with a digression and which has been described here:

在Watson Assistant中有条件地从题外话中返回

尤其是此图表将问题可视化:

Especially this chart visualizes the problem:

我认为A.H.提出了一个非常合理和相关的问题,没有可行的答案.

In my opinion, A.H. posed a very reasonable and relevant question that has got no viable answer.

据我所知,题外话设置无法解决问题.将根级别节点(通过匹配意图#Want_to_speak_to_someone触发)设置为离题后返回".

As far as I can see the problem can not be solved by digression settings. Either the root level node (triggered by matching the intent # Want_to_speak_to_someone) is set to 'return after digression' or it is not.

如果此题外话节点的题外话设置设置为"return",则它将始终返回-不管该题外话对话框中进一步发生的情况如何.即使用户确认他想与某人讲话(即他不想返回),该对话框也将返回到题外话的结点.

If the digression setting of this digression node is set to 'return' it will always return - no matter what happens further down in the dialog flow of this digression. Even if the user confirms that he wants to speak to a person (i.e. he does not want to return) the dialog will return to the node where the digression started.

当我从yes节点(用户确认他想和某人说话)跳到其他任何节点时,甚至会发生这种情况.分支(或用户跳转到的分支)一结束,对话框便返回到题外话的节点.

This even happens when I jump from the yes-node (user confirms that he wants to speak to a person) out to any other node. As soon as the branch (or the branch the user jumped to) ends the dialog returns to the node where digression started.

但是,如果将此离题节点的离题设置设置为不返回",则即使用户决定不与某人讲话并选择返回原处,也无法返回.

If the digression setting of this digression node is set to 'does not return' however, a return is not possible - even if the user decides against speaking to a person and opts for returning to where he was.

我想要的A.H.是用户可以脱离对话流程,并且仍然可以决定是否要返回.我认为这是对话框非常自然且重要的功能.人们喜欢推翻他们的决定,或者他们甚至无意中偏离了给定的对话流程.

What A.H. and I want is that the user can digress from a dialog flow and can still decide whether he wants to return or not. I think this is a pretty natural and important feature of a dialog. People like to reverse their decision or maybe they even digressed unintentionally from the given dialog flow.

Akaykay建议有两个不同的节点-一个"yes-node"(允许返回)和一个"no-node"(不允许返回).但这是行不通的,因为在此之前,我必须先有另一个节点要求用户进行确认-并且此确认节点"必须设置为返回"或不返回"(解决上述问题) ).

Akaykay proposed to have two different nodes - a 'yes-node' which allows returning and a 'no-node' that does not allow returning. But this doesn't work, because before that I must have another node that asks the user for confirmation - and this 'confirmation-node' has to be set either to 'return' or 'does not return' (yielding the problems described above).

由于这个原因,我试图找出一种解决方法:我将对话框从中导出的对话框节点ID存储在上下文变量中.

For this reason, I tried to figure out a workaround: I store the dialog node ID from which the dialog digresses in a context variable.

这是一个上下文变量


"context": {
        "last_node": "<? output.nodes_visited [0]?>",
        ...
      },

在对话流的每个节点中都会更新,从而允许离题.

which gets updated in every node of a dialog flow which allows digression.

在该示例中,如果用户想要返回,则可以跳回到$ last_node,如果用户想与某人讲话,则可以跳至另一个(固定)节点-离题节点"的离题设置将不干涉,可以设置为不返回".

In the example I could then jump back to the $last_node if the user wants to return and I could jump to another (fixed) node if the user wants to speak to a person - digressions settings of the 'digression node' would not interfere and could be set to 'does not return'.

然后我尝试在我的技能的json文件中编辑相应的节点(从该节点返回到$ last_node):

Then I tried to edit the respective node (from which to return to the $last_node) in the json file of my skill:

"next_step": {
        "behavior": "jump_to",
        "selector": "user_input",
        "dialog_node": "$last_node"
      },

但是当我再次重新导入skill-json-file时,我收到此错误消息:

But when I reimport the skill-json-file again I get this error message:

无论哪种解决方案都可以-一种使用离题设置的解决方案,或者一种允许动态设置跳转到"目标节点的解决方案.我非常感谢您的帮助-谢谢!

I would be fine with either solution - one that uses digression settings or one that allows setting the 'jump to' target node dynamically. I deeply appriciate any help - thanks!

推荐答案

如果要阻止Watson Assistent从离题返回,只需在不希望Watson Assistant从离题返回的节点中调用<? clearDialogStack() ?>函数,然后而已.

If you want to prevent Watson Assistent from returning from digression just call <? clearDialogStack() ?> function in the node where you don't want Watson Assistant to return from digression and that's it.

在图表中,您将在节点确定,单击此处"的输出文本中写入"Ok, click here. <?clearDialogStack()?>".这应该可以解决问题.

In your chart you would write "Ok, click here. <?clearDialogStack()?>" in the output text of the node "Ok, click here." and that should do the trick.

此处在本节的文档中: https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-digressions

Here it is in the doc in this section: https://cloud.ibm.com/docs/services/assistant?topic=assistant-dialog-runtime#dialog-runtime-digressions

还请注意,当前无法使用Watson Assistant创建动态gotos.唯一可以做的就是创建一个对话框节点,其中所有必需的gotos受其下面的条件限制,然后转到该节点.手动创建很难,但是可以自动生成.有关WA的更多信息,请查看以下项目:

Also note that currently it is not possible to create dynamic gotos with Watson Assistant. Only thing you can do is to create a dialog node with all the needed gotos conditioned by something underneath it and then you would goto this node. It is hard to create this manually but it can be generated automatically. For more magic with WA check out this project:

https://github.com/IBM/watson-assistant-workbench

完全可以在没有UI的情况下使用WA开发聊天机器人.

It is possible to develop chatbots with WA completely without UI.

这篇关于IBM Watson Assistant:如何动态设置“跳转到"目标节点(即使用上下文变量)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆