如何在法兰克福使用Watson的Node-RED或node-sdk的Watson Conversation服务? [英] How do I use a Watson Conversation service in Frankfurt using Node-RED or the node-sdk for Watson?

查看:86
本文介绍了如何在法兰克福使用Watson的Node-RED或node-sdk的Watson Conversation服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用node-red-node-watson库调用IBM Cloud在美国南部地区托管的Watson Conversation实例.如果我在德国地区尝试过,那是行不通的.

I'm able to use the node-red-node-watson library to call an instance of Watson Conversation hosted in the US-South region of IBM Cloud. If I try it in the Germany region, it does not work.

github 我发现了以下行

ConversationV1.URL = 'https://gateway.watsonplatform.net/conversation/api';

,这是在美国南部进行会话的URL. Bluemix VCAP_SERVICES中显示的针对法兰克福实例的URL是不同的:

which is the URL for Conversation in US-South. The URL shown in Bluemix VCAP_SERVICES for the Frankfurt instance is different:

 "https://gateway-fra.watsonplatform.net/conversation/api"

我不确定硬编码的URL是否只是默认值,我只是错过了从VCAP_SERVICES读取实际URL的代码,或者这实际上是一个错误.

I'm not sure if the hard-coded URL is just a default and I just missed the code reading the actual URL from VCAP_SERVICES or if this is actually a bug.

有人在美国南部以外的地区成功使用Node-RED节点进行Watson对话吗?

Has somebody successfully used the Node-RED node for Watson Conversation within a region other than US-South?

推荐答案

初始化会话对象时,应该可以设置正确的基本URL.这是针对Node SDK,而不是Node-RED:

When you initialize the Conversation object it should be possible to set the correct base URL. This is for Node SDK, not Node-RED:

// Create the service wrapper
var conversation = new Conversation({
   username: '<username>',
   password: '<password>',
   url: 'https://gateway-fra.watsonplatform.net/conversation/api',
  version_date: Conversation.VERSION_DATE_2017_04_21
});

我对Python SDK更加熟悉,并且同样适用于我(仅在Python中:).

I more familiar with the Python SDK and there the same (only in Python :) is working successfully for me.

对于Node-RED,有两种情况.当会话服务绑定到Node-RED应用程序时,则包括URL在内的凭据均来自VCAP环境.这对我有用,应该对您有用.如果服务未绑定,则基于

For Node-RED there are two scenarios. When the Conversation service is bound to the Node-RED app, then the credentials including URL are taken from the VCAP environment. This works for me and should for you. If the service is not bound then there is a "feature gap" based on the Conversation Node source code.

这篇关于如何在法兰克福使用Watson的Node-RED或node-sdk的Watson Conversation服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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