-
Notifications
You must be signed in to change notification settings - Fork 0
/
flow.txt
1 lines (1 loc) · 8.76 KB
/
flow.txt
1
[{"id":"b4cc4a65.28f4f8","type":"tab","label":"Flow 1"},{"id":"1433b29e.bd6b0d","type":"tab","label":"Beginner HTML"},{"id":"566c38bd.6f3c28","type":"tab","label":"Flow 2"},{"id":"1304d986.c082a6","type":"tab","label":"Flow 4"},{"id":"d37856f8.228638","type":"inject","z":"b4cc4a65.28f4f8","name":"Hello World inject","topic":"","payload":"Hello, this is my first node red flow","payloadType":"str","repeat":"","crontab":"","once":false,"x":142,"y":134,"wires":[["63a2a965.e64b68"]]},{"id":"7023941f.d4aadc","type":"debug","z":"b4cc4a65.28f4f8","name":"","active":true,"console":"false","complete":"translation","x":501,"y":129,"wires":[]},{"id":"63a2a965.e64b68","type":"watson-translator","z":"b4cc4a65.28f4f8","name":"","action":"translate","basemodel":"ar-en","domain":"news","srclang":"en","destlang":"es","password":"","custom":"","domainhidden":"news","srclanghidden":"en","destlanghidden":"es","basemodelhidden":"ar-en","customhidden":"","filetype":"forcedglossary","trainid":"","lgparams2":true,"ldparamshidden2":"true","x":320,"y":198,"wires":[["7023941f.d4aadc"]]},{"id":"ab73c676.768e38","type":"http in","z":"1433b29e.bd6b0d","name":"HTTP Hello World","url":"/hw","method":"get","swaggerDoc":"","x":218.5,"y":124,"wires":[["7ce74d91.b133b4"]]},{"id":"3742175.8fb5ce8","type":"http response","z":"1433b29e.bd6b0d","name":"","x":518.5,"y":129,"wires":[]},{"id":"7ce74d91.b133b4","type":"template","z":"1433b29e.bd6b0d","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head>\n <title>Hello World</title>\n </head>\n <body>\n <div>Hello to Watson on Node-RED</div>\n <div id=\"id_hello\"><span>I think you are typing text in:</span>\n \n <span id=\"id_textlang\"></span></div>\n\n\n <form id=\"id_form\">\n <div>\n <span>\n Enter your text to be processed: \n </span>\n <span>\n <input type=\"text\" name=\"name\" id=\"id_text\"/>\n </span>\n </div>\n <div>\n <input type=\"submit\" value=\"Enter\" id=\"id_enter\"/>\n </div>\n </form> \n\n\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js\">\n\n </script>\n\n <script type=\"text/javascript\">\n $(document).ready(function(){\n setupPage();\n });\n \n var LANGUAGES = { 'ar' : 'Arabic',\n 'en': 'English' ,\n 'es': 'Spanish',\n 'fr': 'French',\n 'it': 'Italian',\n 'de': 'German',\n 'pt': 'Portuguese',\n 'ko': 'Korean',\n 'zh': 'Chinese'\n };\n \n function setupPage(){\n $('#id_hello').hide();\n $('#id_form').submit(onSubmitClicked);\n enterbutton();\n }\n \n function langLookup(isocode) {\n return (LANGUAGES[isocode] ? LANGUAGES[isocode] : isocode);\n }\n\n function processOK(response) {\n console.log(response);\n if (response.identifyresponse){\n $('#id_textlang').text(langLookup(response.identifyresponse)); \n } else {\n $('#id_textlang').text('No response received from service');\n }\n }\n \n\n\n\n function processNotOK() {\n console.log('Error Processing');\n $('#id_textlang').text('Oops something went wrong');\n } \n \n \n function invokeAjax(message) {\n console.log('AJAX about to be invoked.');\n console.log(message);\n \n var ajaxData = {};\n ajaxData.msgdata = message;\n\n $.ajax({\n type: 'POST',\n url: 'langidentify',\n data: ajaxData,\n success: processOK,\n error: processNotOK\n });\n }\n\n \n function onSubmitClicked(event){\n $('#id_hello').show();\n event.preventDefault();\n \n var txt = $('#id_text').val();\n invokeAjax(txt);\n }\n \n function enterbutton(){\n $(function() {\n $(\"form input\").keypress(function (e) {\n if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {\n $('#id_enter').click();\n return false;\n } else {\n return true;\n }\n });\n });\n }\n\n </script> \n </body>\n</html>\n","x":389.5,"y":104,"wires":[["3742175.8fb5ce8"]]},{"id":"fe2c5815.4057c8","type":"http in","z":"1433b29e.bd6b0d","name":"HTTP REST Identify Language","url":"/langidentify","method":"post","swaggerDoc":"","x":222.5,"y":246,"wires":[["4ac00ec0.b3dfa"]]},{"id":"7688bcb7.322df4","type":"function","z":"1433b29e.bd6b0d","name":"Process Output","func":"msg.payload = {};\nmsg.payload.identifyresponse = \"I don’t know\";\nif (msg.lang && msg.lang.language){\n msg.payload.identifyresponse = msg.lang.language;\n\t }\n\nreturn msg; \n","outputs":1,"noerr":0,"x":561.5,"y":258,"wires":[["5acabb99.2bc5a4"]]},{"id":"5acabb99.2bc5a4","type":"http response","z":"1433b29e.bd6b0d","name":"","x":669.5,"y":201,"wires":[]},{"id":"4ac00ec0.b3dfa","type":"function","z":"1433b29e.bd6b0d","name":"Extract Input","func":"msg.payload = msg.req.body.msgdata;\nreturn msg;\n","outputs":1,"noerr":0,"x":270.5,"y":371,"wires":[["9e800c7d.9ee0d"]]},{"id":"9e800c7d.9ee0d","type":"watson-language-translator-identify","z":"1433b29e.bd6b0d","name":"","x":477,"y":364,"wires":[["7688bcb7.322df4"]]},{"id":"f8ed8bde.477728","type":"play audio","z":"566c38bd.6f3c28","name":"","voice":"","x":551.5,"y":157,"wires":[]},{"id":"7a174cd1.593524","type":"inject","z":"566c38bd.6f3c28","name":"","topic":"","payload":"Hello world","payloadType":"str","repeat":"","crontab":"","once":false,"x":134.5,"y":136,"wires":[["7dabb8f8.b39d38"]]},{"id":"7dabb8f8.b39d38","type":"watson-text-to-speech","z":"566c38bd.6f3c28","name":"","lang":"en-US","langhidden":"en-US","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"en-US_AllisonVoice","voicehidden":"","format":"audio/wav","password":"","x":342.5,"y":150,"wires":[["f8ed8bde.477728"]]},{"id":"c1c12349.e0392","type":"microphone","z":"566c38bd.6f3c28","name":"","x":238.5,"y":317,"wires":[["f8ed8bde.477728","ae434906.013c68"]]},{"id":"ae434906.013c68","type":"debug","z":"566c38bd.6f3c28","name":"","active":true,"console":"false","complete":"false","x":570.5,"y":300,"wires":[]},{"id":"7547a8bf.16f708","type":"change","z":"1304d986.c082a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"transcription","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":552,"y":132.25,"wires":[["eb585e79.c97e5"]]},{"id":"c664d8f0.e2c358","type":"microphone","z":"1304d986.c082a6","name":"","x":132.5,"y":83.25,"wires":[["68b111c1.d844"]]},{"id":"9df5ef8.6ad0b1","type":"play audio","z":"1304d986.c082a6","name":"","x":696.5,"y":334.25,"wires":[]},{"id":"68b111c1.d844","type":"watson-speech-to-text","z":"1304d986.c082a6","name":"","continuous":true,"speakerlabels":false,"lang":"en-US","langhidden":"en-US","langcustom":"NoCustomisationSetting","langcustomhidden":"","band":"BroadbandModel","bandhidden":"BroadbandModel","password":"","x":359,"y":80.25,"wires":[["7547a8bf.16f708"]]},{"id":"12fa3d75.83d393","type":"watson-text-to-speech","z":"1304d986.c082a6","name":"","lang":"es-ES","langhidden":"es-ES","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"es-ES_LauraVoice","voicehidden":"en-US_LisaVoice","format":"audio/wav","password":"3ZGefNoaLIZw","x":312,"y":305.25,"wires":[["c50d864a.5fd408"]]},{"id":"c50d864a.5fd408","type":"change","z":"1304d986.c082a6","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"speech","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":499,"y":305.25,"wires":[["9df5ef8.6ad0b1"]]},{"id":"eb585e79.c97e5","type":"watson-translator","z":"1304d986.c082a6","name":"","action":"translate","basemodel":"ar-en","domain":"conversational","srclang":"en","destlang":"es","password":"Kj8gJxS4UKYN","custom":"","domainhidden":"conversational","srclanghidden":"en","destlanghidden":"es","basemodelhidden":"ar-en","customhidden":"","filetype":"forcedglossary","trainid":"","lgparams2":true,"ldparamshidden2":"true","x":180,"y":230,"wires":[["12fa3d75.83d393"]]}]