IBM Watson助手:如何在新动作技巧中获得随机回应

发布于 2025-01-23 22:07:29 字数 247 浏览 4 评论 0原文

在沃森对话框中,有一个随机生成多个响应的选项。让它感觉不那么机器人。

在新的动作技能中,他们没有此选项。有没有办法复制它?

In the Watson Dialog there is an option to generate multiple responses randomly. Allowing it to feel less robotic.

Picture of the UI showing 3 random text messages

In the new Actions skills they do not have this option. Is there a way to reproduce it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世态炎凉 2025-01-30 22:07:29

更新:

  1. spel不再支持响应。因此,下面的示例代码仅在分配给变量时才起作用,然后在响应中使用该变量。

  2. 动作现在具有创建多个响应的能力。


如果您有简单的一行响应,则以下代码段将在响应中起作用。

<? {
0: "Message 1",
1: "Message 2",
2: "Message 3"
}[new java.util.Random().nextInt(3)]
?>

3NextInt(3)中必须是随机响应的总数。

如果您有更详细的响应,则可以分配上下文变量java.util.random()。nextint(3)(再次将3更改为总响应)。然后将其用作步骤中的条件。

Updates:

  1. SpEL is no longer supported in responses. So the sample code below will only work if assigned to a variable, then that variable is used in the response.

  2. Actions now has the ability to create multiple responses.


If you have simple one line responses then the following code snippet will work in a response.

<? {
0: "Message 1",
1: "Message 2",
2: "Message 3"
}[new java.util.Random().nextInt(3)]
?>

The 3 in nextInt(3) must be the total number of random responses.

If you have more detailed responses to give then you can assign a context variable a value of java.util.Random().nextInt(3) (again changing 3 to total responses). Then use that as a conditional in the steps.

New Actions steps showing messages

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文