2017-03-21 21 views
0

私はもう質問があります。 Unity 5.5.1f1とWatson Developer Cloud Unity SDK v0.13.0を使用しています。ウィジェットを使用する代わりに、私はWatson/Examples/ServiceExamples/Scripts内のスクリプトを使用していて、うまくいきました。会話サービスを手に入れることができました。しかし、私はすぐにこの設定で、私は子ノードに到達することができないことに気付きました。以下の会話エディタのスクリーンショットを見てください:IBM WATSON Unity SDKが子ノードに到達できません

conversation editor 私はオンラインこの会話をテストする場合、それは次のように判明します:私はユニティを通じてこれを行うとき

Watson: Hello, welcome to the paradise! 
Me: Can you turn off the music please. 
Watson: Ok, let's turn off something, you can say music, ac, and lights. 
Me: music 
Watson: ok, turn the music off. [child node] 

しかし、それは次のようになります。

会話は親ノードにとどまり、子ノードにはまったく届かないようです。または、サーバーへのすべてのメッセージがサービスをリセットするかどうか助けてください!!

最高、

+0

は同様の質問、http://stackoverflow.com/questions/42180038/slack-app-watson-watson-looses-intent-from-previous-message-received?rq=1 – Ghettokon

+0

「私が作ったのが見つかりましたSlackのuser_idでグループ化された既存のコンテキストを保存するシンプルなコードこのuser_idのコンテキストがすでに存在する場合、私のアプリケーションはWatson APIを呼び出してこのコンテキストを要求に追加するため、Watsonはこの新しいUserの入力が1。"私たちは実際にC#Unityでこれをどのように認識していますか? – Ghettokon

答えて

1

子ノードに到達するには、要求のコンテキストを渡す必要があります。応答では、次のリクエストに渡すことができるcontextプロパティがあります。

Conversation m_Conversation = new Conversation(); 

private void SendInitalMessage(string input) 
{ 
    if (string.IsNullOrEmpty(input)) 
    throw new ArgumentNullException("input"); 

    // Send inital message to the service 
    m_Conversation.Message(OnInitalMessage, <workspace-id>, input); 
} 



private void OnInitalMessage(MessageResponse resp, string customData) 
{ 
    if (resp != null) 
    { 
     // Check response here 

     // Create a message request object with the context 
     MessageRequest messageRequest = new MessageRequest(); 
     messageRequest.InputText = <input-text>; 
     messageRequest.alternate_intents = true; 
     messageRequest.ContextData = resp.context; // Context of the conversation 

     // Send the second message 
     SendFollowupMessage(messageRequest); 
    } 
    else 
    { 
     Debug.Log("Message Only: Failed to invoke Message();"); 
    } 
} 


private void SendFollowupMessage(MessageRequest messageRequest) 
{ 
    if (messageRequest == null) 
     throw new ArgumentNullException("messageRequest"); 

    m_Conversation.Message(OnFollowupMessage, <workspace-id>, messageRequest); 
} 


private void OnFollowupMessage(MessageResponse resp, string customData) 
{ 
    if (resp != null) 
    { 
     // Check response here 
    } 
    else 
    { 
     Debug.Log("Full Request: Failed to invoke Message();"); 
    } 
} 

コンテキストオブジェクトには、会話内のどこにユーザがいるかを追跡するためのconversationIDとその他のデータが含まれています。

"context": { 
    "conversation_id": "<conversation-id>", 
    "system": { 
     "dialog_stack": [ 
      { 
       "dialog_node": "<dialog-node>" 
      } 
     ], 
     "dialog_turn_counter": <turn-counter>, 
     "dialog_request_counter": <request-counter>, 
     "branch_exited": <branch-exited>, 
     "branch_exited_reason": "<exited-reason>" 
    }, 
    "defaultCounter": <default-counter> 
} 

EDIT:データモデルが更新されたようです。 resp.context.system.dialog_stackは文字列の配列であってはなりません。 RuntimeDialogStackオブジェクトの配列でなければなりません。

[fsObject] 
SystemResponse 
{ 
    public RuntimeDialogStack[] dialog_stack {get;set;} 
    public int dialog_turn_counter {get;set;} 
    public int dialog_request_counter {get;set;} 
} 

[fsObject] 
public class RuntimeDialogStack 
{ 
    public string dialog_node {get;set;} 
    public bool invoked_subdialog {get;set;} 
} 

EDIT 2:バージョン文字列の不一致でテストしたようです。このデータモデルを試して、VisualRecognitionデータモデルのバージョンパラメータが2017-02-03であることを確認してください。

[fsObject] 
SystemResponse 
{ 
    public DialogNode[] dialog_stack {get;set;} 
    public int dialog_turn_counter {get;set;} 
    public int dialog_request_counter {get;set;} 
} 

[fsObject] 
DialogNode 
{ 
    public string dialog_node {get;set;} 
    public bool invoked_subdialog {get;set;} 
} 
+0

こんにちは@taj、私は実現し、正確に行ったが、まだ動作していないので、私はいくつかのデバッグを行い、何とか私のresp.context.system.dialog_stackは常に空(長さ= 0)です。私はrespberry PiでTJbotコードを使って同じ作業場を試しました。それは想定通りに動作します。そこで、dialog_stack配列を取って、dialogRestに割り当てられる前に手動でdialog_stackに書き出しました。 'resp.context.system.dialog_stack = new string [] {"node_4_1489256441002"}; 'これは完全にこのように動作します。だから私はUnityのdialog_stackに何か間違っていると思っていた! – Ghettokon

+0

@Ghettokonデータモデルが更新されたようです。私は答えを更新しました - そのショットを与えてください。 – taj

+0

Debug.Log dialog_stack、これは 'System.String []'としてコンソールに表示されます... – Ghettokon

関連する問題