Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 40 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,43 @@
{
"name": "node-red-node-watson",
"version": "0.3.0",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"alchemy-api": "^1.3.0",
"cfenv": "~1.0.0",
"file-type": "^2.7.0",
"request": "~2.53.0",
"temp": "^0.8.3",
"watson-developer-cloud": "^1.2.4"
},
"repository": {
"type": "git",
"url": "https://github.com/node-red/node-red-node-watson"
},
"license": "Apache-2.0",
"keywords": [
"node-red",
"bluemix",
"watson"
],
"node-red": {
"nodes": {
"alchemy-feature-extract": "alchemy/feature-extract.js",
"alchemy-image-analysis": "alchemy/image-analysis.js",
"watson-natural-language-classifier": "services/natural_language_classifier/v1.js",
"watson-concept-insights": "services/concept_insights/v2.js",
"watson-dialog": "services/dialog/v1.js",
"watson-document-conversion": "services/document_conversion/v1.js",
"watson-language-identification": "/services/language_identification/v1.js",
"watson-language-translate": "services/language_translation/v1.js",
"watson-personality-insights": "services/personality_insights/v1.js",
"watson-relationship-extraction": "services/relationship_extraction/v1.js",
"watson-speech-to-text": "services/speech_to_text/v1.js",
"watson-text-to-speech": "services/text_to_speech/v1.js",
"watson-tradeoff-analytics": "services/tradeoff_analytics/v1.js",
"watson-tone-analyzer": "services/tone_analyzer/v1.js",
"watson-visual-recognition": "services/visual_recognition/v1.js"
}
"name": "node-red-node-watson",
"version": "0.3.0",
"description": "A collection of Node-RED nodes for IBM Watson services",
"dependencies": {
"alchemy-api": "^1.3.0",
"async": "^1.5.2",
"cfenv": "~1.0.0",
"file-type": "^2.7.0",
"request": "~2.53.0",
"temp": "^0.8.3",
"watson-developer-cloud": "^1.2.4"
},
"repository": {
"type": "git",
"url": "https://github.com/node-red/node-red-node-watson"
},
"license": "Apache-2.0",
"keywords": [
"node-red",
"bluemix",
"watson"
],
"node-red": {
"nodes": {
"alchemy-feature-extract": "alchemy/feature-extract.js",
"alchemy-image-analysis": "alchemy/image-analysis.js",
"watson-natural-language-classifier": "services/natural_language_classifier/v1.js",
"watson-concept-insights": "services/concept_insights/v2.js",
"watson-dialog": "services/dialog/v1.js",
"watson-document-conversion": "services/document_conversion/v1.js",
"watson-language-identification": "/services/language_identification/v1.js",
"watson-language-translate": "services/language_translation/v1.js",
"watson-personality-insights": "services/personality_insights/v1.js",
"watson-relationship-extraction": "services/relationship_extraction/v1.js",
"watson-speech-to-text": "services/speech_to_text/v1.js",
"watson-text-to-speech": "services/text_to_speech/v1.js",
"watson-tradeoff-analytics": "services/tradeoff_analytics/v1.js",
"watson-tone-analyzer": "services/tone_analyzer/v1.js",
"watson-visual-recognition": "services/visual_recognition/v1.js"
}
}
}
186 changes: 186 additions & 0 deletions services/dialog/di.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<!--
Copyright 2016 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/javascript">
RED.nodes.registerType('service-dialog', {
category: 'IBM Watson',
defaults: {
name: {value: ""},
mode: {value: "converse"},
dialog: {value: ""},
clientid: {value: ""},
converse: {value: ""}
},
color: "rgb(99, 158, 230)",
inputs: 1,
outputs: 1,
icon: "dialog.svg",
paletteLabel: "Dialog Service Node",
label: function() {
return this.name || "Dialog Node";
},
credentials: {
username: {type:"text"},
password: {type:"password"}
},

oneditprepare: function() {
$('#node-input-mode').change(function () {
var mode = $('#node-input-mode').val();
if (mode == "list" || mode == "create") {
$('.form-row.mode.dialog').hide();
} else if (mode == "delete") {
$('.form-row.mode.dialog').show();
$('.form-row.mode.converse').hide();
} else if (mode == "deleteall") {
$('.form-row.mode.dialog').hide();
$('.form-row.mode.converse').hide();
} else if (mode == "startconverse") {
$('.form-row.mode.dialog').show();
$('.form-row.mode.converse').hide();
} else {
$('.form-row.mode.dialog').show();
}
})

$.getJSON('service-dialog/vcap/')
.done(function (service) {
$('.credentials').toggle(!service);
})
.fail(function () {
$('.credentials').show();
}).always(function () {
$('#credentials-check').hide();
})
}
});
</script>



<script type="text/x-red" data-template-name="service-dialog">
<div class="form-row">
<label for="node-input-name"> <i class="icon-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">
<label for="node-input-mode"><i class="fa fa-question"></i> Mode</label>
<select type="text" id="node-input-mode" style="display: inline-block; width: 70%;" >
<option value="create">Create a new Dialog</option>
<option value="list">List Available Dialogs</option>
<option value="startconverse">Start Conversation</option>
<option value="converse">Continue Conversation</option>
<option value="getprofile">List Profile Variables</option>
<option value="delete">Delete a Dialog</option>
<option value="deleteall">Delete all Dialogs</option>
</select>
</div>
<div class="form-row mode dialog">
<label for="node-input-dialog"><i class="fa fa-tag"></i> Dialog ID</label>
<input type="text" id="node-input-dialog" placeholder="Dialog ID">
</div>
<div class="form-row mode dialog converse">
<label for="node-input-clientid"><i class="fa fa-tag"></i> Client ID</label>
<input type="text" id="node-input-clientid" placeholder="clientid">
</div>
<div class="form-row mode dialog converse">
<label for="node-input-converse"><i class="fa fa-tag"></i> Conversation ID</label>
<input type="text" id="node-input-converse" placeholder="Conversation ID">
</div>

</script>

<script type="text/x-red" data-help-name="service-dialog">
<p>Watson Dialog Service, Lists available dialogs and runs a conversation against the dialog</p>
<p>Use the drop-down menu in the node configuration window to select the required mode.</p>
<p></p>
<p><b>Create Mode</b>.</p>
<p>Creates a dialog template. A XML dialog file is required as input. If the dialog is created successfully the dialog id is returned.</p>
<p>The file should be provided as msg.dialog_params["file"]</p>
<p>The name for the dialog template should be provided as msg.dialog_params["dialog_name"]</p>
<p>The dialog id from the service will be returned on <b>msg.dialog</b>.</p>
<p><b>Note</b> : the Watson Dialog API support 3 files types : encrypted .mct, .json or .xml</p>
<p></p>
<p><b>List Mode</b>.</p>
<p>A list of the available dialogs is returned. For each a dialog id is given, this id is needed to
start a conversation.</p>
<p>The list from the service will be returned on <b>msg.dialog</b>.</p>
<p></p>
<p><b>Start Conversation Mode</b>.</p>
<p>The conversation is started and the introduction salutation from the dialog is returned.</p>
<p>The Dialog Id can be passed either as a property or through a function</p>
<pre><code>
msg.dialog_params = {};
msg.dialog_params["dialog_id"] = "dialog id";
return msg;
</code></pre>
<p>In addition a client id and a converstion id are returned. These ids are needed to continue a conversation.</p>
<p>The salutation from the service will be returned on <b>msg.dialog</b>.</p>
<p></p>
<p><b>Conversation Mode</b>.</p>
<p>The conversation is continued.</p>
<p>The Client and Conversation IDs can be passed either as properties or through a function</p>
<pre><code>
msg.dialog_params = {};
msg.dialog_params["client_id"] = "client id";
msg.dialog_params["converse_id"] = "conversation id";
return msg;
</code></pre>
<p>The response from the service will be returned on <b>msg.dialog</b>.</p>
<p></p>
<p><b>List Profile Variables</b>.</p>
<p>Retrieves the profile variables that the dialog has set during the conversation. These can be
used to determine the state of the conversation, and by an applicaiton to perform any further actions.</p>
<p>The Dialog, Client and Conversation IDs can be passed either as properties or through a function</p>
<pre><code>
msg.dialog_params = {};
msg.dialog_params["dialog_id"] = "dialog id";
msg.dialog_params["client_id"] = "client id";
msg.dialog_params["converse_id"] = "conversation id";
return msg;
</code></pre>
<p>The response from the service will be returned on <b>msg.dialog</b>.</p>
<p></p>
<p><b>Delete a Dialog</b>.</p>
<p>Delete all Dialogs and associated data (conversations, profiles variables). To be used with caution</p>
<p>The Dialog ID can be passed either as properties or through a function</p>
<pre><code>
msg.dialog_params = {};
msg.dialog_params["dialog_id"] = "dialog id";
return msg;
</code></pre>
<p></p>
<p><b>Delete a Dialog</b>.</p>
<p>Delete a Dialog and all associated data (conversations, profiles variables). </p>
<p></p>
<p><b>Delete All Dialogs</b>.</p>
<p>Delete All Dialogs and all associated data (conversations, profiles variables). </p>
<p><b>Notice</b>: to be used with caution</p>
<p></p>

<p>For more information about the Watson Dialog service,
read the <a href="https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/dialog.html">documentation</a>.</p>

</script>

Binary file added services/dialog/icons/dialog-icon25x25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 0 additions & 17 deletions services/dialog/temp.txt

This file was deleted.

Loading