如何将响应值从扩展名传递到IBM Watson Assistant聊天中的自定义响应类型?

发布于 2025-02-10 19:09:47 字数 664 浏览 3 评论 0原文

以下JSON定义了客户端的自定义响应以允许自定义UI。根据文档 https:/// cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-response-types-referend#user_defined 我可以为“ user_defined”对象定义“任何东西”我的扩展响应提供的变量。

{
  "generic": [
    {
      "user_defined": {
        "default_color": "blue",
        "template_name": "color_picker",
        "my_response_value": "???"
      },
      "response_type": "user_defined"
    }
  ]
}

The below JSON defines custom response for the client to allow custom UI. As per the documentation https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-response-types-reference#user_defined I can define "anything" for the "user_defined" object but I am failing to understand how to pass the variable as provided by my extension response.

{
  "generic": [
    {
      "user_defined": {
        "default_color": "blue",
        "template_name": "color_picker",
        "my_response_value": "???"
      },
      "response_type": "user_defined"
    }
  ]
}

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

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

发布评论

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

评论(1

鹿港小镇 2025-02-17 19:09:47

因此,经过一定的反复试验,似乎它与此处所述的lang表达式合作 https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-call-call-call-extension #extension #extension #extension-check-check-

{
  "generic": [
    {
      "user_defined": {
        "default_color": "blue",
        "template_name": "color_picker",
        "my_second_value": "${step_170_result_1.body.base_code}"
      },
      "response_type": "user_defined"
    }
  ]
}

status 属性“ my_second_value”将被“会话变量/扩展响应”中的值代替。您的参考将在步骤值和结果值中有所不同。

So after some trial and error it seems that it works with the expression lang as described here https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-call-extension#extension-check-status

For example

{
  "generic": [
    {
      "user_defined": {
        "default_color": "blue",
        "template_name": "color_picker",
        "my_second_value": "${step_170_result_1.body.base_code}"
      },
      "response_type": "user_defined"
    }
  ]
}

Here the property "my_second_value" will be replaced by the value from the "session variables/extension response". Your reference will differ in the step value and result value.

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