

终止支持通知：2025年9月15日， AWS 我们将停止对Amazon Lex V1的支持。2025 年 9 月 15 日之后，您将无法再访问 Amazon Lex V1 控制台或 Amazon Lex V1 资源。如果您使用的是 Amazon Lex V2，请改为参阅 [Amazon Lex V2 指南](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 步骤 3：创建目的 (AWS CLI)
<a name="gs-cli-create-order-flowers"></a>

为 `OrderFlowersBot` 自动程序创建一个目的并提供三个槽 (参数)。这些槽允许自动程序完成以下目的：
+ `FlowerType` 是一个自定义槽类型，用于指定可以订购哪些类型的鲜花。
+ `AMAZON.DATE` 和 `AMAZON.TIME` 是内置槽类型，用于获取从用户那里送花的日期和时间。

要运行本练习中的命令，您需要知道将在其中运行命令的区域。有关区域列表，请参阅[模型构建配额](gl-limits.md#gl-limits-model-building)。

**创建 `OrderFlowers`目的 (AWS CLI)**

1. 创建名为 **OrderFlowers.json** 的文本文件。将 JSON 代码从 [OrderFlowers.json](gs-cli-create-order-flowers-json.md) 复制到该文本文件中。

1. 在中 AWS CLI，调用[PutIntent](API_PutIntent.md)操作来创建意图。此示例的格式适用于 Unix、Linux 和 macOS。对于 Windows，请将每行末尾的反斜杠 (\$1) Unix 行继续符替换为脱字号 (^)。

   ```
   aws lex-models put-intent \
      --region region \
      --name OrderFlowers \
      --cli-input-json file://OrderFlowers.json
   ```

   服务器响应如下：

## 下一个步骤
<a name="gs-create-next-4"></a>

[步骤 4：创建自动程序 (AWS CLI)](gs-cli-create-order-flowers-bot.md)

# OrderFlowers.json
<a name="gs-cli-create-order-flowers-json"></a>

以下代码是创建 `OrderFlowers` 目的所需的 JSON 数据：

```
{
    "confirmationPrompt": {
        "maxAttempts": 2,
        "messages": [
            {
                "content": "Okay, your {FlowerType} will be ready for pickup by {PickupTime} on {PickupDate}.  Does this sound okay?",
                "contentType": "PlainText"
            }
        ]
    },
    "name": "OrderFlowers",
    "rejectionStatement": {
        "messages": [
            {
                "content": "Okay, I will not place your order.",
                "contentType": "PlainText"
            }
        ]
    },
    "sampleUtterances": [
        "I would like to pick up flowers",
        "I would like to order some flowers"
    ],
    "slots": [
        {
            "slotType": "FlowerTypes",
            "name": "FlowerType",
            "slotConstraint": "Required",
            "valueElicitationPrompt": {
                "maxAttempts": 2,
                "messages": [
                    {
                        "content": "What type of flowers would you like to order?",
                        "contentType": "PlainText"
                    }
                ]
            },
            "priority": 1,
            "slotTypeVersion": "$LATEST",
            "sampleUtterances": [
                "I would like to order {FlowerType}"
            ],
            "description": "The type of flowers to pick up"
        },
        {
            "slotType": "AMAZON.DATE",
            "name": "PickupDate",
            "slotConstraint": "Required",
            "valueElicitationPrompt": {
                "maxAttempts": 2,
                "messages": [
                    {
                        "content": "What day do you want the {FlowerType} to be picked up?",
                        "contentType": "PlainText"
                    }
                ]
            },
            "priority": 2,
            "description": "The date to pick up the flowers"
        },
        {
            "slotType": "AMAZON.TIME",
            "name": "PickupTime",
            "slotConstraint": "Required",
            "valueElicitationPrompt": {
                "maxAttempts": 2,
                "messages": [
                    {
                        "content": "Pick up the {FlowerType} at what time on {PickupDate}?",
                        "contentType": "PlainText"
                    }
                ]
            },
            "priority": 3,
            "description": "The time to pick up the flowers"
        }
    ],
    "fulfillmentActivity": {
        "type": "ReturnIntent"
    },
    "description": "Intent to order a bouquet of flowers for pick up"
}
```