forked from MiumiuCodelicious/dialog-nodejs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
173 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
node_modules | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
/dialogs/dialog-id.json | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
var express = require('express'), | ||
router = express.Router(), | ||
vcapServices = require('vcap_services'), | ||
extend = require('util')._extend, | ||
watson = require('watson-developer-cloud'); | ||
|
||
// set up an endpoint to serve speech-to-text auth tokens | ||
|
||
// For local development, replace username and password | ||
var sttConfig = extend({ | ||
version: 'v1', | ||
url: 'https://stream.watsonplatform.net/speech-to-text/api', | ||
username: '<username>', | ||
password: '<password>' | ||
}, vcapServices.getCredentials('speech_to_text')); | ||
|
||
console.log(process.env.VCAP_SERVICES); | ||
|
||
var sttAuthService = watson.authorization(sttConfig); | ||
|
||
router.get('/token', function(req, res) { | ||
sttAuthService.getToken({url: sttConfig.url}, function(err, token) { | ||
if (err) { | ||
console.log('Error retrieving token: ', err); | ||
return res.status(500).send('Error retrieving token') | ||
} | ||
res.send(token); | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
var express = require('express'), | ||
router = express.Router(), | ||
vcapServices = require('vcap_services'), | ||
extend = require('util')._extend, | ||
watson = require('watson-developer-cloud'); | ||
|
||
// another endpoint for the text to speech service | ||
|
||
// For local development, replace username and password | ||
var ttsConfig = extend({ | ||
version: 'v1', | ||
url: 'https://stream.watsonplatform.net/text-to-speech/api', | ||
username: '<username>', | ||
password: '<password>' | ||
}, vcapServices.getCredentials('text_to_speech')); | ||
|
||
var ttsAuthService = watson.authorization(ttsConfig); | ||
|
||
router.get('/token', function(req, res) { | ||
ttsAuthService.getToken({url: ttsConfig.url}, function(err, token) { | ||
if (err) { | ||
console.log('Error retrieving token: ', err); | ||
return res.status(500).send('Error retrieving token') | ||
} | ||
res.send(token); | ||
}); | ||
}); | ||
|
||
module.exports = router; |
fd8408a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any way to give an on/off option which will make the microphone on/off