From 1064fc13ea3fb7bb34e90b2c90dc59405031fb2d Mon Sep 17 00:00:00 2001 From: Chris Whitten Date: Fri, 11 Oct 2019 11:51:07 -0700 Subject: [PATCH 1/2] Removes sandwich bot --- .../packages/lib/shared/src/dialogFactory.ts | 15 + SampleBots/Sandwich/Main/Main.dialog | 89 ----- SampleBots/Sandwich/Main/Main.lg | 59 --- SampleBots/Sandwich/Main/Main.lu | 264 -------------- .../OrderSandwich/OrderSandwich.dialog | 345 ------------------ .../Sandwich/OrderSandwich/OrderSandwich.lu | 0 SampleBots/Sandwich/common/common.lg | 0 7 files changed, 15 insertions(+), 757 deletions(-) delete mode 100644 SampleBots/Sandwich/Main/Main.dialog delete mode 100644 SampleBots/Sandwich/Main/Main.lg delete mode 100644 SampleBots/Sandwich/Main/Main.lu delete mode 100644 SampleBots/Sandwich/OrderSandwich/OrderSandwich.dialog delete mode 100644 SampleBots/Sandwich/OrderSandwich/OrderSandwich.lu delete mode 100644 SampleBots/Sandwich/common/common.lg diff --git a/Composer/packages/lib/shared/src/dialogFactory.ts b/Composer/packages/lib/shared/src/dialogFactory.ts index a7f6b078a5..b72e13534d 100644 --- a/Composer/packages/lib/shared/src/dialogFactory.ts +++ b/Composer/packages/lib/shared/src/dialogFactory.ts @@ -72,6 +72,21 @@ export const seedDefaults = (type: string) => { return assignDefaults(properties); }; +const DEEP_COPY_TYPES = ['Microsoft.SendActivity']; +export const needsDeepCopy = $type => { + return DEEP_COPY_TYPES.indexOf($type) !== -1; +}; + +export const deepCopy: any = (data, lgApi) => { + // data.type is a SendActivity + // data.id is bound to copied SendActivity + // new id getDesignerId() + // data.activity references an LG template + // make new LG template based off of naming schema + // assign to data.activity + return undefined; +}; + export const seedNewDialog = ( $type: string, designerAttributes: Partial = {}, diff --git a/SampleBots/Sandwich/Main/Main.dialog b/SampleBots/Sandwich/Main/Main.dialog deleted file mode 100644 index af0e5abeb6..0000000000 --- a/SampleBots/Sandwich/Main/Main.dialog +++ /dev/null @@ -1,89 +0,0 @@ -{ - "$type": "Microsoft.AdaptiveDialog", - "autoEndDialog": false, - "recognizer": "Main.lu", - "generator": "Main.lg", - "events": [ - { - "$type": "Microsoft.OnIntent", - "actions": [ - { - "$type": "Microsoft.BeginDialog", - "dialog": "OrderSandwich" - } - ], - "intent": "OrderSandwich", - "$comment": "**** This is the start of top-level intent events ****", - "$designer": { - "createdAt": "2019-05-14T20:33:33.353Z", - "updatedAt": "2019-05-14T20:33:33.451Z", - "id": "155376" - } - }, - { - "$type": "Microsoft.OnIntent", - "intent": "SandwichOptions", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[SandwichOptions]" - } - ] - }, - { - "$type": "Microsoft.OnIntent", - "intent": "BreadOptions", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[BreadOptions]" - } - ] - }, - { - "$type": "Microsoft.OnIntent", - "intent": "ToppingOptions", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[ToppingOptions]" - } - ] - }, - { - "$type": "Microsoft.OnIntent", - "intent": "CheeseOptions", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[CheeseOptions]" - } - ] - }, - { - "$type": "Microsoft.OnIntent", - "intent": "Greeting", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Greeting]" - } - ] - }, - { - "$type": "Microsoft.OnBeginDialog", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Initial]" - } - ] - } - ], - "$schema": "../../app.schema", - "$designer": { - "createdAt": "2019-07-12T20:25:30.879Z", - "updatedAt": "2019-07-12T20:25:31.018Z", - "id": "325231" - } -} diff --git a/SampleBots/Sandwich/Main/Main.lg b/SampleBots/Sandwich/Main/Main.lg deleted file mode 100644 index 329ce8905c..0000000000 --- a/SampleBots/Sandwich/Main/Main.lg +++ /dev/null @@ -1,59 +0,0 @@ -# Initial -- What do you want in your sandwich?, for example you can order a sandwich with white bread, ham, swiss cheese and mayo - -# SandwichOptions -- Some of the most popular options are roast beef, turkey, ham, chicken and vegetarian sandwiches - -# BreadOptions -- You can chose these types of bread: white, wheat, multi grain and rye - -# ToppingOptions -- Some of the most popular toppings are - -# CheeseOptions -- Some of types of cheese available are swiss, gouda, feta, jack and american - -# Greeting -- Hi! How can I help you? - -# Help -- I don't understand that, but I can help you order a sandwich - -# FurtherHelp -- Try saying 'Order a sandwich' - -# Meat -- What kind of meat do you want on your sandwich? - -# Cheese -- What kind of cheese do you want on your sandwich? - -# Bread -- What kind of bread do you want on your sandwich? - -# Toppings -- What kind of toppings do you want on your sandwich? - -# MeatAndBread -- Which type of meat and bread do you want for your sandwich? - -# CheeseAndToppingsWithMeatAndBread -- What kind of cheese and toppings would you like on your {conversation.order.meat} on {conversation.order.bread} bread sandwich? - -# BreadAndToppingsWithMeatAndCheese -- What bread or toppings do you want on your {conversation.order.meat} with {conversation.order.cheese} sandwich? - -# MeatWithBread -- What kind of meat would you like in your {conversation.order.meat} bread sandwich? - -# Confirmation -- OK, do you want to place your order for a {conversation.order.meat} on {conversation.order.bread} sandwich with {join(conversation.order.topping, ',')} and {conversation.order.cheese}? - -# BeingProcessed -- Your order is being processed - -# StartAgain -- No problem, let's start again - -# NoIntent -- Sorry, I don't understand {turn.intent}. \ No newline at end of file diff --git a/SampleBots/Sandwich/Main/Main.lu b/SampleBots/Sandwich/Main/Main.lu deleted file mode 100644 index df7434a963..0000000000 --- a/SampleBots/Sandwich/Main/Main.lu +++ /dev/null @@ -1,264 +0,0 @@ -> ! Automatically generated by [LUDown CLI](https://github.com/Microsoft/botbuilder-tools/tree/master/Ludown), Thu Apr 18 2019 19:45:37 GMT-0700 (Pacific Daylight Time) - -> ! Source LUIS JSON file: LuisApp.json - -> ! Source QnA TSV file: Not Specified - -> ! Source QnA Alterations file: Not Specified - - -> # Intent definitions - -## BreadOptions -- tell me which type of breads do you have? -- what kind of bread do you have? -- what kind of breads are available? -- what kind of breads? -- what type of breads? -- which breads are available? -- which breads? - - -## CheeseOptions -- tell me the available cheese -- tell me which types of cheese do you have -- what cheese? -- which cheese? -- which types of cheese are available? - - -## Greeting -- good morning -- hello -- hey there -- hi - - -## None -- do not want -- don't want a sandwich -- it is cloudy outside -- it is raining so heavily -- no i do not want a sandwich -- no sandwich -- running - - -## OrderSandwich -- get me a sandwich -- i need a sandwich -- i want a sandwich -- i would like to order a sandwich -- order a sandwich -- order sandwich -- sandwich please -- {Meat} please -- give me a {Meat} sandwich with {Cheese} and {Cheese} cheese -- {Topping} and {Cheese} sandwich on {Bread} with {Topping} -- {Bread} -- i want a {Meat} sandwich with {Cheese} cheese and {Topping}, {Topping} and {Topping} -- {Topping} sandwich -- {Topping} please -- {Confirmation} thanks -- {Meat} with {Cheese} and {Cheese} -- {Topping} thanks -- {Topping}, {Topping} -- {Meat} {Cheese} and some {Topping} -- i'd like a {Meat} sandwich on {Bread} bread -- {Meat} thanks -- {Meat} {Cheese} on {Bread} -- {Meat} sandwich -- {Meat} sandwich with {Topping} and {Topping} -- i'd like a {Meat} sandwich -- {Meat} on {Bread} with {Cheese} -- {Bread} thanks -- can i get a {Meat} sandwich -- {Confirmation} -- i want a {Meat} sandwich with {Cheese} and {Topping} -- i want a {Meat} sandwich -- i'l like {Cheese} and {Cheese} cheese -- i want a {Meat} sandwich with {Topping} and {Topping} -- {Meat} sandwich with {Cheese} -- {Topping} and {Topping} -- {Cheese} {Meat} on {Bread} -- with {Topping} -- i would like a {Meat} sandwich -- {Cheese} with {Topping} on top -- {Meat} -- {Topping}, {Topping}, {Topping} -- {Cheese} and {Cheese} with {Meat} -- {Bread} bread -- {Meat} sandwich with {Bread} bread and {Cheese} cheese -- {Topping} -- i want {Cheese} and {Bread} bread -- {Meat} with {Bread} bread -- {Meat} with {Cheese} and {Bread} -- {Confirmation} please -- {Bread} please -- {Meat} on {Bread} -- i want a sub with {Bread} bread, {Meat} and {Topping} -- {Meat} sandwich with {Bread} and {Cheese} -- i want a {Meat} sandwich with {Topping}, {Topping}, {Topping} and {Topping} -- {Cheese} [cheese] - -## SandwichOptions -- i don't know which sandwiches do you have -- tell me which kind of sandwiches are available -- tell me which type of sandwiches do you have? -- types of sandwiches? -- what kind of sandwiches do you have? -- what kind of sandwiches? -- which sandwiches? -- which type of sandwiches? - - -## ToppingOptions -- kind of toppings? -- options for toppings? -- tell me which toppings? -- what are the options for toppings? -- what options for toppings? -- what toppings do you have? -- which kind of toppings are available? -- which toppings are available? - - -> # Entity definitions - - -> # PREBUILT Entity definitions - - -> # Phrase list definitions - - -> # List entities - -$Bread:white= -- plain - -$Bread:wheat= -- light - -$Bread:rye= - -$Bread:multigrain= -- multi grain -- grains - -$Bread:without bread= -- no bread -- lettuce wrap -- veggie wrap - - - -$Cheese:provolone= -- provolon - -$Cheese:swiss= - -$Cheese:cheddar= -- chedar - -$Cheese:jack= -- monterey jack -- pepperjack - -$Cheese:feta= - -$Cheese:american= -- yellow - -$Cheese:gouda= - -$Cheese:no cheese= -- without cheese - - - -$Confirmation:yes= -- yes -- yeah -- yaw -- yep -- yup -- okay -- yes -- yes -- yeah -- sure - -$Confirmation:no= -- no -- naw -- nope -- nah -- no -- nope - -$Meat:turkey= - -$Meat:ham= - -$Meat:pulled pork= -- pork - -$Meat:chicken= - -$Meat:roastbeef= -- roast-beef -- roast beef - -$Meat:salami= - -$Meat:bacon= - -$Meat:no meat= -- without meat - - - -$Topping:lettuce= -- letuce - -$Topping:olive oil= -- oil - -$Topping:oat= - -$Topping:tomatoes= -- tomato - -$Topping:mushrooms= -- mushroom - -$Topping:olives= -- olive - -$Topping:mayo= - -$Topping:mustard= - -$Topping:ketchup= - -$Topping:radish= - -$Topping:banana peppers= - -$Topping:pickles= - -$Topping:avocado= - -$Topping:no toppings= -- without toppings -- no topings -- without topings -- no toppins -- without toppins - - - -> # RegEx entities - - diff --git a/SampleBots/Sandwich/OrderSandwich/OrderSandwich.dialog b/SampleBots/Sandwich/OrderSandwich/OrderSandwich.dialog deleted file mode 100644 index 7f03a9ef26..0000000000 --- a/SampleBots/Sandwich/OrderSandwich/OrderSandwich.dialog +++ /dev/null @@ -1,345 +0,0 @@ -{ - "$type": "Microsoft.AdaptiveDialog", - "autoEndDialog": true, - "recognizer": "Main.lu", - "events": [ - { - "$type": "Microsoft.OnDialogEvent", - "constraint": "@meat && ignore(!turn.setmeat)", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "Set conversation.order.meat to {@meat}" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.meat", - "value": "@meat" - }, - { - "$comment": "This is a mechanism to keep the rule from running more than once per turn.", - "$type": "Microsoft.SetProperty", - "property": "turn.setmeat", - "value": "true" - }, - { - "$type": "Microsoft.EmitEvent", - "eventName": "recognizedIntent", - "bubbleEvent": true - } - ], - "events": [ - "recognizedIntent" - ], - "$comment": "**** Start of slot mapping over conversation.order as frame ****", - "$designer": { - "createdAt": "2019-08-08T16:30:52.572Z", - "updatedAt": "2019-08-08T16:30:52.583Z", - "id": "846020" - } - }, - { - "$type": "Microsoft.OnDialogEvent", - "constraint": "@cheese && ignore(!turn.setcheese)", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "Set conversation.order.cheese to {@cheese}" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.cheese", - "value": "@cheese" - }, - { - "$type": "Microsoft.SetProperty", - "property": "turn.setcheese", - "value": "true" - }, - { - "$type": "Microsoft.EmitEvent", - "eventName": "recognizedIntent", - "bubbleEvent": true - } - ], - "events": [ - "recognizedIntent" - ], - "$designer": { - "createdAt": "2019-08-08T16:30:55.681Z", - "updatedAt": "2019-08-08T16:30:55.691Z", - "id": "666381" - } - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "@bread && ignore(!turn.setbread)", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "Set conversation.order.bread to {@bread}" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.bread", - "value": "@bread" - }, - { - "$type": "Microsoft.SetProperty", - "property": "turn.setbread", - "value": "true" - }, - { - "$type": "Microsoft.EmitEvent", - "eventName": "recognizedIntent", - "bubbleEvent": true - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "@topping && ignore(!turn.settopping)", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "Set conversation.order.topping to {join(foreach(@@topping, list, first(list)), ', ')}" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.topping", - "value": "foreach(@@topping, list, first(list))" - }, - { - "$type": "Microsoft.SetProperty", - "property": "turn.settopping", - "value": "true" - }, - { - "$type": "Microsoft.EmitEvent", - "eventName": "recognizedIntent", - "bubbleEvent": true - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "@confirmation && ignore(!turn.setconfirmation)", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "Set conversation.order.confirmation to {@confirmation}" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.confirmation", - "value": "@confirmation" - }, - { - "$type": "Microsoft.SetProperty", - "property": "turn.setconfirmation", - "value": "true" - }, - { - "$type": "Microsoft.EmitEvent", - "eventName": "recognizedIntent", - "bubbleEvent": true - } - ] - }, - { - "$comment": "**** This is the start of prompts ****", - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.meat && !conversation.order.bread", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[MeatAndBread]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "conversation.order.meat && conversation.order.bread && !conversation.order.cheese && !conversation.order.topping", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[CheeseAndToppingsWithMeatAndBread]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.confirmation && conversation.order.meat && conversation.order.bread && conversation.order.cheese && conversation.order.topping", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Confirmation]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "$comment": "Should update this to use actual http with failure.", - "events": [ - "recognizedIntent" - ], - "constraint": "conversation.order.confirmation == 'yes' && !conversation.order.alldone", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[BeingProcessed]" - }, - { - "$type": "Microsoft.SetProperty", - "property": "conversation.order.alldone", - "value": "true" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "conversation.order.confirmation == 'no'", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[StartAgain]" - }, - { - "$type": "Microsoft.SendActivity", - "activity": "[Initial]" - }, - { - "$type": "Microsoft.DeleteProperty", - "property": "conversation.order" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "$comment": "This is the kind of thing we should build in a default for.", - "events": [ - "recognizedIntent" - ], - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[NoIntent]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "conversation.order.meat && conversation.order.cheese && !conversation.order.bread && !conversation.order.topping", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[BreadAndToppingsWithMeatAndCheese]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.meat && conversation.order.bread", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[MeatWithBread]" - } - ] - }, - { - "$comment": "*** Ideally these would be a generic template rule against any slot value. ***", - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.meat", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Meat]" - }, - { - "$type": "Microsoft.EndTurn" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "constraint": "!conversation.order.cheese", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Cheese]" - } - ], - "events": [ - "recognizedIntent" - ], - "$designer": { - "createdAt": "2019-08-08T16:31:04.354Z", - "updatedAt": "2019-08-08T16:31:04.365Z", - "id": "740844" - } - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.bread", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Bread]" - } - ] - }, - { - "$type": "Microsoft.OnDialogEvent", - "events": [ - "recognizedIntent" - ], - "constraint": "!conversation.order.topping", - "actions": [ - { - "$type": "Microsoft.SendActivity", - "activity": "[Toppings]" - } - ] - } - ], - "$comment": "**** Primary ordering dialog ****", - "$designer": { - "createdAt": "2019-08-08T16:30:49.214Z", - "updatedAt": "2019-08-08T16:30:49.233Z", - "id": "413751" - } -} diff --git a/SampleBots/Sandwich/OrderSandwich/OrderSandwich.lu b/SampleBots/Sandwich/OrderSandwich/OrderSandwich.lu deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/SampleBots/Sandwich/common/common.lg b/SampleBots/Sandwich/common/common.lg deleted file mode 100644 index e69de29bb2..0000000000 From e2bb0c3293bb4032f2d6f82cd4c6bc9a32389c17 Mon Sep 17 00:00:00 2001 From: Andy Brown Date: Fri, 11 Oct 2019 12:45:38 -0700 Subject: [PATCH 2/2] fix lint error --- Composer/packages/lib/shared/src/dialogFactory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Composer/packages/lib/shared/src/dialogFactory.ts b/Composer/packages/lib/shared/src/dialogFactory.ts index b72e13534d..baefe52b2f 100644 --- a/Composer/packages/lib/shared/src/dialogFactory.ts +++ b/Composer/packages/lib/shared/src/dialogFactory.ts @@ -77,7 +77,7 @@ export const needsDeepCopy = $type => { return DEEP_COPY_TYPES.indexOf($type) !== -1; }; -export const deepCopy: any = (data, lgApi) => { +export const deepCopy: any = (_data, _lgApi) => { // data.type is a SendActivity // data.id is bound to copied SendActivity // new id getDesignerId()