Skip to content

Commit

Permalink
Merge pull request #439 from chughts/075
Browse files Browse the repository at this point in the history
Candidate 0.7.5
  • Loading branch information
chughts authored Dec 25, 2018
2 parents bd30746 + 0114b14 commit 4d20c7c
Show file tree
Hide file tree
Showing 32 changed files with 2,012 additions and 175 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,35 @@ Node-RED Watson Nodes for IBM Cloud

<a href="https://cla-assistant.io/watson-developer-cloud/node-red-node-watson"><img src="https://cla-assistant.io/readme/badge/watson-developer-cloud/node-red-node-watson" alt="CLA assistant" /></a>

### New in version 0.7.5
- Bump SDK Dependency to 3.15.0
- Added Portuguese (Brazilian) and Chinese (Simplified and Traditional) as output languages
for Visual Recognition node.
- Added list voices and delete customisation methods to TTS Corpus Builder node.
- STT Node Changes
- Allowing SDK to manage IAM Tokens.
- Streaming mode for STT using IAM key now working.
- Fix to stream mode for max alternatives and smart formatting options
- Keywords, Word Confidence and Customization Weight can now be specified
- Allow Start and End data packets to be specified as JSON objects, as well as
a stringified JSON objects.
- In line with SDK change use createLanguageModel() to create custom model
- Disable SSL Verification option for Assistant Node.
- Natural Language Understanding Node Changes
- Bump Natural Language Understanding to 2018-11-16
- Add Limit Categories and limit_text_characters options
- Allow JSON input into Personality Insights node.
- Japanese word count was causing a Node-RED crash when run in the cloud.
- Hungarian supported by Language Translator.
- New Document Language Translator node.
- New Assistant V2 Node.
- Discovery Node changes
- Bump Discovery to 2018-12-03
- Implement Query Notices method
- Bump dependency on file-type to 10.7.0
- Bump dependency on temp to 0.9.0


### New in version 0.7.4
- Bump SDK Dependency to 3.11.0
- Bump Assistant version to 2018-09-20
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "node-red-node-watson",
"version": "0.7.4",
"version": "0.7.5",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"async": "^1.5.2",
"cfenv": "~1.0.0",
"file-type": "^2.7.0",
"file-type": "^10.7.0",
"request": "~2.86.0",
"temp": "^0.8.3",
"temp": "^0.9.0",
"qs": "6.x",
"image-type": "^2.0.2",
"watson-developer-cloud": "^3.11.0",
"kuromoji": "^0.1.1",
"watson-developer-cloud": "^3.15.0",
"word-count": "^0.2.2",
"is-docx": "^0.0.3",
"stream-to-array": "^2.3.0",
Expand All @@ -35,12 +34,14 @@
],
"node-red": {
"nodes": {
"watson-conversation-v1": "services/conversation/v1.js",
"watson-conversation-workspace-manager-v1": "services/conversation/v1-workspace-manager.js",
"watson-conversation-v1": "services/assistant/v1.js",
"watson-conversation-workspace-manager-v1": "services/assistant/v1-workspace-manager.js",
"watson-assistant-v2": "services/assistant/v2.js",
"watson-discovery-v1": "services/discovery/v1.js",
"watson-discovery-v1-document-loader": "services/discovery/v1-document-loader.js",
"watson-discovery-v1-query-builder": "services/discovery/v1-query-builder.js",
"watson-language-translator-v3": "services/language_translator/v3.js",
"watson-doc-translator-v3": "services/language_translator/v3-doc.js",
"watson-language-translator-identify-v3": "services/language_translator_identify/v3.js",
"watson-language-translator-util-v3": "services/language_translator_util/v3.js",
"watson-natural-language-classifier-v1": "services/natural_language_classifier/v1.js",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
238 changes: 238 additions & 0 deletions services/assistant/v2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<!--
Copyright 2018 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<script type="text/x-red" data-template-name="watson-assistant-v2">
<div id="credentials-check" class="form-row">
<div class="form-tips">
<i class="fa fa-question-circle"></i>
<b> Please wait: </b> Checking for bound service credentials...
</div>
</div>

<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>

<div class="form-row credentials" style="display: none;">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="Username">
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
<input type="password" id="node-input-password" placeholder="Password">
</div>
<div class="form-row credentials" style="display: none;">
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
</div>

<div class="form-row credentials">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-default-endpoint" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-default-endpoint" style="width: 70%;"> Use Default Service Endpoint</label>
</div>
<div class="form-row">
<label for="node-input-service-endpoint"><i class="fa fa-tag"></i> Service Endpoint</label>
<input type="text" id="node-input-service-endpoint" placeholder="https://gateway.watsonplatform.net/assistant/api">
</div>

<div class="form-row">
<label for="node-input-assistant_id"><i class="fa fa-tag"></i> Assitant ID</label>
<input type="text" id="node-input-assistant_id" placeholder="Assistant ID">
</div>

<div class="form-row">
<label for="node-input-timeout"><i class="fa fa-tag"></i> Timeout Period</label>
<input type="text" id="node-input-timeout" placeholder="Leave empty to disable">
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-debug" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-debug" style="width: 70%;"> Switch on Debug</label>
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-restart" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-restart" style="width: 70%;"> Restart Dialog</label>
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-return_context" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-return_context" style="width: 70%;"> Return Context</label>
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-alternate_intents" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-alternate_intents" style="width: 70%;"> Return Alternate Intents</label>
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-multisession" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-multisession" style="width: 70%;"> Multiple Sessions</label>
</div>

<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-optout-learning" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-optout-learning" style="width: 70%;"> Opt Out Request Logging</label>
</div>

<div class="form-tips" id="assistantv2-form-tips">
<strong>Note:</strong> When using multiple sessions, and <code>msg.params.session_id</code>
is not set then a new session id is generated. <br>
See info box for details.
</div>
</script>

<script type="text/x-red" data-help-name="watson-assistant-v2">
<p>With the IBM Watson™ Assistant V2 service you can create cognitive agents
– virtual agents that combine machine learning,
natural language understanding, and integrated dialog scripting tools to
provide outstanding customer engagements.</p>

<p><b>Usage</b></p>
<p>This node should be provided in input : </p>
<ul>
<li><code>msg.payload</code> : the message of the Assistant to analyse. Format: String </li>
<li><code>msg.params.session_id</code> (optional): unique identifier for the conversation session.
If this field is not provided then the node will generate a new session_id and
return itt as part of the response. If the node is not used in multi-session mode, then
a session_id need not be provided, to reset the session_id in single-session mode
send a null value as the session_id. Format: String </li>
<li><code>msg.params.assistant_id</code> : unique identifier of the assistant to be used. Could be also configured in the node. Format: String </li>
<li><code>msg.params.timeout</code> (optional): The timeout period (in millisecond) for Watson request. Leave empty or set to 0 to disable. </li>
<li><code>msg.params.alternate_intents</code> (optional) : whether to return more than one intent. Default is false. Set to true to return all matching intents. For example, return all intents when the confidence is not high to allow users to choose their intent.</li>
<li><code>msg.params.entities</code> (optional) : see API documentation </li>
<li><code>msg.params.intents</code> (optional) : see API documentation </li>
<li><code>msg.params.return_context</code> (optional) : see API documentation </li>
<li><code>msg.params.debug</code> (optional) : see API documentation </li>
<li><code>msg.params.restart</code> (optional) : see API documentation </li>
<li><code>msg.additional_context</code> (optional) : additional properties that will be added to the context object. Format: Object </li>
<br/>
<li><code>msg.params.username</code> : If provided will be used as the username credential for the Assistant service.</li>
<li><code>msg.params.password</code> : If provided will be used as the password credential for the Assistant service.</li>
<li><code>msg.params.apikey</code> : If provided will be used as the api key credential for the Assistant service.</li>
<li><code>msg.params.endpoint</code> : If provided will be used as the url for the Assistant service.</li>
<li><code>msg.params.version</code> : If provided will be used as the API version date for the Assistant service.</li>
<li><code>msg.params.optout_learning</code> : Set to true to opt out of request logging. Check the <a href="https://console.bluemix.net/docs/services/watson/getting-started-logging.html#controlling-request-logging-for-watson-services" target="_blank">documentation</a> for details.</li>
<li><code>msg.params.disable_ssl_verification</code> : Set to true to disable SSL verification. <b>Note that this has serious security implications - only do this if you really mean to!</b></li>
</ul>
<p>See <a href="https://cloud.ibm.com/apidocs/assistant-v2" target="_blank">Assistant V2 API documentation</a> for details.</p>
<p>All Results will made available at <code>msg.payload</code> in JSON format.
Check the <a href="https://cloud.ibm.com/apidocs/assistant-v2"
target="_blank">documentation</a> for details.</p>

<p><b>Important</b> : before using this node, a workspace must be created and configured using the Watson Assistant Tool available in IBM Cloud, in the Watson Assistant instance detail page.</p>
<p><b>Documentation</b>
<ul>
<li><a href="https://console.bluemix.net/docs/services/assistant/index.html" target="_blank">Watson Assistant API documentation</a></li>
<li><a href="https://watson-api-explorer.mybluemix.net/apis/assistant-v1" target="_blank">Watson API Explorer</a></li>
<li><a href="https://console.bluemix.net/docs/services/assistant/getting-started.html" target="_blank">Getting started tutorial</a>
<li><a href="https://github.com/watson-developer-cloud/node-red-bluemix-starter" target="_blank">Sample Flow in the Watson Node-RED Starter</a>
</ul>


</script>


<script type="text/javascript">
// Need to simulate a namespace, so that some of the variables don't leak across nodes
function AssistantV2 () {
}

// This is the namespace for document translator.
var assistantV2 = new AssistantV2();

assistantV2.UIListeners = function () {
$('input#node-input-multisession').change(function () {
var checked = $('input#node-input-multisession').prop('checked');
if (checked) {
$('#assistantv2-form-tips').show();
} else {
$('#assistantv2-form-tips').hide();
}
});

$('input#node-input-default-endpoint').change(function () {
var checked = $('input#node-input-default-endpoint').prop('checked');
if (checked) {
$('#node-input-service-endpoint').parent().hide();
} else {
$('#node-input-service-endpoint').parent().show();
}
});
}

assistantV2.checkCredentials = function () {
$.getJSON('watson-assistant-v2/vcap/')
.done(function (service) {
$('.credentials').toggle(!service);
})
.fail(function () {
$('.credentials').show();
})
.always(function () {
$('#credentials-check').hide();
})
}

var oneditprepare = function() {
assistantV2.UIListeners();
assistantV2.checkCredentials()
};

(function() {
RED.nodes.registerType('watson-assistant-v2', {
category: 'IBM Watson',
defaults: {
name: { value: '' },
'default-endpoint' : {value: true},
'service-endpoint' : {value: 'https://gateway.watsonplatform.net/assistant/api'},
assistant_id: {value: ''},
debug: {value: false},
restart: {value: false},
return_context: {value: true},
alternate_intents: {value: false},
multisession: {value: true},
timeout: {value: '', validate: RED.validators.number(true)},
'optout-learning': {value: false}
},
credentials: {
username: {type:'text'},
password: {type:'password'},
apikey: {type:'password'}
},
color: 'rgb(84,149,230)',
inputs: 1,
outputs: 1,
paletteLabel: 'assistant V2',
icon: 'conversation-v1-25x25.png',
label: function() {
return this.name || 'assistant V2';
},
labelStyle: function() {
return this.name ? 'node_label_italic' : '';
},
oneditprepare: oneditprepare
});
})();
</script>
Loading

0 comments on commit 4d20c7c

Please sign in to comment.