2017-08-02 9 views
0

私はカスタムレコグナイザを書きました。botbuilder LuisRecognizerがプロキシの背後で動作しない

bot.recognizer({ 
    recognize: function (context, done) { 
    var intent = { score: 1.0, intent: 'Greetings'}; 
     if (context.message.text.toLowerCase() == 'hello') { 
     done(null, intent); 
     } 
    } 
}); 

var bot = new builder.UniversalBot(connector, (session) => { 
    session.send("Sorry couldn't understand"); 
}); 

// here is the dialog 
bot.dialog('Greetings', [(session, args, next) => { 
    sesson.send("hey there"); 
}]).triggerAction({ 
    matches: 'Greetings', 
    onInterrupted: function (session) { 
     session.send('hey there'); 
    } 
}); 

エミュレータで「Hello」と入力すると、hey thereと返信されます。できます。

しかし、私はLuis APIを使ってみるとうまくいきません。これは、私はそれが動作しない端末(ノード>)で次のようにしてみてください"Sorry couldn't understand".

const model = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/**?subscription-key=***&verbose=true"; 
var recognizer = new builder.LuisRecognizer(model); 
bot.recognizer(recognizer) 

を返信します。 here is the doc I followed

var builder = require('botbuilder'); 
var model = "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/***?subscription-key=***&verbose=true&timezoneOffset=330&spellCheck=false"; 
var recognizer = new builder.LuisRecognizer(model); 
recognizer.recognize(
    "hello", 
    model, 
    function (err, intents, entities) { 
    console.log(intents); 
    } 
) 

ルイス・モデルのURL、完全に正常に動作し、適切なインテントを返し、ブラウザでそれをテストしました。

デバッグ方法は?

+1

"動作しない"とはどういう意味かわかりません。エラー、あなたのルイスモデル、訓練を受けた場合などの詳細を提供してください。 –

+0

https://github.com/Microsoft/BotBuilder-Samples/blob/master/Node/intelligence-LUIS/を見直しましたか? –

+0

はい、私はしました。プロキシはここで問題になりますか? – chandan

答えて

0
import globalTunnel from 'global-tunnel'; 

process.env.http_proxy = 'http://proxy:80'; 
process.env.https_proxy = 'http://proxy:80'; 
globalTunnel.initialize(); 

それが働いていた、認識bot.recognizer(recognizer)

を追加した後にglobalTunnel.end()を追加します。

+0

あなたはあなたの答えを受け入れることができますので、それは答えられたとマークされていますか?ありがとう:) –

関連する問題