@@ -107,11 +107,16 @@ private IEnumerator Examples()
107
107
}
108
108
109
109
Log . Debug ( "ExampleAssistantV2.RunTest()" , "Are you open on Christmas?" ) ;
110
+
110
111
MessageRequest messageRequest1 = new MessageRequest ( )
111
112
{
112
113
Input = new MessageInput ( )
113
114
{
114
- Text = "Are you open on Christmas?"
115
+ Text = "Are you open on Christmas?" ,
116
+ Options = new MessageInputOptions ( )
117
+ {
118
+ ReturnContext = true
119
+ }
115
120
}
116
121
} ;
117
122
_service . Message ( OnMessage1 , _assistantId , _sessionId , messageRequest1 ) ;
@@ -126,7 +131,11 @@ private IEnumerator Examples()
126
131
{
127
132
Input = new MessageInput ( )
128
133
{
129
- Text = "What are your hours?"
134
+ Text = "What are your hours?" ,
135
+ Options = new MessageInputOptions ( )
136
+ {
137
+ ReturnContext = true
138
+ }
130
139
}
131
140
} ;
132
141
_service . Message ( OnMessage2 , _assistantId , _sessionId , messageRequest2 ) ;
@@ -141,7 +150,11 @@ private IEnumerator Examples()
141
150
{
142
151
Input = new MessageInput ( )
143
152
{
144
- Text = "I'd like to make an appointment for 12pm."
153
+ Text = "I'd like to make an appointment for 12pm." ,
154
+ Options = new MessageInputOptions ( )
155
+ {
156
+ ReturnContext = true
157
+ }
145
158
}
146
159
} ;
147
160
_service . Message ( OnMessage3 , _assistantId , _sessionId , messageRequest3 ) ;
@@ -152,11 +165,38 @@ private IEnumerator Examples()
152
165
}
153
166
154
167
Log . Debug ( "ExampleAssistantV2.RunTest()" , "On Friday please." ) ;
168
+
169
+ Dictionary < string , string > userDefinedDictionary = new Dictionary < string , string > ( ) ;
170
+ userDefinedDictionary . Add ( "name" , "Watson" ) ;
171
+
172
+ Dictionary < string , Dictionary < string , string > > skillDictionary = new Dictionary < string , Dictionary < string , string > > ( ) ;
173
+ skillDictionary . Add ( "user_defined" , userDefinedDictionary ) ;
174
+
175
+ Dictionary < string , Dictionary < string , Dictionary < string , string > > > skills = new Dictionary < string , Dictionary < string , Dictionary < string , string > > > ( ) ;
176
+ skills . Add ( "main skill" , skillDictionary ) ;
177
+
178
+ //SerializableDictionary<string, string> userDefinedDictionary = new SerializableDictionary<string, string>();
179
+ //userDefinedDictionary.Add("name", "Watson");
180
+
181
+ //SerializableDictionary<string, SerializableDictionary<string, string>> skillDictionary = new SerializableDictionary<string, SerializableDictionary<string, string>>();
182
+ //skillDictionary.Add("user_defined", userDefinedDictionary);
183
+
184
+ //MessageContextSkills skills = new MessageContextSkills();
185
+ //skills.Add("main skill", skillDictionary);
186
+
155
187
MessageRequest messageRequest4 = new MessageRequest ( )
156
188
{
157
189
Input = new MessageInput ( )
158
190
{
159
- Text = "On Friday please."
191
+ Text = "On Friday please." ,
192
+ Options = new MessageInputOptions ( )
193
+ {
194
+ ReturnContext = true
195
+ }
196
+ } ,
197
+ Context = new MessageContext ( )
198
+ {
199
+ Skills = skills
160
200
}
161
201
} ;
162
202
_service . Message ( OnMessage4 , _assistantId , _sessionId , messageRequest4 ) ;
@@ -177,43 +217,44 @@ private IEnumerator Examples()
177
217
Log . Debug ( "ExampleAssistantV2.Examples()" , "Assistant examples complete." ) ;
178
218
}
179
219
180
- private void OnDeleteSession ( WatsonResponse < object > response , WatsonError error , Dictionary < string , object > customData )
220
+ private void OnDeleteSession ( WatsonResponse < object > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
181
221
{
182
222
Log . Debug ( "ExampleAssistantV2.OnDeleteSession()" , "Session deleted." ) ;
183
223
_createSessionTested = true ;
184
224
}
185
225
186
- private void OnMessage0 ( WatsonResponse < MessageResponse > response , WatsonError error , Dictionary < string , object > customData )
226
+ private void OnMessage0 ( WatsonResponse < MessageResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
187
227
{
188
228
Log . Debug ( "ExampleAssistantV2.OnMessage0()" , "response: {0}" , response . Result . Output . Generic [ 0 ] . Text ) ;
189
229
_messageTested0 = true ;
190
230
}
191
231
192
- private void OnMessage1 ( WatsonResponse < MessageResponse > response , WatsonError error , Dictionary < string , object > customData )
232
+ private void OnMessage1 ( WatsonResponse < MessageResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
193
233
{
194
234
Log . Debug ( "ExampleAssistantV2.OnMessage1()" , "response: {0}" , response . Result . Output . Generic [ 0 ] . Text ) ;
195
235
196
236
_messageTested1 = true ;
197
237
}
198
-
199
- private void OnMessage2 ( WatsonResponse < MessageResponse > response , WatsonError error , Dictionary < string , object > customData )
238
+
239
+ private void OnMessage2 ( WatsonResponse < MessageResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
200
240
{
201
241
Log . Debug ( "ExampleAssistantV2.OnMessage2()" , "response: {0}" , response . Result . Output . Generic [ 0 ] . Text ) ;
202
242
_messageTested2 = true ;
203
243
}
204
244
205
- private void OnMessage3 ( WatsonResponse < MessageResponse > response , WatsonError error , Dictionary < string , object > customData )
245
+ private void OnMessage3 ( WatsonResponse < MessageResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
206
246
{
207
247
Log . Debug ( "ExampleAssistantV2.OnMessage3()" , "response: {0}" , response . Result . Output . Generic [ 0 ] . Text ) ;
208
248
_messageTested3 = true ;
209
249
}
210
- private void OnMessage4 ( WatsonResponse < MessageResponse > response , WatsonError error , Dictionary < string , object > customData )
250
+ private void OnMessage4 ( WatsonResponse < MessageResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
211
251
{
212
252
Log . Debug ( "ExampleAssistantV2.OnMessage4()" , "response: {0}" , response . Result . Output . Generic [ 0 ] . Text ) ;
253
+ //Log.Debug("ExampleAssistantV2.OnMessage4()", "response: {0}", response.Result.Context.Skills["main skill"]["user_defined"]["name"]);
213
254
_messageTested4 = true ;
214
255
}
215
256
216
- private void OnCreateSession ( WatsonResponse < SessionResponse > response , WatsonError error , Dictionary < string , object > customData )
257
+ private void OnCreateSession ( WatsonResponse < SessionResponse > response , WatsonError error , System . Collections . Generic . Dictionary < string , object > customData )
217
258
{
218
259
Log . Debug ( "ExampleAssistantV2.OnCreateSession()" , "Session: {0}" , response . Result . SessionId ) ;
219
260
_sessionId = response . Result . SessionId ;
0 commit comments