botserver/templates/llm-server.gbai/llm-server.gbdialog/start.bas

80 lines
2.4 KiB
QBasic
Raw Normal View History

2024-08-27 15:32:03 -03:00
2024-08-27 16:15:08 -03:00
PARAM stall AS number LIKE Stall Code
PARAM operator AS number LIKE Operator Code
2024-09-01 10:08:56 -03:00
DESCRIPTION This function (tool) is never called by LLM. It is a WebService of GB.
2024-08-23 00:00:04 -03:00
2024-08-27 16:15:08 -03:00
REM Login as Waiter
2024-08-23 00:00:04 -03:00
data = NEW OBJECT
2024-08-27 16:15:08 -03:00
data.OperatorIdentifier = operator
data.StallId = stall
2024-08-27 15:32:03 -03:00
login = POST host + "/login", data
2024-08-27 16:15:08 -03:00
SET HEADER "Authorization" AS login.accessToken
2024-08-23 00:00:04 -03:00
2024-08-27 16:15:08 -03:00
REM Get the menu - Use the token retrieved above.
data = GET host + "/Stall/${stall}"
products = NEW ARRAY
2024-08-23 00:00:04 -03:00
2024-08-27 16:15:08 -03:00
FOR EACH item IN data[0].items
IF item.itemStatus = "Active" THEN
product = NEW OBJECT
product.id = item.id
product.price = item.price
product.name = item.product.name
product.detail = item.detail
product.sides = item.sideGroups
products.push(product)
2024-08-23 00:00:04 -03:00
END IF
NEXT
BEGIN SYSTEM PROMPT
2024-08-27 16:15:08 -03:00
You must act as a chatbot that will assist a store attendant by following these rules:
Whenever the attendant places an order, it must include the table and the customer's name. Example: A 400ml Pineapple Caipirinha for Rafael at table 10.
Orders are based on the products and sides from this product menu:
${JSON.stringify(products)}.
For each order placed, return a JSON containing the product name, the table, and a list of sides with their respective ids.
Keep orderedItems with only one item and keep sideItems only with the sides that were specified.
sideItems should contain the collection of sides for the order, which is requested when the order is placed, for example: Strawberry Caipirinha with Ice, Sugar, and Lime would generate three elements in this node.
Here is an example of the Order JSON, clear the items and send one with the order made by the person, this is just an example:
2024-08-23 00:00:04 -03:00
{
2024-08-27 16:15:08 -03:00
orderedItems: [
2024-08-23 00:00:04 -03:00
{
2024-08-27 16:15:08 -03:00
item: {
2024-08-23 00:00:04 -03:00
id: 23872,
2024-08-27 16:15:08 -03:00
price: 20,
name: Guaraná
2024-08-23 00:00:04 -03:00
},
2024-08-27 16:15:08 -03:00
sideItems: [
{
2024-08-23 00:00:04 -03:00
id: 0,
2024-08-27 16:15:08 -03:00
price: 0,
quantity: 1
2024-08-23 00:00:04 -03:00
}
],
2024-08-27 16:15:08 -03:00
quantity: 1,
notes: a
2024-08-23 00:00:04 -03:00
},
{
item: {
id: 25510,
2024-08-27 16:15:08 -03:00
price: 12,
name: Orange Can 350ml
2024-08-23 00:00:04 -03:00
},
2024-08-27 16:15:08 -03:00
sideItems: [],
quantity: 1,
notes: none
2024-08-23 00:00:04 -03:00
}
],
2024-08-27 16:15:08 -03:00
stallId: ${stall},
userId: ${operator},
accountIdentifier: Areia,
deliveryTypeId: 2,
deliveryTypeFields: {
Table: 5
2024-08-23 00:00:04 -03:00
}
}
2024-08-27 16:15:08 -03:00
END SYSTEM PROMPT