-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlanAICode.txt
30 lines (24 loc) · 941 Bytes
/
AlanAICode.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
intent ("(open|view) (the| ) cart", p=>{
p.play({command:'open-cart'})
})
intent ("close (the| ) cart", p=>{
p.play({command:'close-cart'})
})
const itemNameSlot= "$(ITEM_NAME red|yellow|blue|orange|green|puple|light gray| dark gray)"
const quantityContext = context(()=>{
follow("$(QUANTITY NUMBER)",p => {
p.play({command: 'add-item', payload:{quantity: p.QUANTITY.number, name: p.state.name}})
p.resolve()
})
fallback("Please state how many items you want to add")
})
intent( `add (the|) ${ itemNameSlot } (item|) to (the|)cart`, p =>{
p.play("How many match would you like to add ?")
p.then(quantityContext, {state: {name: p.ITEM_NAME.value}})
})
intent( `remove (the|) ${ itemNameSlot } (item|) from (the|)cart`, p =>{
p.play({command: 'remove-item',payload:{name: p.ITEM_NAME.value}})
})
intent("(checkout|purchase items)", p => {
p.play({command: 'purchase-items'})
})