UNPKG

node-red-contrib-viseo-ms-authentication

Version:

VISEO Bot Maker - Microsoft Cognitive Services authentication

105 lines (97 loc) 5.06 kB
<script type="text/javascript"> RED.nodes.registerType('ms-luis-config',{ category: 'config', defaults: { name: { value: undefined }, way: { value: "key" }, location: { value: "westus" }, verbose: { value: false }, staging: { value: false } }, credentials: { appId: { type: "text" }, subKey: { type: "text" }, endpoint: { type: "text" }, spellCheckKey: { type: "text" } }, oneditprepare: function() { if (!this.way) this.way = "key"; $("#node-config-input-location").typedInput({ default: 'str', types: ['str'], type: 'str'}); $("#node-config-input-appId").typedInput({ default: 'str', types: ['str'], type: 'str'}); $("#node-config-input-subKey").typedInput({ default: 'str', types: ['str'], type: 'str'}); $("#node-config-input-endpoint").typedInput({ default: 'str', types: ['str'], type: 'str'}); $("#node-config-input-verbose").typedInput({ default: 'bool', types: ['bool'], type: 'bool'}); $("#node-config-input-staging").typedInput({ default: 'bool', types: ['bool'], type: 'bool'}); $("#node-config-input-spellCheckKey").typedInput({ default: 'str', types: ['str'], type: 'str'}); $("#node-config-input-way").change(function() { $(".key, .endpoint").hide(); if ($(this).val() === "key" ) { $(".key").show(); $("#node-config-input-location").typedInput('show'); $("#node-config-input-appId").typedInput('show'); $("#node-config-input-verbose").typedInput('show'); $("#node-config-input-staging").typedInput('show'); } else { $(".endpoint").show(); } }) }, label: function() { return this.name || "LUIS config"; } }); </script> <script type="text/x-red" data-template-name="ms-luis-config"> <div class="form-row"> <label for="node-config-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-config-input-name" placeholder="Name"> </div> <br> <div class="form-row"> <label for="node-config-input-way"><i class="fa fa-tasks"></i> Config</label> <select id="node-config-input-way" style="width:70%;"> <option value="key">With keys</option> <option value="endpoint">With endpoint</option> </select> </div> <br> <div class="form-row key"> <label for="node-config-input-location"><i class="fa fa-globe"></i> Location</label> <input type="text" id="node-config-input-location" style="width:70%;"> </div> <div class="form-row key"> <label for="node-config-input-appId"><i class="fa fa-lock"></i> App ID</label> <input type="text" id="node-config-input-appId" style="width:70%;" placeholder=""> </div> <div class="form-row key"> <label for="node-config-input-verbose"><i class="fa fa-lock"></i> Verbose</label> <input type="text" id="node-config-input-verbose" style="width:70%;" placeholder=""> </div> <div class="form-row key"> <label for="node-config-input-staging"><i class="fa fa-lock"></i> Staging</label> <input type="text" id="node-config-input-staging" style="width:70%;" placeholder=""> </div> <div class="form-row endpoint"> <label for="node-config-input-endpoint"><i class="fa fa-globe"></i> Endpoint</label> <input type="text" id="node-config-input-endpoint" style="width:70%;" placeholder="https://{your-resource-name}.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/{appId}/slots/{slotName}/predict?subscription-key={key}&query={query}[&verbose][&log][&show-all-intents]"> </div> <div class="form-row"> <label for="node-config-input-subKey"><i class="fa fa-lock"></i> Sub Key</label> <input type="text" id="node-config-input-subKey" style="width:70%;" placeholder=""> </div> <div class="form-row"> <label for="node-config-input-spellCheckKey"><i class="fa fa-lock"></i> Spell check key</label> <input type="text" id="node-config-input-spellCheckKey" style="width:70%;" placeholder=""> </div> </script> <script type="text/x-red" data-help-name="ms-luis-config"> <p>Credentials for Microsoft LUIS API. </p> <h3>Details</h3> <p>Find the endpoint or the informations in the LUIS UI or in the Azure Portal.</p> <h3>References</h3> <ul> <li><a href="https://docs.microsoft.com/fr-fr/azure/cognitive-services/luis/">LUIS</a> - reference</li> <li><a href="https://github.com/NGRP/node-red-contrib-viseo/">VISEO BotMaker</a> - the nodes github repository</li> </ul> </script>