|
| 1 | +<!-- |
| 2 | + Copyright 2020 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 | + |
| 18 | +<script type="text/x-red" data-template-name="natural-language-understanding-model-manager-v1"> |
| 19 | + <div class="form-row"> |
| 20 | + <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> |
| 21 | + <input type="text" id="node-input-name" placeholder="Name"> |
| 22 | + </div> |
| 23 | + <div id="credentials-check" class="form-row"> |
| 24 | + <div class="form-tips"> |
| 25 | + <i class="fa fa-question-circle"></i><b> Please wait: </b> Checking for bound service credentials... |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + <div class="form-row credentials" style="display: none;"> |
| 29 | + <label for="node-input-apikey"><i class="fa fa-key"></i> API Key</label> |
| 30 | + <input type="password" id="node-input-apikey" placeholder="API Key"> |
| 31 | + </div> |
| 32 | + <div class="form-row credentials"> |
| 33 | + <label for="node-input-nlu-service-endpoint"><i class="fa fa-tag"></i> Service Endpoint</label> |
| 34 | + <input type="text" id="node-input-nlu-service-endpoint" placeholder="https://gateway.watsonplatform.net/natural-language-understanding/api"> |
| 35 | + </div> |
| 36 | + |
| 37 | + <div class="form-row"> |
| 38 | + <label for="node-input-nlu-model-mode"><i class="fa fa-book"></i> Mode: </label> |
| 39 | + <select type="text" id="node-input-nlu-model-mode" style="display: inline-block; width: 70%;"> |
| 40 | + <option value="listModels">List Models</option> |
| 41 | + <option value="deleteModel">Delete Model</option> |
| 42 | + </select> |
| 43 | + </div> |
| 44 | +</script> |
| 45 | + |
| 46 | + |
| 47 | +<script type="text/javascript"> |
| 48 | + |
| 49 | + (function() { |
| 50 | + RED.nodes.registerType('natural-language-understanding-model-manager-v1', { |
| 51 | + category: 'IBM Watson', |
| 52 | + defaults: { |
| 53 | + name: {value: ""}, |
| 54 | + 'nlu-service-endpoint' :{value: ""}, |
| 55 | + "nlu-model-mode": {value: ""} |
| 56 | + }, |
| 57 | + credentials: { |
| 58 | + apikey: {type:"password"} |
| 59 | + }, |
| 60 | + color: '#60A2FF', |
| 61 | + inputs: 1, |
| 62 | + outputs: 1, |
| 63 | + icon: "NaturalLanguageUnderstanding.png", |
| 64 | + paletteLabel: "natural language understanding V1 model manager", |
| 65 | + label: function() { |
| 66 | + return this.name || "natural language understanding V1 model manager"; |
| 67 | + }, |
| 68 | + labelStyle: function() { |
| 69 | + return this.name ? "node_label_italic" : ""; |
| 70 | + }, |
| 71 | + oneditprepare: function() { |
| 72 | + $.getJSON('watson-nlu-model-manager-v4/vcap/') |
| 73 | + .done(function (service) { |
| 74 | + $('.credentials').toggle(!service); |
| 75 | + }) |
| 76 | + .fail(function () { |
| 77 | + $('.credentials').show(); |
| 78 | + }) |
| 79 | + .always(function () { |
| 80 | + $('#credentials-check').hide(); |
| 81 | + }) |
| 82 | + } |
| 83 | + }); |
| 84 | + })(); |
| 85 | +</script> |
| 86 | + |
| 87 | +<script type="text/x-red" data-help-name="natural-language-understanding-model-manager-v1"> |
| 88 | + <p> This node enables you to list or delete |
| 89 | + watson Knowledge Studio custom entities and relations models that are |
| 90 | + deployed to your Natural Language Understanding service. |
| 91 | + </p> |
| 92 | + <p>The following features are available :</p> |
| 93 | + <ul> |
| 94 | + <li><b>List models</b></li> |
| 95 | + <li><b>Delete a model</b></li> |
| 96 | + </ul> |
| 97 | + |
| 98 | + <p><b>List models</b></p> |
| 99 | + <p>No input parameters are required : </p> |
| 100 | + <p>More information on this |
| 101 | + <a href="https://cloud.ibm.com/apidocs/natural-language-understanding/natural-language-understanding?code=node#list-models"> |
| 102 | + API documentation</a>.</p> |
| 103 | + |
| 104 | + <p><b>Delete model</b></p> |
| 105 | + <p>this feature should be provided as input : </p> |
| 106 | + <ul> |
| 107 | + <li><code>msg.payload</code> : The identifier of the model to delete (Required)</li> |
| 108 | + </ul> |
| 109 | + <p>More information on this |
| 110 | + <a href="https://cloud.ibm.com/apidocs/natural-language-understanding/natural-language-understanding?code=node#delete-model"> |
| 111 | + API documentation</a>.</p> |
| 112 | + |
| 113 | +</script> |
0 commit comments