![](/img/trans.png)
[英]Node.js - Combine IBM Watson Discovery and Conversation Services
[英]IBM Watson Conversation - Unable to connect node.js to watson conversation
我對IBM Watson Conversation Application有問題。
我已經設置了我的應用程序,並嘗試將其連接到我的node.js應用程序。 我在這里關注本教程: https : //github.com/watson-developer-cloud/node-sdk#conversation,並且我使用的是ibm ibm提供的官方api。
不幸的是,它不起作用,並且出現以下錯誤。
{ Error: Not Authorized
at Request._callback (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/lib/requestwrapper.js:87:15)
at Request.self.callback (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/Volumes/hd2/Projekte/vi-com-bot-service/node_modules/watson-developer-cloud/node_modules/request/request.js:1091:12)
at IncomingMessage.g (events.js:291:16)
at emitNone (events.js:91:20)
code: 401,
error: 'Not Authorized',
description: '2017-06-01T08:57:57-04:00, Error ERCDPLTFRM-DNLKUPERR occurred when accessing https://gateway.watsonplatform.net/conversation/api/v1/workspaces/dc8097e8-fea7-47a3-80ed-57c43321377e/message?version=2017-04-21, Tran-Id: gateway-dp01-2475007148 - Invalid UserId and/or Password. Please confirm that your credentials match the end-point you are trying to access. A common error is trying to use credentials from an experimental or beta release against a GA release or vice versa' }
我提供的憑據是正確的。
你有一個主意,為什么我不工作? 最好,本
Bluemix有許多可以托管服務的區域。 每個區域都有不同的網關。 默認情況下為https://gateway.watsonplatform.net
。
對於德國+法國地區,您可以在代碼中設置以下URL變量:
url: 'https://gateway-fra.watsonplatform.net/conversation/api/'
像這樣:
var conversation = new ConversationV1({
username: '<username>',
password: '<password>',
url: 'https://gateway-fra.watsonplatform.net/conversation/api/',
version_date: ConversationV1.VERSION_DATE_2017_05_26
});
對於其他區域,您可以進入Watson對話服務憑據以查看URL。 或對話工作區的“部署”,然后是“憑據”部分。
這是修訂后的Watson Assistant的IBM Cloud API的鏈接,其中包括node.js的代碼示例和URL列表(請參閱“服務端點”)。
var ConversationV1= require('watson-developer-cloud/conversation/v1');
var conversation = new ConversationV1({
username:'<username>',
password: '<Password>',
version_date: 'Date'
});
conversation.message({
workspace_id:'<Workspace Id>',
context: userContext,
input: {
"text": "<text>"
}
},function(err,resp){
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.