public async Task ProcessIntent(AIResponse aIResponse) { AccessToken accessToken = await _tokenManager.GetAccessTokenFromCache().ConfigureAwait(false); _lineMessagingClient = new LineMessagingClient(accessToken.access_token); var app = new LineBotApp(_lineMessagingClient); // try case IntentName to IntentType Enum IntentType intentType = IntentType.Unknown; if (Enum.TryParse <IntentType>(aIResponse.Result.Metadata.IntentName, out intentType)) { aIResponse.Result.Metadata.IntentType = intentType; } Event tempEvent = new Event(); switch (aIResponse.Result.Metadata.IntentType) { case IntentType.ButtonIntent: // Down Cast tempEvent = aIResponse.OriginalRequest.Event; MessageEvent messageEventTemp = (MessageEvent)tempEvent; TextEventMessage eventMessageTemp = (TextEventMessage)messageEventTemp.Message; eventMessageTemp.Text = "buttons"; break; default: break; } await app.RunAsync(new List <WebhookEvent>(){ (WebhookEvent)tempEvent }); }
public Intent(IntentType intentType, string intentString, int intentInt, bool intentBool) { this.intentType = intentType; this.intentString = intentString; this.intentInt = intentInt; this.intentBool = intentBool; }
public bool IsIntentTypeEnabled(IntentType type) { switch (type) { case IntentType.PLAY_VIDEO: return(YouTubeIntents.CanResolvePlayVideoIntent(this)); case IntentType.OPEN_PLAYLIST: return(YouTubeIntents.CanResolveOpenPlaylistIntent(this)); case IntentType.PLAY_PLAYLIST: return(YouTubeIntents.CanResolvePlayPlaylistIntent(this)); case IntentType.OPEN_SEARCH: return(YouTubeIntents.CanResolveSearchIntent(this)); case IntentType.OPEN_USER: return(YouTubeIntents.CanResolveUserIntent(this)); case IntentType.OPEN_CHANNEL: return(YouTubeIntents.CanResolveChannelIntent(this)); case IntentType.UPLOAD_VIDEO: return(YouTubeIntents.CanResolveUploadIntent(this)); } return(false); }
public EnemyIntent(AbstractCard cardToPlay, AbstractArgument target) { this.cardToPlay = cardToPlay; this.argumentTargeted = target; if (cardToPlay.TYPE == CardType.TRAIT) { this.intentType = IntentType.TRAIT; } else if (cardToPlay.TYPE == CardType.ATTACK) { this.intentType = IntentType.ATTACK; } else if (cardToPlay.TYPE == CardType.SKILL) { if (target.OWNER == cardToPlay.OWNER) { this.intentType = IntentType.BUFF_SKILL; } else { this.intentType = IntentType.DEBUFF_SKILL; } } else { this.intentType = IntentType.UNKNOWN; } }
public bool IsIntentTypeEnabled(IntentType type) { switch (type) { case IntentType.PlayVideo: return(YouTubeIntents.CanResolvePlayVideoIntent(context)); case IntentType.OpenPlaylist: return(YouTubeIntents.CanResolveOpenPlaylistIntent(context)); case IntentType.PlayPlaylist: return(YouTubeIntents.CanResolvePlayPlaylistIntent(context)); case IntentType.OpenSearch: return(YouTubeIntents.CanResolveSearchIntent(context)); case IntentType.OpenUser: return(YouTubeIntents.CanResolveUserIntent(context)); case IntentType.OpenChannel: return(YouTubeIntents.CanResolveChannelIntent(context)); case IntentType.UploadVideo: return(YouTubeIntents.CanResolveUploadIntent(context)); } return(false); }
// Select the body part and deselect others public void SelectIntent(Button selected) { bool harm = selectedIntent == IntentType.Harm; selectedIntent = harm ? IntentType.Help : IntentType.Harm; intentImage.sprite = harm ? spriteHelp : spriteHarm; intentImage.color = harm ? colorHelp : colorHarm; }
public DrawPixelIntent(IntentType type, FizzikFrame frame, FizzikLayer layer, int px, int py, Color color) { this.type = type; this.frame = frame; this.layer = layer; this.x = px; this.y = py; this.color = color; }
protected IntentHandler(ContextAdapter context, IntentType intent, LockType requiresLock) { Context = context; Request = context.Request; Response = context.Response; CancellationToken = context.CancellationToken; Store = context.Configuration.Store; Intent = intent; LockType = requiresLock; }
public static IntentType LogIntent(IntentType intentType) { if (!Settings.DebugLogs) { return(intentType); } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Intent: {intentType.ToString()}"); Console.ResetColor(); return(intentType); }
public IntentsModule() : base("") { base.Post("/intents", params_ => { try { // body -> json -> RequestWebHookIntent RequestWebHookIntent incomeWebHook = RequestWebHookIntent.FromJson(RequestStream.FromStream(Request.Body).AsString()); IntentType.Type intentType = IntentType.GetType(incomeWebHook?.QueryResult?.Intent?.Name); object Parameters = incomeWebHook?.QueryResult?.Parameters; // Here is a temporary fix of bug in Dialogflow. // Slack have changed api and today (12.09.2019) Dialogflow not correct works with unswers to slack if (intentType == IntentType.Type.Undefined || (incomeWebHook?.QueryResult?.AllRequiredParamsPresent ?? false) == false) { return(buildFulfillmentMessage(incomeWebHook)); } switch (intentType) { case IntentType.Type.Undefined: break; case IntentType.Type.WhereCoworker: //return onWhereCoworker(WhereCoworkerDTO.FromObject(Parameters)); onWhereCoworker(WhereCoworkerDTO.FromObject(Parameters)); break; case IntentType.Type.WhenCoworker: //return onWhenCoworker(WhenCoworkerDTO.FromObject(Parameters)); onWhenCoworker(WhenCoworkerDTO.FromObject(Parameters)); break; } return(buildFulfillmentMessage(incomeWebHook)); } catch (Exception e) { Console.WriteLine("Exception: " + e.Message + "\n" + e.StackTrace); } return(404); }); }
public Intent(string name, string dialogName, IntentType type) { Name = name; DialogName = dialogName; Type = type; }
/** Puts the intent into a queue to be sent during the next frame. Note that an intent is sent only once, * no matter how many times it has been marked. */ public static void markForSending(IntentType t) { activeIntents.Add(t); }
public static bool isActive(IntentType t) { return activeIntents.Contains(t); }
public IntentItem(Context context, string title, IntentType type) { this.context = context; this.title = title; this.type = type; }
public TextIntent(IntentType intent, IntentTarget target = IntentTarget.None) : base(SourceType.Text, intent, target) { }
protected UserIntent(SourceType source, IntentType intent, IntentTarget target = IntentTarget.None) { Source = source; Intent = intent; Target = target; }