In many situations, it may be helpful to pass known information (e.g. the user's name to present a personalized greeting) into a new Watson Dialog conversation so to avoid asking the user redundant or unnecessary questions. In looking at the API documentation, I don't see a way to do that. Is there a best practice method for passing variables into a Watson Dialog conversation?
1288 次
2 に答える
4
Dialog サービスでは、変数は、会話中にユーザーが提供する情報を格納するために作成するプロファイルの一部です。
次のコードは、ユーザーの名前を保存するプロファイル変数の例を示しています。
<variables>
<var_folder name="username">
<var name="username" type="TEXT" description="The user's name."></var>
</var_folder>
</variables>
あなたのシナリオでは、次のように呼び出してこの変数を設定します。
PUT /v1/dialogs/{dialog_id}/profile
と:
{
"client_id": 4435,
"name_values": [
{
"name": "username",
"value": "Bruce Wayne"
}
]
}
{dialog_id}
とを置き換えることを忘れないでください{client_id}
。
API を試すことができる API Explorer があります: Dialog API Explorer。
これについては、このチュートリアルでも詳しく読むことができます。
于 2015-10-23T01:59:02.467 に答える