Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
pull-requests: write
jobs:
build-android:
runs-on: ubuntu-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
pull-requests: write
jobs:
build-ios:
runs-on: macos-latest
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/code-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read
pull-requests: write
jobs:
code-lint:
runs-on: ubuntu-latest
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/release-template.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
description: 'Release Version Code'
required: true
type: string
permissions:
contents: read
pull-requests: write
env:
NEW_VERSION: ${{ github.event.inputs.release_tag }}
NEW_VERSION_CODE: ${{ github.event.inputs.release_code }}
Expand Down
55 changes: 40 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,37 +82,62 @@ this [example](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examp
2. Check whether you are in the [supported region](#supported-region), then click on the **Create parameter** button.
3. Fill in the parameters below, leaving other options as default:

- **Name**: Enter a parameter name (e.g., "SwiftChatAPIKey", will be used as `ApiKeyParam` in Step 2).
- **Name**: Enter a parameter name (e.g., "SwiftChatAPIKey", will be used as `ApiKeyParam` in Step 3).

- **Type**: Select `SecureString`

- **Value**: Enter any string without spaces.(this will be your `API Key` in Step 3)
- **Value**: Enter any string without spaces.(this will be your `API Key` in Step 4)

4. Click **Create parameter**.

### Step 2: Deploy stack and get your API URL
### Step 2: Build and push container images to ECR

1. Go to [CloudFormation Console](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChat) and select **Upload a template file** under **Specify template**, then use one of the following templates to deploy. (Make sure you are in the same region where your API Key was created.)
1. Clone this repository:
```bash
git clone https://github.com/aws-samples/swift-chat.git
cd swift-chat
```

- **App Runner**
2. Run the build and push script:
```bash
cd server/scripts
bash ./push-to-ecr.sh
```

Open [SwiftChatAppRunner.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatAppRunner.template), then download and upload the file.
3. Follow the prompts to configure:
- ECR repository name (or use default: `swift-chat-api`)
- Image tag (please use default: `latest`)
- AWS region (the region you want to deploy, e.g.,: `us-east-1`)
- Deployment type:
- Option 1 (default): **AppRunner** - uses amd64 architecture
- Option 2: **Lambda** - uses arm64 architecture

- **Lambda** (Note: For AWS customer use only)
4. The script will build and push the Docker image to your ECR repository.

Open [SwiftChatLambda.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatLambda.template) then download and upload the file.
5. **Important**: Copy the image URI displayed at the end of the script output. You'll need this in the next step.

2. Click **Next**, On the "Specify stack details" page, provide the following information:
- Fill the `ApiKeyParam` with the parameter name you used for storing the API key (e.g., "SwiftChatAPIKey").
- For App Runner, choose an `InstanceTypeParam` based on your needs.
3. Click **Next**, Keep the "Configure stack options" page as default, Read the Capabilities and Check the "I
### Step 3: Deploy stack and get your API URL

1. Download the CloudFormation template you want to use:
- For App Runner: [SwiftChatAppRunner.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatAppRunner.template)
- For Lambda: [SwiftChatLambda.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatLambda.template)

2. Go to [CloudFormation Console](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatAPI) and select **Upload a template file** under **Specify template**, then upload the template file you downloaded. (Make sure you are in the same region where your API Key was created.)

3. Click **Next**, On the "Specify stack details" page, provide the following information:
- **Stack name**: Keep the default "SwiftChatAPI" or change if needed
- **ApiKeyParam**: Enter the parameter name you used for storing the API key (e.g., "SwiftChatAPIKey")
- **ContainerImageUri**: Enter the ECR image URI from Step 2 output
- For App Runner, choose an **InstanceTypeParam** based on your needs

4. Click **Next**, Keep the "Configure stack options" page as default, Read the Capabilities and Check the "I
acknowledge that AWS CloudFormation might create IAM resources" checkbox at the bottom.
4. Click **Next**, In the "Review and create" Review your configuration and click **Submit**.
5. Click **Next**, In the "Review and create" Review your configuration and click **Submit**.

Wait about 3-5 minutes for the deployment to finish, then click the CloudFormation stack and go to **Outputs** tab, you
Wait about 35 minutes for the deployment to finish, then click the CloudFormation stack and go to **Outputs** tab, you
can find the **API URL** which looks like: `https://xxx.xxx.awsapprunner.com` or `https://xxx.lambda-url.xxx.on.aws`

### Step 3: Open the App and setup with API URL and API Key
### Step 4: Open the App and setup with API URL and API Key

1. Launch the App, open the drawer menu, and tap **Settings**.
2. Paste the `API URL` and `API Key`(The **Value** you typed in Parameter Store) Under Amazon Bedrock -> SwiftChat
Expand Down
56 changes: 40 additions & 16 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,60 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
2. 检查您是否在 [支持的区域](#支持的区域),然后点击 **创建参数** 按钮。
3. 填入以下参数,其他选项保持默认:

- **名称**:输入参数名称(例如 "SwiftChatAPIKey",将在步骤 2 中用作 `ApiKeyParam`)。
- **名称**:输入参数名称(例如 "SwiftChatAPIKey",将在步骤 3 中用作 `ApiKeyParam`)。

- **类型**:选择 `SecureString`

- **值**:输入任何不含空格的字符串(这将是步骤 3 中您的 `API Key`)
- **值**:输入任何不含空格的字符串(这将是步骤 4 中您的 `API Key`)

4. 点击 **创建参数**。

### 步骤 2:部署堆栈并获取 API URL
### 步骤 2:构建并推送容器镜像到 ECR

1. 前往 [CloudFormation 控制台](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChat),在**指定模板**下选择**上传模板文件**,然后使用以下模板之一进行部署。(确保您所在的区域与创建 API Key 的区域相同。)
1. 克隆此仓库:
```bash
git clone https://github.com/aws-samples/swift-chat.git
cd swift-chat
```

- **App Runner**
2. 运行构建和推送脚本:
```bash
cd server/scripts
bash ./push-to-ecr.sh
```

打开 [SwiftChatAppRunner.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatAppRunner.template),然后下载并上传文件。
3. 按照提示进行配置:
- ECR 仓库名称(或使用默认值:`swift-chat-api`)
- 镜像标签(请使用默认值:`latest`)
- AWS 区域(填写你希望部署的区域,例如:`us-east-1`)
- 部署类型:
- 选项 1(默认):**AppRunner** - 使用 amd64 架构
- 选项 2:**Lambda** - 使用 arm64 架构

- **Lambda**(注意:仅供 AWS 客户使用)
4. 脚本将构建并推送 Docker 镜像到您的 ECR 仓库。

打开 [SwiftChatLambda.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatLambda.template),然后下载并上传文件
5. **重要**:复制脚本输出末尾显示的镜像 URI。您将在下一步中需要它

2. 点击 **下一步**,在"指定堆栈详细信息"页面,提供以下信息:
- 用您存储 API 密钥的参数名称填写 `ApiKeyParam`(例如 "SwiftChatAPIKey")。
- 对于 App Runner,根据您的需求选择 `InstanceTypeParam`。
3. 点击 **下一步**,保持"配置堆栈选项"页面为默认,阅读功能并勾选底部的"我确认 AWS CloudFormation 可能会创建 IAM 资源"复选框。
4. 点击 **下一步**,在"审核并创建"中检查您的配置并点击 **提交**。
### 步骤 3:部署堆栈并获取 API URL

等待约 3-5 分钟完成部署,然后点击 CloudFormation 堆栈并转到 **输出** 选项卡,您可以找到类似
`https://xxx.xxx.awsapprunner.com` 或 `https://xxx.lambda-url.xxx.on.aws` 的 **API URL**。
1. 下载您想使用的 CloudFormation 模板:
- App Runner:[SwiftChatAppRunner.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatAppRunner.template)
- Lambda:[SwiftChatLambda.template](https://github.com/aws-samples/swift-chat/blob/main/server/template/SwiftChatLambda.template)

### 步骤 3:打开应用并使用 API URL 和 API Key 进行设置
2. 前往 [CloudFormation 控制台](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatAPI),在**指定模板**下选择**上传模板文件**,然后上传您下载的模板文件。(确保您所在的区域与创建 API Key 的区域相同。)

3. 点击 **下一步**,在"指定堆栈详细信息"页面,提供以下信息:
- **Stack name**:保持默认的 "SwiftChatAPI" 或根据需要更改
- **ApiKeyParam**:输入您用于存储 API 密钥的参数名称(例如 "SwiftChatAPIKey")
- **ContainerImageUri**:输入步骤 2 输出的 ECR 镜像 URI
- 对于 App Runner,根据您的需求选择 **InstanceTypeParam**

4. 点击 **下一步**,保持"配置堆栈选项"页面为默认,阅读功能并勾选底部的"我确认 AWS CloudFormation 可能会创建 IAM 资源"复选框。
5. 点击 **下一步**,在"审核并创建"中检查您的配置并点击 **提交**。

等待约 3-5 分钟完成部署,然后点击 CloudFormation 堆栈并转到 **输出** 选项卡,您可以找到 **API URL**,类似于:`https://xxx.xxx.awsapprunner.com` 或 `https://xxx.lambda-url.xxx.on.aws`

### 步骤 4:打开应用并使用 API URL 和 API Key 进行设置

1. 启动应用,打开抽屉菜单,点击 **设置**。
2. 粘贴 `API URL` 和 `API Key`(您在 Parameter Store 中输入的 **值**)到 Amazon Bedrock -> SwiftChat Server 下,然后选择您的区域。
Expand Down
Loading