Skip to content

Commit

Permalink
fix order bot bug
Browse files Browse the repository at this point in the history
  • Loading branch information
singhk97 committed Oct 22, 2024
1 parent fb9cc24 commit e9145a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/samples/06.assistants.b.orderBot/src/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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]]

0 comments on commit e9145a5

Please sign in to comment.