Skip to content

Commit daf7585

Browse files
committed
feat: performance optimize (#15)
1 parent 7d08db3 commit daf7585

29 files changed

+1640
-658
lines changed

README.md

+33-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
[中文](/README_CN.md)
2-
31
# SwiftChat - A Cross-platform AI Chat App
42

3+
> 🚀 Your Personal AI Assistant - Fast, Private, and Cross-platform
4+
5+
[![GitHub Release](https://img.shields.io/github/v/release/aws-samples/swift-chat)](https://github.com/aws-samples/swift-chat/releases)
6+
[![License](https://img.shields.io/badge/license-MIT--0-green)](LICENSE)
7+
8+
## 📱 Quick Download
9+
10+
- [Download for Android](https://github.com/aws-samples/swift-chat/releases/download/2.0.1/SwiftChat.apk)
11+
- [Download for macOS](https://github.com/aws-samples/swift-chat/releases/download/2.0.1/SwiftChat.dmg)
12+
- For iOS: Currently available through local build with Xcode
13+
14+
[中文](/README_CN.md)
15+
516
SwiftChat is a fast and responsive AI chat application developed with [React Native](https://reactnative.dev/) and
617
powered by [Amazon Bedrock](https://aws.amazon.com/bedrock/), with compatibility extending to other model providers such
718
as Ollama, DeepSeek, and OpenAI. With its minimalist design philosophy and robust privacy protection, it delivers
@@ -100,6 +111,9 @@ Please follow
100111
the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) to
101112
enable your models.
102113

114+
<details>
115+
<summary><b>🔧 Configuration Steps (Click to expand)</b></summary>
116+
103117
### Step 1: Set up your API Key
104118

105119
1. Sign in to your AWS console and
@@ -138,19 +152,14 @@ enable your models.
138152
Wait about 3-5 minutes for the deployment to finish, then click the CloudFormation stack and go to **Outputs** tab, you
139153
can find the **API URL** which looks like: `https://xxx.xxx.awsapprunner.com` or `https://xxx.lambda-url.xxx.on.aws`
140154

141-
### Step 3: Download the app and setup with API URL and API Key
142-
143-
1. Download the App
144-
145-
- Android App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.10.0/SwiftChat.apk)
146-
- macOS App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.10.0/SwiftChat.dmg)
147-
- iOS (Currently we do not provide the iOS version, you can build it locally with Xcode)
155+
### Step 3: Open the App and setup with API URL and API Key
148156

149-
2. Launch the App, open the drawer menu, and tap **Settings**.
150-
3. Paste the `API URL` and `API Key` then select the Region.
151-
4. Click the top right ✓ icon to save your configuration and start your chat.
157+
1. Launch the App, open the drawer menu, and tap **Settings**.
158+
2. Paste the `API URL` and `API Key`(The **Value** you typed in Parameter Store) then select the Region.
159+
3. Click the top right ✓ icon to save your configuration and start your chat.
152160

153161
Congratulations 🎉 Your SwiftChat App is ready to use!
162+
</details>
154163

155164
### Supported Region
156165

@@ -168,7 +177,8 @@ Congratulations 🎉 Your SwiftChat App is ready to use!
168177

169178
## Getting Started with Other Model Providers
170179

171-
### Configure Ollama
180+
<details>
181+
<summary><b>🔧 Configure Ollama (Click to expand)</b></summary>
172182

173183
1. Navigate to the **Settings Page** and select the **Ollama** tab.
174184
2. Enter your Ollama Server URL. For example:
@@ -178,15 +188,21 @@ Congratulations 🎉 Your SwiftChat App is ready to use!
178188
3. Once the correct Server URL is entered, you can select your desired Ollama models from the **Text Model** dropdown
179189
list.
180190

181-
### Configure DeepSeek
191+
</details>
192+
193+
<details>
194+
<summary><b>🔧 Configure DeepSeek (Click to expand)</b></summary>
182195

183196
1. Go to the **Settings Page** and select the **DeepSeek** tab.
184197
2. Input your DeepSeek API Key.
185198
3. Choose DeepSeek models from the **Text Model** dropdown list. Currently, the following DeepSeek models are supported:
186199
- `DeepSeek-V3`
187200
- `DeepSeek-R1`
188201

189-
### Configure OpenAI
202+
</details>
203+
204+
<details>
205+
<summary><b>🔧 Configure OpenAI (Click to expand)</b></summary>
190206

191207
1. Navigate to the **Settings Page** and select the **OpenAI** tab.
192208
2. Enter your OpenAI API Key.
@@ -197,6 +213,8 @@ Congratulations 🎉 Your SwiftChat App is ready to use!
197213
Additionally, if you have deployed the [ClickStream Server](#step-2-deploy-stack-and-get-your-api-url), you can enable
198214
the **Use Proxy** option to forward your requests.
199215

216+
</details>
217+
200218
## Detailed Features
201219

202220
**Quick Access Tools**: Code Copy, Selection Mode, Scroll Controls and Token Counter
@@ -265,7 +283,6 @@ orientation.
265283

266284
- Speed up end-to-end API requests through **image compression**
267285
- Deploying APIs in the **same region** as Bedrock provides lower latency
268-
- Minimal response payload with **zero parsing** needed for direct display
269286

270287
📱 **Fast Render Speed**
271288

README_CN.md

+37-24
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
[English](/README.md)
2-
31
# SwiftChat - 跨平台 AI 聊天应用
42

3+
> 🚀 您的私人 AI 助手 - 快速、安全、跨平台
4+
5+
[![GitHub Release](https://img.shields.io/github/v/release/aws-samples/swift-chat)](https://github.com/aws-samples/swift-chat/releases)
6+
[![License](https://img.shields.io/badge/license-MIT--0-green)](LICENSE)
7+
8+
## 📱 快速下载
9+
10+
- [下载 Android 版本](https://github.com/aws-samples/swift-chat/releases/download/2.0.1/SwiftChat.apk)
11+
- [下载 macOS 版本](https://github.com/aws-samples/swift-chat/releases/download/2.0.1/SwiftChat.dmg)
12+
- iOS 版本:目前可通过 Xcode 本地构建使用
13+
14+
[English](/README.md)
15+
516
SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https://reactnative.dev/)
617
开发,并依托 [Amazon Bedrock](https://aws.amazon.com/bedrock/) 提供强大支持,同时兼容 Ollama、DeepSeek 和 OpenAI
718
等其他模型供应商。凭借其极简设计理念与坚实的隐私保护措施,该应用在 Android、iOS 和 macOS 平台上实现了实时流式对话及 AI
@@ -71,7 +82,7 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
7182
我们重新设计了用户界面,优化了字体大小和行间距,呈现出更优雅、清爽的视觉效果。这些功能也都完美适配了 Android 和 macOS
7283
的原生界面,确保了流畅的使用体验。
7384

74-
> 注意: 放了方便展示其中一些动图有加速处理。如您遇到动图卡顿的情况,请在电脑上使用 Chrome, Firefox 或者 Edge 浏览器进行查看。
85+
> 注意: 为了方便展示,其中一些动图有加速处理。如您遇到动图卡顿的情况,请在电脑上使用 Chrome, Firefox 或者 Edge 浏览器进行查看。
7586
7687
## 架构
7788

@@ -93,9 +104,10 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
93104
- 文本模型: `Amazon Nova Pro`
94105
- 图像模型: `Stable Diffusion 3.5 Large`
95106

96-
如果您要使用图片生成功能,请确保已开启 `Amazon Nova Lite`
97-
模型的访问权限。您可以参考 [Amazon Bedrock 用户指南](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html)
98-
来启用您的模型。
107+
如果您要使用图片生成功能,请确保已开启 `Amazon Nova Lite` 模型的访问权限。您可以参考 [Amazon Bedrock 用户指南](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) 来启用您的模型。
108+
109+
<details>
110+
<summary><b>🔧 配置步骤(点击展开)</b></summary>
99111

100112
### 第 1 步: 设置 API Key
101113

@@ -122,26 +134,19 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
122134
2. 点击 **下一步**,在"指定堆栈详细信息"页面中提供以下信息:
123135
- 使用存储 API Key 的参数名填写`ApiKeyParam`(例如"SwiftChatAPIKey")。
124136
- 对于 App Runner,根据您的需求选择`InstanceTypeParam`
125-
3. 点击 **下一步**,保持 "配置堆栈选项" 页面默认设置,阅读功能并勾选底部的 "我确认,AWS CloudFormation 可能会创建 IAM 资源"
126-
复选框。
137+
3. 点击 **下一步**,保持 "配置堆栈选项" 页面默认设置,阅读功能并勾选底部的 "我确认,AWS CloudFormation 可能会创建 IAM 资源" 复选框。
127138
4. 点击 **下一步**,在 "审核并创建" 中检查配置并点击 **提交**
128139

129-
等待约 3-5 分钟部署完成,然后点击 CloudFormation 堆栈并转到 **输出** 选项卡,您可以找到 **API URL**
130-
类似`https://xxx.xxx.awsapprunner.com``https://xxx.lambda-url.xxx.on.aws`
131-
132-
### 第 3 步: 下载应用并设置 API URL 和 API Key
133-
134-
1. 下载应用
140+
等待约 3-5 分钟部署完成,然后点击 CloudFormation 堆栈并转到 **输出** 选项卡,您可以找到 **API URL** 类似`https://xxx.xxx.awsapprunner.com``https://xxx.lambda-url.xxx.on.aws`
135141

136-
- Android 应用点击 [下载](https://github.com/aws-samples/swift-chat/releases/download/1.10.0/SwiftChat.apk)
137-
- macOS 应用点击 [下载](https://github.com/aws-samples/swift-chat/releases/download/1.10.0/SwiftChat.dmg)
138-
- iOS (目前不提供 iOS 版本,您可以使用 Xcode 在本地构建)
142+
### 第 3 步: 启动应用并设置 API URL 和 API Key
139143

140-
2. 启动应用,点击左侧菜单按钮,并点击底部的 **Settings**
141-
3. 粘贴`API URL``API Key`然后选择 Region。
142-
4. 点击右上角 ✓ 图标保存配置并开始聊天。
144+
1. 启动应用,点击左侧菜单按钮,并点击底部的 **Settings**
145+
2. 粘贴`API URL``API Key` (Parameter Store 中您填写的****) 然后选择 Region。
146+
3. 点击右上角 ✓ 图标保存配置并开始聊天。
143147

144148
恭喜 🎉 您的 SwiftChat 应用已准备就绪!
149+
</details>
145150

146151
### 支持的区域
147152

@@ -159,7 +164,8 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
159164

160165
## 入门指南 - 使用其他模型提供商
161166

162-
### 配置 Ollama
167+
<details>
168+
<summary><b>🔧 配置 Ollama(点击展开)</b></summary>
163169

164170
1. 进入 **设置页面**,选择 **Ollama** 标签。
165171
2. 输入您的 Ollama 服务器 URL。例如:
@@ -168,15 +174,21 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
168174
```
169175
3. 输入正确的服务器 URL 后,您可以从 **文本模型** 下拉列表中选择所需的 Ollama 模型。
170176

171-
### 配置 DeepSeek
177+
</details>
178+
179+
<details>
180+
<summary><b>🔧 配置 DeepSeek(点击展开)</b></summary>
172181

173182
1. 进入 **设置页面**,选择 **DeepSeek** 标签。
174183
2. 输入您的 DeepSeek API 密钥。
175184
3. 从 **文本模型** 下拉列表中选择 DeepSeek 模型。目前支持以下 DeepSeek 模型:
176185
- `DeepSeek-V3`
177186
- `DeepSeek-R1`
178187

179-
### 配置 OpenAI
188+
</details>
189+
190+
<details>
191+
<summary><b>🔧 配置 OpenAI(点击展开)</b></summary>
180192

181193
1. 进入 **设置页面**,选择 **OpenAI** 标签。
182194
2. 输入您的 OpenAI API 密钥。
@@ -186,6 +198,8 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
186198

187199
此外,如果您已部署 [ClickStream Server](#第-2-步-部署堆栈并获取-api-url),可以启用 **Use Proxy** 选项以转发您的请求。
188200

201+
</details>
202+
189203
## 详细功能
190204

191205
**快捷工具**:代码复制、选择模式、页面滚动和 Token 使用统计
@@ -252,7 +266,6 @@ SwiftChat 是一款快速响应的 AI 聊天应用,采用 [React Native](https
252266

253267
- 通过**图像压缩**加速端到端 API 请求
254268
- 在与 Bedrock **相同区域**部署 API 以提供更低延迟
255-
- 最小响应有效负载,**零解析**直接显示
256269

257270
📱 **快速渲染速度**
258271

react-native/android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ android {
7979
applicationId "com.aws.swiftchat"
8080
minSdkVersion rootProject.ext.minSdkVersion
8181
targetSdkVersion rootProject.ext.targetSdkVersion
82-
versionCode 26
83-
versionName "1.10.0"
82+
versionCode 39
83+
versionName "2.0.1"
8484
ndk {
8585
//noinspection ChromeOsAbiSupport
8686
abiFilters 'arm64-v8a'

react-native/ios/SwiftChat.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@
491491
CODE_SIGN_ENTITLEMENTS = SwiftChat/SwiftChat.entitlements;
492492
CODE_SIGN_IDENTITY = "Apple Development";
493493
CODE_SIGN_STYLE = Automatic;
494-
CURRENT_PROJECT_VERSION = 26;
494+
CURRENT_PROJECT_VERSION = 39;
495495
DEVELOPMENT_TEAM = BUA6W9H7T3;
496496
ENABLE_BITCODE = NO;
497497
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
@@ -503,7 +503,7 @@
503503
"$(inherited)",
504504
"@executable_path/Frameworks",
505505
);
506-
MARKETING_VERSION = 1.10.0;
506+
MARKETING_VERSION = 2.0.1;
507507
OTHER_LDFLAGS = (
508508
"$(inherited)",
509509
"-ObjC",
@@ -532,7 +532,7 @@
532532
CODE_SIGN_ENTITLEMENTS = SwiftChat/SwiftChat.entitlements;
533533
CODE_SIGN_IDENTITY = "Apple Development";
534534
CODE_SIGN_STYLE = Automatic;
535-
CURRENT_PROJECT_VERSION = 26;
535+
CURRENT_PROJECT_VERSION = 39;
536536
DEVELOPMENT_TEAM = BUA6W9H7T3;
537537
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
538538
INFOPLIST_FILE = SwiftChat/Info.plist;
@@ -543,7 +543,7 @@
543543
"$(inherited)",
544544
"@executable_path/Frameworks",
545545
);
546-
MARKETING_VERSION = 1.10.0;
546+
MARKETING_VERSION = 2.0.1;
547547
OTHER_LDFLAGS = (
548548
"$(inherited)",
549549
"-ObjC",

0 commit comments

Comments
 (0)