Skip to content

In Cart

Description

購物車

Resource

POST /v1/openai_scenario/in_cart

Authorization

採用 OAuth 2.0 Bearer Token,詳細使用流程請參考 Auth Login

Request Body Parameters

Name Type Description
message string 用戶輸入
cart_items list[Product] 當前購物車商品

Request Body Parameters Product

Name Type Description
product_id string 商品代碼
quantity int 數量
taste list[Taste] 加值內容

Request Body Parameters Taste

Name Type Description
taste_id string 加值代碼
taste_item_id string 加值項目代碼
accept_taste_item list[Taste Item] 可調整的加值項目

Request Body Parameters Taste Item

Name Type Description
taste_item_id string 加值項目代碼
taste_item_name string 加值項目名稱(翻譯)

Request Example

{
    "message": "用戶輸入文本",
    "cart_items": [{
        "product_id": "H001",
        "quantity": 1,
        "taste": [{
            "taste_id": "ice",
            "taste_item_id": "ice01",
            "accept_taste_item": [{
                "taste_item_id": "ice01",
                "taste_item_name": "正常"
            },{
                "taste_item_id": "ice02",
                "taste_item_name": "少冰"
            }]
        }]
    }]
}

Response Body Parameters

Name Type Description
intent string 意圖
  • modify_cart
  • checkout
  • continue_order
  • unrecognized
parameters object 返回參數

Response Body Parameters Parameters

Name Type Description
modifications list[Modification] 修改商品
error_type string 錯誤類型

Response Body Parameters Modification

Name Type Description
old Product 原商品內容
new Product 新商品內容

Response Body Parameters Product

Name Type Description
product_id string 商品代碼
quantity int 數量
taste list[Taste] 加值內容

Response Body Parameters Taste

Name Type Description
taste_id string 加值代碼
taste_item_id string 加值項目代碼

Response Example

Status-Code: 200

{
    "intent": "accept_upsell",
    "parameters": {
        "modifications": [{
            "old": {
            "product_id": "H001",
            "quantity": 1,
            "taste": [{
                "taste_id": "ice",
                "taste_item_id": "ice01"}
                ]
            },
            "new":{
            "product_id": "H001",
            "quantity": 2,
            "taste": [{
                "taste_id": "ice",
                "taste_item_id": "ice02"}
                ]
            }
        }]
    }
}