Skip to content

Commit 4d20c7c

Browse files
authored
Merge pull request #439 from chughts/075
Candidate 0.7.5
2 parents bd30746 + 0114b14 commit 4d20c7c

32 files changed

+2012
-175
lines changed

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@ Node-RED Watson Nodes for IBM Cloud
77

88
<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>
99

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

package.json

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
{
22
"name": "node-red-node-watson",
3-
"version": "0.7.4",
3+
"version": "0.7.5",
44
"description": "A collection of Node-RED nodes for IBM Watson services",
55
"dependencies": {
66
"async": "^1.5.2",
77
"cfenv": "~1.0.0",
8-
"file-type": "^2.7.0",
8+
"file-type": "^10.7.0",
99
"request": "~2.86.0",
10-
"temp": "^0.8.3",
10+
"temp": "^0.9.0",
1111
"qs": "6.x",
1212
"image-type": "^2.0.2",
13-
"watson-developer-cloud": "^3.11.0",
14-
"kuromoji": "^0.1.1",
13+
"watson-developer-cloud": "^3.15.0",
1514
"word-count": "^0.2.2",
1615
"is-docx": "^0.0.3",
1716
"stream-to-array": "^2.3.0",
@@ -35,12 +34,14 @@
3534
],
3635
"node-red": {
3736
"nodes": {
38-
"watson-conversation-v1": "services/conversation/v1.js",
39-
"watson-conversation-workspace-manager-v1": "services/conversation/v1-workspace-manager.js",
37+
"watson-conversation-v1": "services/assistant/v1.js",
38+
"watson-conversation-workspace-manager-v1": "services/assistant/v1-workspace-manager.js",
39+
"watson-assistant-v2": "services/assistant/v2.js",
4040
"watson-discovery-v1": "services/discovery/v1.js",
4141
"watson-discovery-v1-document-loader": "services/discovery/v1-document-loader.js",
4242
"watson-discovery-v1-query-builder": "services/discovery/v1-query-builder.js",
4343
"watson-language-translator-v3": "services/language_translator/v3.js",
44+
"watson-doc-translator-v3": "services/language_translator/v3-doc.js",
4445
"watson-language-translator-identify-v3": "services/language_translator_identify/v3.js",
4546
"watson-language-translator-util-v3": "services/language_translator_util/v3.js",
4647
"watson-natural-language-classifier-v1": "services/natural_language_classifier/v1.js",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

services/assistant/v2.html

+238
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
<!--
2+
Copyright 2018 IBM Corp.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<script type="text/x-red" data-template-name="watson-assistant-v2">
18+
<div id="credentials-check" class="form-row">
19+
<div class="form-tips">
20+
<i class="fa fa-question-circle"></i>
21+
<b> Please wait: </b> Checking for bound service credentials...
22+
</div>
23+
</div>
24+
25+
<div class="form-row">
26+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
27+
<input type="text" id="node-input-name" placeholder="Name">
28+
</div>
29+
30+
<div class="form-row credentials" style="display: none;">
31+
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
32+
<input type="text" id="node-input-username" placeholder="Username">
33+
</div>
34+
<div class="form-row credentials" style="display: none;">
35+
<label for="node-input-password"><i class="fa fa-key"></i> Password</label>
36+
<input type="password" id="node-input-password" placeholder="Password">
37+
</div>
38+
<div class="form-row credentials" style="display: none;">
39+
<label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label>
40+
<input type="password" id="node-input-apikey" placeholder="API Key"></input>
41+
</div>
42+
43+
<div class="form-row credentials">
44+
<label>&nbsp;</label>
45+
<input type="checkbox" id="node-input-default-endpoint" style="display: inline-block; width: auto; vertical-align: top;">
46+
<label for="node-input-default-endpoint" style="width: 70%;"> Use Default Service Endpoint</label>
47+
</div>
48+
<div class="form-row">
49+
<label for="node-input-service-endpoint"><i class="fa fa-tag"></i> Service Endpoint</label>
50+
<input type="text" id="node-input-service-endpoint" placeholder="https://gateway.watsonplatform.net/assistant/api">
51+
</div>
52+
53+
<div class="form-row">
54+
<label for="node-input-assistant_id"><i class="fa fa-tag"></i> Assitant ID</label>
55+
<input type="text" id="node-input-assistant_id" placeholder="Assistant ID">
56+
</div>
57+
58+
<div class="form-row">
59+
<label for="node-input-timeout"><i class="fa fa-tag"></i> Timeout Period</label>
60+
<input type="text" id="node-input-timeout" placeholder="Leave empty to disable">
61+
</div>
62+
63+
<div class="form-row">
64+
<label>&nbsp;</label>
65+
<input type="checkbox" id="node-input-debug" style="display: inline-block; width: auto; vertical-align: top;">
66+
<label for="node-input-debug" style="width: 70%;"> Switch on Debug</label>
67+
</div>
68+
69+
<div class="form-row">
70+
<label>&nbsp;</label>
71+
<input type="checkbox" id="node-input-restart" style="display: inline-block; width: auto; vertical-align: top;">
72+
<label for="node-input-restart" style="width: 70%;"> Restart Dialog</label>
73+
</div>
74+
75+
<div class="form-row">
76+
<label>&nbsp;</label>
77+
<input type="checkbox" id="node-input-return_context" style="display: inline-block; width: auto; vertical-align: top;">
78+
<label for="node-input-return_context" style="width: 70%;"> Return Context</label>
79+
</div>
80+
81+
<div class="form-row">
82+
<label>&nbsp;</label>
83+
<input type="checkbox" id="node-input-alternate_intents" style="display: inline-block; width: auto; vertical-align: top;">
84+
<label for="node-input-alternate_intents" style="width: 70%;"> Return Alternate Intents</label>
85+
</div>
86+
87+
<div class="form-row">
88+
<label>&nbsp;</label>
89+
<input type="checkbox" id="node-input-multisession" style="display: inline-block; width: auto; vertical-align: top;">
90+
<label for="node-input-multisession" style="width: 70%;"> Multiple Sessions</label>
91+
</div>
92+
93+
<div class="form-row">
94+
<label>&nbsp;</label>
95+
<input type="checkbox" id="node-input-optout-learning" style="display: inline-block; width: auto; vertical-align: top;">
96+
<label for="node-input-optout-learning" style="width: 70%;"> Opt Out Request Logging</label>
97+
</div>
98+
99+
<div class="form-tips" id="assistantv2-form-tips">
100+
<strong>Note:</strong> When using multiple sessions, and <code>msg.params.session_id</code>
101+
is not set then a new session id is generated. <br>
102+
See info box for details.
103+
</div>
104+
</script>
105+
106+
<script type="text/x-red" data-help-name="watson-assistant-v2">
107+
<p>With the IBM Watson™ Assistant V2 service you can create cognitive agents
108+
– virtual agents that combine machine learning,
109+
natural language understanding, and integrated dialog scripting tools to
110+
provide outstanding customer engagements.</p>
111+
112+
<p><b>Usage</b></p>
113+
<p>This node should be provided in input : </p>
114+
<ul>
115+
<li><code>msg.payload</code> : the message of the Assistant to analyse. Format: String </li>
116+
<li><code>msg.params.session_id</code> (optional): unique identifier for the conversation session.
117+
If this field is not provided then the node will generate a new session_id and
118+
return itt as part of the response. If the node is not used in multi-session mode, then
119+
a session_id need not be provided, to reset the session_id in single-session mode
120+
send a null value as the session_id. Format: String </li>
121+
<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>
122+
<li><code>msg.params.timeout</code> (optional): The timeout period (in millisecond) for Watson request. Leave empty or set to 0 to disable. </li>
123+
<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>
124+
<li><code>msg.params.entities</code> (optional) : see API documentation </li>
125+
<li><code>msg.params.intents</code> (optional) : see API documentation </li>
126+
<li><code>msg.params.return_context</code> (optional) : see API documentation </li>
127+
<li><code>msg.params.debug</code> (optional) : see API documentation </li>
128+
<li><code>msg.params.restart</code> (optional) : see API documentation </li>
129+
<li><code>msg.additional_context</code> (optional) : additional properties that will be added to the context object. Format: Object </li>
130+
<br/>
131+
<li><code>msg.params.username</code> : If provided will be used as the username credential for the Assistant service.</li>
132+
<li><code>msg.params.password</code> : If provided will be used as the password credential for the Assistant service.</li>
133+
<li><code>msg.params.apikey</code> : If provided will be used as the api key credential for the Assistant service.</li>
134+
<li><code>msg.params.endpoint</code> : If provided will be used as the url for the Assistant service.</li>
135+
<li><code>msg.params.version</code> : If provided will be used as the API version date for the Assistant service.</li>
136+
<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>
137+
<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>
138+
</ul>
139+
<p>See <a href="https://cloud.ibm.com/apidocs/assistant-v2" target="_blank">Assistant V2 API documentation</a> for details.</p>
140+
<p>All Results will made available at <code>msg.payload</code> in JSON format.
141+
Check the <a href="https://cloud.ibm.com/apidocs/assistant-v2"
142+
target="_blank">documentation</a> for details.</p>
143+
144+
<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>
145+
<p><b>Documentation</b>
146+
<ul>
147+
<li><a href="https://console.bluemix.net/docs/services/assistant/index.html" target="_blank">Watson Assistant API documentation</a></li>
148+
<li><a href="https://watson-api-explorer.mybluemix.net/apis/assistant-v1" target="_blank">Watson API Explorer</a></li>
149+
<li><a href="https://console.bluemix.net/docs/services/assistant/getting-started.html" target="_blank">Getting started tutorial</a>
150+
<li><a href="https://github.com/watson-developer-cloud/node-red-bluemix-starter" target="_blank">Sample Flow in the Watson Node-RED Starter</a>
151+
</ul>
152+
153+
154+
</script>
155+
156+
157+
<script type="text/javascript">
158+
// Need to simulate a namespace, so that some of the variables don't leak across nodes
159+
function AssistantV2 () {
160+
}
161+
162+
// This is the namespace for document translator.
163+
var assistantV2 = new AssistantV2();
164+
165+
assistantV2.UIListeners = function () {
166+
$('input#node-input-multisession').change(function () {
167+
var checked = $('input#node-input-multisession').prop('checked');
168+
if (checked) {
169+
$('#assistantv2-form-tips').show();
170+
} else {
171+
$('#assistantv2-form-tips').hide();
172+
}
173+
});
174+
175+
$('input#node-input-default-endpoint').change(function () {
176+
var checked = $('input#node-input-default-endpoint').prop('checked');
177+
if (checked) {
178+
$('#node-input-service-endpoint').parent().hide();
179+
} else {
180+
$('#node-input-service-endpoint').parent().show();
181+
}
182+
});
183+
}
184+
185+
assistantV2.checkCredentials = function () {
186+
$.getJSON('watson-assistant-v2/vcap/')
187+
.done(function (service) {
188+
$('.credentials').toggle(!service);
189+
})
190+
.fail(function () {
191+
$('.credentials').show();
192+
})
193+
.always(function () {
194+
$('#credentials-check').hide();
195+
})
196+
}
197+
198+
var oneditprepare = function() {
199+
assistantV2.UIListeners();
200+
assistantV2.checkCredentials()
201+
};
202+
203+
(function() {
204+
RED.nodes.registerType('watson-assistant-v2', {
205+
category: 'IBM Watson',
206+
defaults: {
207+
name: { value: '' },
208+
'default-endpoint' : {value: true},
209+
'service-endpoint' : {value: 'https://gateway.watsonplatform.net/assistant/api'},
210+
assistant_id: {value: ''},
211+
debug: {value: false},
212+
restart: {value: false},
213+
return_context: {value: true},
214+
alternate_intents: {value: false},
215+
multisession: {value: true},
216+
timeout: {value: '', validate: RED.validators.number(true)},
217+
'optout-learning': {value: false}
218+
},
219+
credentials: {
220+
username: {type:'text'},
221+
password: {type:'password'},
222+
apikey: {type:'password'}
223+
},
224+
color: 'rgb(84,149,230)',
225+
inputs: 1,
226+
outputs: 1,
227+
paletteLabel: 'assistant V2',
228+
icon: 'conversation-v1-25x25.png',
229+
label: function() {
230+
return this.name || 'assistant V2';
231+
},
232+
labelStyle: function() {
233+
return this.name ? 'node_label_italic' : '';
234+
},
235+
oneditprepare: oneditprepare
236+
});
237+
})();
238+
</script>

0 commit comments

Comments
 (0)