Skip to content

Commit

Permalink
Add Luis entity utility (microsoft#147)
Browse files Browse the repository at this point in the history
* Initial commit

* Initial commit

* Initial commit

* Initial directory layout

* new layout

* new layout

* rename

* rename

* new folder layout
 On branch master

* Update README.md

* Update README.md

* Added enterprise template and vsix

* Remove unbuidable templated project from solution so that the SLN file
will build via Azure DevOps

* First docs upload

* Update customassistant-skills-pointofinterest.md

* Update customassistant-events.md

* Update customassistant-skills.md

Fixed typo

* overview and deployment updates

* readme

* removing headers

* removed headers

* Updated the Publisher from Lauren to Microsoft

* update name

* toc in readme and new diagram

* add zip build to pre-built step to enable auto builds

* Delete Bot Framework.zip

* Fix double backslash issue

* Create directory as part of pre-build events, as it's missing by
default.

* updated landing READMEs

* updated readme

* update to readme

* updated msbotClone and removed .bot file

* updated vsix template reference

* updated .vstemplate file

* updated generics in recipe

* updated images

* assistant docs update

* move to github repo

* latest changes

* post build tt file mapping

* new custom assistant overview

* added deviceintegration

* refinement

* Refined english responses and added two additional intent handlers to use more of the LUIS model

* Revert "Refined english responses and added two additional intent handlers to use more of the LUIS model"

This reverts commit 168a21c.

* refined responses, added extra LUIS handlers and change name to Virtual Assistant

* now virtual assistant

* virtual assistant name for review

* Rename to Virtual Assistant, New Docs

* docs and latest webchat

* new branded landing page for enterprise template

* architecture and detailed overview

* detailed overview

* copyalways set for *.bot

* Remove yeoman

* updated links

* docs update and DE localisation

* fix broken image for linked accounts

* new diagram

* fixing links

* enttemplate

* refinement

* Doc Changes, fixed namespace issues for responses due to name change and a locale issue with point of interest skill

* removed appsettings

* skill changes started

* package updates

* updated qnamaker telemetry

* Include launchsettings.json

* doc updates

* Revert "doc updates"

This reverts commit b41db47.

	deleted:    solutions/Virtual-Assistant/src/csharp/.deployment
	deleted:    solutions/Virtual-Assistant/src/csharp/assistant/.deployment
	deleted:    solutions/Virtual-Assistant/src/csharp/assistant/DarrenAssistantUS.bot
	modified:   solutions/Virtual-Assistant/src/csharp/assistant/appsettings.json
	modified:   templates/Enterprise-Template/EnterpriseBotTemplate/Bot Framework/Middleware/Telemetry/QnATelemetryConstants.cs
	modified:   templates/Enterprise-Template/EnterpriseBotTemplate/Bot Framework/Middleware/Telemetry/TelemetryQnAMaker.cs

* doc updates

* fixed skillDialog auth/eoc issues

* updated gitignore

* added bot.configuration package to microsoft.bot.solutions

* updated skill config to use luisServiceId from .bot file

* commented "always prompt" auth code

* Update issue templates

* Update issue templates

* Update issue templates

* Dev/rylengel/point of interest text event handling (microsoft#13)

* Update "Directions to" dynamic text on card
Clearing FoundLocations when an ActiveLocation is selected
Whats Nearby API limited to 3 results
A formatted string is used for speak property with only address line and locality

* If single route is offered offer choice prompt to begin. Works in conjunction w/ select action

* Branching off to choice prompt: if single found location or route is displayed. This removed the submit action button and asks user if they'd like to proceed to next step with yes/no.

* Updated string resources

* Update "Directions to" dynamic text on card
Clearing FoundLocations when an ActiveLocation is selected
Whats Nearby API limited to 3 results
A formatted string is used for speak property with only address line and locality

* If single route is offered offer choice prompt to begin. Works in conjunction w/ select action

* Branching off to choice prompt: if single found location or route is displayed. This removed the submit action button and asks user if they'd like to proceed to next step with yes/no.

* Updated string resources

* Converted ChoicePrompt to ConfirmPrompt

* cleaned up some code

* Cleaned up cards, testing POI on VirtualAssistant solution

* Update "Directions to" dynamic text on card
Clearing FoundLocations when an ActiveLocation is selected
Whats Nearby API limited to 3 results
A formatted string is used for speak property with only address line and locality

* If single route is offered offer choice prompt to begin. Works in conjunction w/ select action

* Branching off to choice prompt: if single found location or route is displayed. This removed the submit action button and asks user if they'd like to proceed to next step with yes/no.

* Updated string resources

* Converted ChoicePrompt to ConfirmPrompt

* cleaned up some code

* Cleaned up cards, testing POI on VirtualAssistant solution

* Showing speech hints on UI

* Updated LUIS endpoint with number entity, card UI, and parsing options like "navigate to option 1"

* Removed extra function

* Reverted files

* docs updated to reflect simpler skill configurationa and files renamed

* adding missing link to skill authentication docs

* docs update

* new skill auth diagram

* Update to WebTest for new preview webchat control, simplified configuration and updated docs with az bot command.

* doc update

* Lamil/et fix (microsoft#22)

* added template .zip to src

* updated gitignore to ignore all .bot files

* Lamil/et fix (microsoft#23)

* added template .zip to src

* updated gitignore to ignore all .bot files

* added launchSettings to ET

* Lamil/et fix (microsoft#24)

* added template .zip to src

* updated gitignore to ignore all .bot files

* added launchSettings to ET

* removed launch settings from gitignore -- need to preserve localhost endpoints

* Update appsettings.json

* add task by content, remove task by content, mark task by contebt (microsoft#25)

* Fix Azure Product Name conventions (microsoft#26)

* Update README.md

* Fixed broken link for event architecture (microsoft#31)

* Move back to one solution file and updated docs. (microsoft#32)

* update document to reflect latest permission list (microsoft#36)

* Lamil/lu skill local (microsoft#35)

* added news skill

* simplified skill invocation

* shared lib updates

* updated dispatch lg

* updated news skill

* updated template managers to set inputHint

* updated skill invocation and config to remove static fields

* added telemetry middleware to shared lib

* updated skill invocation and config

* started new calendar skill (new invocation)

* calendar skill updated

* shared lib updated

* updated todo skill

* updated email skill

* updated gitignore

* removed broken file

* added news skill

* simplified skill invocation

* shared lib updates

* updated dispatch lg

* updated news skill

* updated template managers to set inputHint

* updated skill invocation and config to remove static fields

* added telemetry middleware to shared lib

* updated skill invocation and config

* started new calendar skill (new invocation)

* calendar skill updated

* shared lib updated

* updated todo skill

* updated email skill

* updated gitignore

* removed broken file

* updates to skill dialog/auth

* updated skill projects

* bug fixes

* updated passing parameters to skills

* fix: Calendar: All day meeting refinement (microsoft#38)

* fix solution file that's causing build failure (microsoft#44)

* added de response files

* Tianyu/feature/deleteemail (microsoft#47)

* add delete dialog

* fix build issue

* add delete intent detaction when show email

* update luis model

* get commit 5fe39f9 back into master (microsoft#46)

* added skill template (microsoft#88)

* add stylecop rules and packages (microsoft#87)

* Feich/dev3 - fix some bugs to make the to do bot work (microsoft#89)

* fix bugs to make To Do skill work

* revert some unnecessary changes

* add reference to the ruleset file for stylecop (microsoft#91)

* Localisation for Skills (microsoft#93)

* ZH responses for skills

* add locale middleware

* Localised QNA and ZH for general model

* first pass of zh-hans deployment. Dispatch needs updating to zh-hans

* base assistant localisation

* new resource files for ZH

* cancelstrings build issue

* Update createvirtual assistant readme - Clone (microsoft#96)

There is an additional en subdirectory.

* Update issue templates

* UserId now shown on the linked accounts page enabling easy retrieveal for setting in speech apps or in the future the emulator (microsoft#100)

* Complete localisation of the VA base assistant includings intro cards and actions (microsoft#99)

* ZH responses for skills

* add locale middleware

* Localised QNA and ZH for general model

* first pass of zh-hans deployment. Dispatch needs updating to zh-hans

* base assistant localisation

* new resource files for ZH

* cancelstrings build issue

* complete localisation of the base VA resources across EFIGS intro adaptive cards, suggested actions, etc.

* defaultLocale now in configuration

* separated zh responses into subfiles (microsoft#114)

* add new folders for skills (microsoft#125)

* add new folders for skills

* update assistant project file to use the new files

* add todo skill renaming

* remove old skill folders

* remove what's left in the old skill folders

* rename all skill folders (microsoft#126)

* upgrade Microsoft.ASPNETCORE.all package to 2.1.5 (microsoft#127)

* upgrade Microsoft.ASPNETCORE.all package to 2.1.4

* upgrade all projects to 2.1.5

* add utility of calendar LUIS entity

* refactor parse date time logic and get events logic

* remove the datetime parser

* add usage of title in update and delete flow

* add location and meeting room entity
  • Loading branch information
KayMKM authored Oct 29, 2018
1 parent fb3e36c commit d9614bc
Show file tree
Hide file tree
Showing 8 changed files with 476 additions and 269 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public CalendarSkillState()
Title = null;
Content = null;
StartDate = null;
StartDateString = null;
StartTime = null;
StartTimeString = null;
StartDateTime = null;
EndDateTime = null;
Location = null;
Expand All @@ -31,6 +33,7 @@ public CalendarSkillState()
ShowEventIndex = 0;
SummaryEvents = null;
ReadOutEvents = new List<EventModel>();
Duration = 0;
}

public User User { get; set; }
Expand Down Expand Up @@ -79,6 +82,12 @@ public CalendarSkillState()

public List<EventModel> ReadOutEvents { get; set; }

public int Duration { get; set; }

public string StartDateString { get; set; }

public string StartTimeString { get; set; }

public TimeZoneInfo GetUserTimeZone()
{
if ((UserInfo != null) && (UserInfo.Timezone != null))
Expand All @@ -95,7 +104,9 @@ public void Clear()
Title = null;
Content = null;
StartDate = null;
StartDateString = null;
StartTime = null;
StartTimeString = null;
StartDateTime = null;
EndDateTime = null;
Location = null;
Expand All @@ -111,6 +122,7 @@ public void Clear()
ShowEventIndex = 0;
SummaryEvents = null;
ReadOutEvents = new List<EventModel>();
Duration = 0;
}

public class UserInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ public CreateEventDialog(
userNameString += attendee.DisplayName ?? attendee.Address;
}

return await sc.PromptAsync(Actions.Prompt, new PromptOptions {
Prompt = sc.Context.Activity.CreateReply(CreateEventResponses.NoTitle, _responseBuilder, new StringDictionary() { { "UserName", userNameString } })
});
return await sc.PromptAsync(Actions.Prompt, new PromptOptions
{
Prompt = sc.Context.Activity.CreateReply(CreateEventResponses.NoTitle, _responseBuilder, new StringDictionary() { { "UserName", userNameString } })
});
}
else
{
Expand Down Expand Up @@ -221,15 +222,7 @@ public CreateEventDialog(
{
try
{
var state = await _accessor.GetAsync(sc.Context);
if (state.StartTime == null)
{
return await sc.BeginDialogAsync(Actions.UpdateStartTimeForCreate, new UpdateDateTimeDialogOptions(UpdateDateTimeDialogOptions.UpdateReason.NotFound));
}
else
{
return await sc.NextAsync();
}
return await sc.BeginDialogAsync(Actions.UpdateStartTimeForCreate, new UpdateDateTimeDialogOptions(UpdateDateTimeDialogOptions.UpdateReason.NotFound));
}
catch
{
Expand Down Expand Up @@ -287,7 +280,7 @@ public CreateEventDialog(
try
{
var state = await _accessor.GetAsync(sc.Context);
if (sc.Result != null)
if (state.Location == null && sc.Result != null)
{
sc.Context.Activity.Properties.TryGetValue("OriginText", out var content);
var luisResult = state.LuisResult;
Expand Down Expand Up @@ -389,6 +382,11 @@ public CreateEventDialog(
try
{
var state = await _accessor.GetAsync(sc.Context);
if (state.AttendeesNameList.Count() > 0)
{
return await sc.NextAsync();
}

if (state.EventSource == EventSource.Microsoft)
{
return await sc.PromptAsync(Actions.Prompt, new PromptOptions
Expand Down Expand Up @@ -426,6 +424,11 @@ public CreateEventDialog(
try
{
var state = await _accessor.GetAsync(sc.Context);
if (state.AttendeesNameList.Count() > 0)
{
return await sc.BeginDialogAsync(Actions.ConfirmAttendee);
}

if (sc.Result != null)
{
sc.Context.Activity.Properties.TryGetValue("OriginText", out var content);
Expand Down Expand Up @@ -681,6 +684,10 @@ public CreateEventDialog(
if (dateTime != null)
{
bool isRelativeTime = IsRelativeTime(sc.Context.Activity.Text, dateTimeResolutions.First().Value, dateTimeResolutions.First().Timex);
if (ContainsTime(dateTimeConvertType))
{
state.StartTime = TimeZoneInfo.ConvertTime(dateTime, TimeZoneInfo.Local, state.GetUserTimeZone());
}

// Workaround as DateTimePrompt only return as local time
if (isRelativeTime)
Expand Down Expand Up @@ -713,19 +720,27 @@ public CreateEventDialog(
{
try
{
if (((UpdateDateTimeDialogOptions)sc.Options).Reason == UpdateDateTimeDialogOptions.UpdateReason.NotFound)
var state = await _accessor.GetAsync(sc.Context);
if (state.StartTime == null)
{
return await sc.PromptAsync(Actions.DateTimePrompt, new PromptOptions
if (((UpdateDateTimeDialogOptions)sc.Options).Reason == UpdateDateTimeDialogOptions.UpdateReason.NotFound)
{
Prompt = sc.Context.Activity.CreateReply(CreateEventResponses.NoStartTime),
});
return await sc.PromptAsync(Actions.DateTimePrompt, new PromptOptions
{
Prompt = sc.Context.Activity.CreateReply(CreateEventResponses.NoStartTime),
});
}
else
{
return await sc.PromptAsync(Actions.DateTimePrompt, new PromptOptions
{
Prompt = sc.Context.Activity.CreateReply(CalendarSharedResponses.DidntUnderstandMessage),
});
}
}
else
{
return await sc.PromptAsync(Actions.DateTimePrompt, new PromptOptions
{
Prompt = sc.Context.Activity.CreateReply(CalendarSharedResponses.DidntUnderstandMessage),
});
return await sc.NextAsync();
}
}
catch
Expand All @@ -740,7 +755,7 @@ public CreateEventDialog(
try
{
var state = await _accessor.GetAsync(sc.Context);
if (sc.Result != null)
if (sc.Result != null && state.StartTime == null)
{
IList<DateTimeResolution> dateTimeResolutions = sc.Result as List<DateTimeResolution>;
var dateTime = DateTime.Parse(dateTimeResolutions.First().Value);
Expand All @@ -750,17 +765,21 @@ public CreateEventDialog(
{
bool isRelativeTime = IsRelativeTime(sc.Context.Activity.Text, dateTimeResolutions.First().Value, dateTimeResolutions.First().Timex);
state.StartTime = isRelativeTime ? TimeZoneInfo.ConvertTime(dateTime, TimeZoneInfo.Local, state.GetUserTimeZone()) : dateTime;
state.StartDateTime = new DateTime(
state.StartDate.Value.Year,
state.StartDate.Value.Month,
state.StartDate.Value.Day,
state.StartTime.Value.Hour,
state.StartTime.Value.Minute,
state.StartTime.Value.Second);
return await sc.EndDialogAsync();
}
}

if (state.StartTime != null)
{
state.StartDateTime = new DateTime(
state.StartDate.Value.Year,
state.StartDate.Value.Month,
state.StartDate.Value.Day,
state.StartTime.Value.Hour,
state.StartTime.Value.Minute,
state.StartTime.Value.Second);
return await sc.EndDialogAsync();
}

return await sc.BeginDialogAsync(Actions.UpdateStartTimeForCreate, new UpdateDateTimeDialogOptions(UpdateDateTimeDialogOptions.UpdateReason.NotADateTime));
}
catch
Expand All @@ -775,7 +794,12 @@ public CreateEventDialog(
{
try
{
if (((UpdateDateTimeDialogOptions)sc.Options).Reason == UpdateDateTimeDialogOptions.UpdateReason.NotFound)
var state = await _accessor.GetAsync(sc.Context);
if (state.Duration > 0)
{
return await sc.NextAsync();
}
else if (((UpdateDateTimeDialogOptions)sc.Options).Reason == UpdateDateTimeDialogOptions.UpdateReason.NotFound)
{
return await sc.PromptAsync(Actions.DateTimePrompt, new PromptOptions
{
Expand All @@ -802,22 +826,23 @@ public CreateEventDialog(
try
{
var state = await _accessor.GetAsync(sc.Context);
if (sc.Result != null)
if (state.Duration <= 0 && sc.Result != null)
{
sc.Context.Activity.Properties.TryGetValue("OriginText", out var content);

IList<DateTimeResolution> dateTimeResolutions = sc.Result as List<DateTimeResolution>;
int.TryParse(dateTimeResolutions.First().Value, out int duration);
state.Duration = duration;
}

if (duration > 0)
{
state.EndDateTime = state.StartDateTime.Value.AddSeconds(duration);
return await sc.EndDialogAsync();
}
else
{
// TODO: Handle improper duration
}
if (state.Duration > 0)
{
state.EndDateTime = state.StartDateTime.Value.AddSeconds(state.Duration);
return await sc.EndDialogAsync();
}
else
{
// TODO: Handle improper duration
}

return await sc.BeginDialogAsync(Actions.UpdateDurationForCreate, new UpdateDateTimeDialogOptions(UpdateDateTimeDialogOptions.UpdateReason.NotADateTime));
Expand Down Expand Up @@ -897,29 +922,26 @@ public async Task<PromptOptions> GenerateOptions(List<Person> personList, List<P
Value = $"**{user.DisplayName}: {mailAddress}**",
Synonyms = new List<string> { (i + 1).ToString(), user.DisplayName, user.DisplayName.ToLower(), mailAddress },
};
if (!string.IsNullOrEmpty(user.UserPrincipalName))
var userName = user.UserPrincipalName.Split("@").FirstOrDefault() ?? user.UserPrincipalName;
if (!string.IsNullOrEmpty(userName))
{
var userName = user.UserPrincipalName.Split("@").FirstOrDefault() ?? user.UserPrincipalName;
if (!string.IsNullOrEmpty(userName))
{
{
choice.Synonyms.Add(userName);
choice.Synonyms.Add(userName.ToLower());
}

if (skip <= 0)
{
if (options.Choices.Count >= pageSize)
{
return options;
}
choice.Synonyms.Add(userName);
choice.Synonyms.Add(userName.ToLower());
}

options.Choices.Add(choice);
}
else
if (skip <= 0)
{
if (options.Choices.Count >= pageSize)
{
skip--;
return options;
}

options.Choices.Add(choice);
}
else
{
skip--;
}
}
}
Expand All @@ -938,33 +960,29 @@ public async Task<PromptOptions> GenerateOptions(List<Person> personList, List<P
Value = $"{user.DisplayName}: {mailAddress}",
Synonyms = new List<string> { (i + 1).ToString(), user.DisplayName, user.DisplayName.ToLower(), mailAddress },
};

if (!string.IsNullOrEmpty(user.UserPrincipalName))
var userName = user.UserPrincipalName?.Split("@").FirstOrDefault() ?? user.UserPrincipalName;
if (!string.IsNullOrEmpty(userName))
{
var userName = user.UserPrincipalName.Split("@").FirstOrDefault() ?? user.UserPrincipalName;
if (!string.IsNullOrEmpty(userName))
{
choice.Synonyms.Add(userName);
choice.Synonyms.Add(userName.ToLower());
}

if (skip <= 0)
{
if (options.Choices.Count >= pageSize)
{
return options;
}
choice.Synonyms.Add(userName);
choice.Synonyms.Add(userName.ToLower());
}

options.Choices.Add(choice);
}
else if (skip >= 10)
if (skip <= 0)
{
if (options.Choices.Count >= pageSize)
{
return options;
}
else
{
skip--;
}

options.Choices.Add(choice);
}
else if (skip >= 10)
{
return options;
}
else
{
skip--;
}
}

Expand Down
Loading

0 comments on commit d9614bc

Please sign in to comment.