From e9145a59e850252f38ddca8fb5bab5e94c1fb9ab Mon Sep 17 00:00:00 2001 From: Kavin Singh Date: Tue, 22 Oct 2024 16:32:04 -0700 Subject: [PATCH] fix order bot bug --- python/samples/06.assistants.b.orderBot/src/bot.py | 4 ++-- .../src/food_order_view_schema.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python/samples/06.assistants.b.orderBot/src/bot.py b/python/samples/06.assistants.b.orderBot/src/bot.py index 08194f577..952b4b8b0 100644 --- a/python/samples/06.assistants.b.orderBot/src/bot.py +++ b/python/samples/06.assistants.b.orderBot/src/bot.py @@ -133,10 +133,10 @@ async def turn_state_factory(context: TurnContext): @app.ai.action("place_order") async def on_place_order( - context: ActionTurnContext[Order], + context: ActionTurnContext, state: AppTurnState, ): - card = generate_card_for_order(context.data) + card = generate_card_for_order(Order.from_dict(context.data)) await context.send_activity(MessageFactory.attachment(card)) return "order placed" diff --git a/python/samples/06.assistants.b.orderBot/src/food_order_view_schema.py b/python/samples/06.assistants.b.orderBot/src/food_order_view_schema.py index 8f6869d41..5e6aac6e1 100644 --- a/python/samples/06.assistants.b.orderBot/src/food_order_view_schema.py +++ b/python/samples/06.assistants.b.orderBot/src/food_order_view_schema.py @@ -19,13 +19,13 @@ class Pizza(DataClassJsonMixin): item_type = "pizza" - added_toppings: Optional[List[str]] + added_toppings: Optional[List[str]] = None "Toppings requested (examples: pepperoni, arugula)" - removed_toppings: Optional[List[str]] + removed_toppings: Optional[List[str]] = None "Toppings requested to be removed (examples: fresh garlic, anchovies)" - name: Optional[PizzaName] + name: Optional[PizzaName] = None "Used if the requester references a pizza by name" size: Optional[PizzaSize] = "large" @@ -69,10 +69,10 @@ class Beer(DataClassJsonMixin): class Salad(DataClassJsonMixin): item_type = "salad" - added_ingredients: Optional[List[str]] + added_ingredients: Optional[List[str]] = None "Ingredients requested (examples: parmesan, croutons)" - removed_ingredients: Optional[List[str]] + removed_ingredients: Optional[List[str]] = None "Ingredients requested to be removed (example: red onions)" portion: Optional[SaladSize] = "half" @@ -89,4 +89,4 @@ class Order(DataClassJsonMixin): An order from a restaurant that serves pizza, beer, and salad """ - items: List[Union[Pizza, Beer, Salad, NamedPizza, UnknownText]] + items: List[Union[Pizza, Beer, Salad, NamedPizza, UnknownText]] \ No newline at end of file