Exemplo n.º 1
0
        /// <summary>
        /// Query the LUIS service using this request.
        /// </summary>
        /// <param name="service">LUIS service.</param>
        /// <param name="request">Query request.</param>
        /// <param name="token">Cancellation token.</param>
        /// <returns>LUIS result.</returns>
        public static async Task <LuisResult> QueryAsync(this ILuisService service, LuisRequest request, CancellationToken token)
        {
            service.ModifyRequest(request);
            var uri = service.BuildUri(request);

            return(await service.QueryAsync(uri, token));
        }
Exemplo n.º 2
0
        protected virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> item)
        {
            var message     = await item;
            var luisRequest = new LuisRequest(query: message.Text, contextId: this.contextId);
            var result      = await luisService.QueryAsync(luisService.BuildUri(luisService.ModifyRequest(luisRequest)), context.CancellationToken);

            if (result.Dialog.Status != DialogResponse.DialogStatus.Finished)
            {
                this.contextId = result.Dialog.ContextId;
                this.prompt    = result.Dialog.Prompt;
                await context.PostAsync(this.prompt);

                context.Wait(MessageReceivedAsync);
            }
            else
            {
                context.Done(result);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Builds luis uri with text query.
 /// </summary>
 /// <param name="service">LUIS service.</param>
 /// <param name="text">The query text.</param>
 /// <returns>The LUIS request Uri.</returns>
 public static Uri BuildUri(this ILuisService service, string text)
 {
     return(service.BuildUri(service.ModifyRequest(new LuisRequest(query: text))));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Query the LUIS service using this text.
        /// </summary>
        /// <param name="service">LUIS service.</param>
        /// <param name="text">The query text.</param>
        /// <param name="token">The cancellation token.</param>
        /// <returns>The LUIS result.</returns>
        public static async Task <LuisResult> QueryAsync(this ILuisService service, string text, CancellationToken token)
        {
            var luisRequest = service.ModifyRequest(new LuisRequest(query: text));

            return(await service.QueryAsync(luisRequest, token));
        }