繁体   English   中英

IBM Watson语音到文本认证凭证

[英]IBM Watson Speech-to-Text authentication credentials

我正在尝试为我的TJBot编写文本示例配方的演讲。 样本config.js文件需要IBM的用户名和密码来验证服务。 但是,IBM似乎正在迁移到基于API密钥的身份验证系统,并且不提供任何用户名/密码对。 如何连接到服务?

看来您是在此TJBot配方中引用此config.js的 实际上,包括Watson服务在内的所有IBM Cloud服务都已转向基于IAM的身份验证。 这是用于身份验证上语音到文本Node.js API ,除了用户名/密码外,还提供了这种身份验证方式:

var speechToText = new SpeechToTextV1({
    iam_apikey: '{iam_api_key}',
    url: '{url}'
  });

基于config.js和该API的布局,config.js中的TTS部分应如下所示:

// Watson Speech to Text
// https://www.ibm.com/watson/services/speech-to-text/
exports.credentials.speech_to_text = {
    iam_apikey: 'YOUR-API-KEY',
    url: 'URL-FOR-SERVICE'
};

STT配方现在可以使用。 感谢data_henrik指出所需的config.js编辑。 除了编辑配置文件外,我还在第381行编辑了node_modules / tjbot / lib / tjbot.js并注释了以下代码块:

//assert(credentials.hasOwnProperty('username'), "credentials for the " + service + " service missing 'username'");
//assert(credentials.hasOwnProperty('password'), "credentials for the " + service + " service missing 'password'");
    //var SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1');
         //this._stt = new SpeechToTextV1({
         //  username: credentials['username'],
         // password: credentials['password'
         // url: 'https://stream.watsonplatform.net/speech-to-text/api/',
         // version: 'v1'
         // });
         // break;`

并替换为:

var SpeechToTextV1 = require('watson-developer-cloud/speech-to-text/v1');
     this._stt = new SpeechToTextV1({
     iam_apikey: credentials['iam_apikey'],
     url: 'https://gateway-syd.watsonplatform.net/speech-to-text/api',
     version: 'v1'
});
break;`

@data_henrik您的解决方案可能会起作用。 但是更好的解决方案是直接按如下方式编辑config.js(注意,键盘输入是apikey而不是iam_apikey):

// Watson Speech to Text
// https://www.ibm.com/watson/services/speech-to-text/
exports.credentials.speech_to_text = {
    apikey: 'YOUR-API-KEY',
    url: 'URL-FOR-SERVICE'
};

暂无
暂无

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

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