在IBM Watson对话服务中的响应中显示图像或PDF文件 [英] Show images or PDFs files in a response in IBM watson conversation service

查看:77
本文介绍了在IBM Watson对话服务中的响应中显示图像或PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个Watson对话服务,并使用Bluemix中提供的向导将其连接到Slack. 它尚未连接到应用程序(例如Java等),它是使用bluemix对​​话框工具构建的. 我的问题是:如何显示图像或pdf文件作为响应?

解决方案

在对话框工具本身中,您将无法查看除文本之外的任何其他类型的媒体.测试面板中的输出将仅显示该节点的输出.

当部署到Web应用程序之类的应用程序时,输出节点将看起来像这样,其中包含HTML标记:

{
  "output": {
    "text": {
      "values": [
        "Hello world <a href="www.test.com">Click here</a>"
      ],
      "selection_policy": "sequential"
    }
  }
}

在这种情况下,要显示图像,您只需将链接标记替换为HTML图像等.

可以在此处找到示例入门工具包 https://github.com/watson -developer-cloud/conversation-simple

您将需要一个业务流程层来将编码处理为所需的平台格式,例如FB Messenger需要传递诸如

之类的对象

"buttons":[
  {
    "type":"web_url",
    "url":"https://petersfancyapparel.com/criteria_selector",
    "title":"Select Criteria",
    "webview_height_ratio": "full",
    "messenger_extensions": true,  
    "fallback_url": "https://petersfancyapparel.com/fallback"
  }
]

编排层示例(例如 Botmaster )可以与扩展扩展一起使用,这将允许您创建这些对象并在Watson对话框中,只需添加自定义XML标记.例如www.google.com,然后将其传递到业务流程层,该流程层将发送相关的对象.可以在此处和其他一些Facebook动作中找到使用此方法的代码示例. >

I built a watson conversation service and I connected it to Slack using the provided wizard in Bluemix. This is not connected to an application yet (such as Java, etc), it was built using the bluemix dialog tool. My question is: How can I show images or pdf files as a response?

解决方案

Within the dialog tool itself you will not be able to view any other type of media other than text. The output in the test panel will simply show the output from the node.

When deployed to an application such as a web application the output node would look something like this containing HTML markup:

{
  "output": {
    "text": {
      "values": [
        "Hello world <a href="www.test.com">Click here</a>"
      ],
      "selection_policy": "sequential"
    }
  }
}

In this case to display an image you would simply replace the link tag with that of an HTML image etc.

An example starter kit can be found here https://github.com/watson-developer-cloud/conversation-simple

You will need an orchestration layer to handle the encoding to the desired platform format e.g FB messenger requires an object to be passed such as

"buttons":[
  {
    "type":"web_url",
    "url":"https://petersfancyapparel.com/criteria_selector",
    "title":"Select Criteria",
    "webview_height_ratio": "full",
    "messenger_extensions": true,  
    "fallback_url": "https://petersfancyapparel.com/fallback"
  }
]

An example orchestration layer such as Botmaster can be used alongside its extension fulfill that will allow you to creatr these objects and in the Watson dialog simply just add custom XML tags. E.g www.google.com this will then be passed to the orchestration layer which will send the relevant object. A code example using this method can be found here with some other Facebook actions.

这篇关于在IBM Watson对话服务中的响应中显示图像或PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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