IBM Watson: How do I add a hyperlink to Watson Responses?

强颜欢笑 提交于 2019-12-13 18:26:13

问题


I've tried other responses mentioned on other forums but I'm still not able to get the right result.

As of this moment, this is what the layout looks like

Any help would be much appreciated!


回答1:


Add in your Watson response the HTML tag, the browser will render:

The link to go to google is: click <a  target="_blank" href="https://google.com.br">Google</a>.<br/><br/>

Add inside Watson response:

Tested hyperlink:

Obs.: Check inside Try it out, this does not work, but inside your Web application, all will works fine. This is valid for other <html> tag, for example: <button>, etc

I Answer the same question here. Answer with more details and images here.




回答2:


replace the "quotation marks" around the link with 'apostrophe'

{
  "output": {
    "text": {
      "values": [
        "say something <a href='http://www.website.com/'>link text</a>"
      ],
      "selection_policy": "sequential"
    }
  }
}



回答3:


You need to pass the hyperlink through the context

Example (using python at backend) -

response['context']['link'] = "www.google.com"
conversation.message(workspace_id=workspace_id,
    message_input={'text': user_input},
    context=response['context'])

Now in your dialog

{
  "context": {},
  "output": {
    "text": {
      "values": [
        "$link"
      ],
      "selection_policy": "sequential"
    }
  }
}

So the values you pass in context are displayed prefix $



来源:https://stackoverflow.com/questions/43622965/ibm-watson-how-do-i-add-a-hyperlink-to-watson-responses

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!