简体   繁体   English

如何在法兰克福使用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?

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. 我能够使用node-red-node-watson库调用在IBM Cloud的美国南部地区托管的Watson Conversation实例。 If I try it in the Germany region, it does not work. 如果我在德国地区尝试过,那是行不通的。

In github I spotted the following line github中,我发现了以下行

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

which is the URL for Conversation in US-South. 这是在美国南部进行会话的网址。 The URL shown in Bluemix VCAP_SERVICES for the Frankfurt instance is different: Bluemix VCAP_SERVICES中显示的针对法兰克福实例的URL是不同的:

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

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. 我不确定硬编码的URL是否只是默认值,而只是错过了从VCAP_SERVICES读取实际URL的代码,或者这实际上是一个错误。

Has somebody successfully used the Node-RED node for Watson Conversation within a region other than US-South? 是否有人成功将Node-RED节点成功用于美国南部以外的其他地区的Watson对话?

When you initialize the Conversation object it should be possible to set the correct base URL. 初始化会话对象时,应该可以设置正确的基本URL。 This is for Node SDK, not Node-RED: 这是针对Node SDK,而不是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
});

I more familiar with the Python SDK and there the same (only in Python :) is working successfully for me. 我对Python SDK更加熟悉,并且同样(仅在Python:中)对我来说是成功的。

For Node-RED there are two scenarios. 对于Node-RED,有两种情况。 When the Conversation service is bound to the Node-RED app, then the credentials including URL are taken from the VCAP environment. 当会话服务绑定到Node-RED应用程序时,则包括URL在内的凭据均来自VCAP环境。 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 . 如果服务未绑定,则基于会话节点源代码会存在“功能差距”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM