Skip to content

Commit 973b2b9

Browse files
authored
feat: support multiple llm providers (#14)
1 parent 54f2093 commit 973b2b9

38 files changed

+1276
-147
lines changed

README.md

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# SwiftChat - A Cross-platform AI Chat App
44

55
SwiftChat is a fast and responsive AI chat application developed with [React Native](https://reactnative.dev/) and
6-
powered by [Amazon Bedrock](https://aws.amazon.com/bedrock/). With its minimalist design philosophy and robust privacy
7-
protection, it delivers real-time streaming conversations and AI image generation capabilities across Android, iOS, and
8-
macOS platforms.
6+
powered by [Amazon Bedrock](https://aws.amazon.com/bedrock/), with compatibility extending to other model providers such
7+
as Ollama, DeepSeek, and OpenAI. With its minimalist design philosophy and robust privacy protection, it delivers
8+
real-time streaming conversations and AI image generation capabilities across Android, iOS, and macOS platforms.
99

1010
![](assets/promo.png)
1111

@@ -19,7 +19,9 @@ macOS platforms.
1919
- Cross-platform support (Android, iOS, macOS)
2020
- Tablet-optimized for iPad and Android tablets
2121
- Fast launch and responsive performance
22-
- Multiple AI model support and switching
22+
- Multiple AI model
23+
supported ([Amazon Bedrock](https://aws.amazon.com/bedrock/), [Ollama](https://github.com/ollama/ollama), [DeepSeek](https://www.deepseek.com/)
24+
and [OpenAI](https://openai.com/), From v1.10.0 🎉)
2325
- Fully Customizable System Prompt Assistant (New feature from v1.9.0 🎉)
2426

2527
**Supported Features For Amazon Nova**
@@ -32,7 +34,6 @@ macOS platforms.
3234
create images in similar styles.
3335
- Support LaTeX formula rendering (inline and display modes) for Amazon Nova.
3436

35-
3637
### Feature Showcase
3738

3839
**Comprehensive Multimodal Analysis**: Text, Image, Document and Video
@@ -69,7 +70,7 @@ macOS platforms.
6970
We redesigned the UI with optimized font sizes and line spacing for a more elegant and clean presentation.
7071
All of these features are also seamlessly displayed on Android and macOS with native UI
7172

72-
> Note: Some animated images have been sped up for demonstration. If you experience lag, please view on Chrome, Firefox,
73+
> Note: Some animated images have been sped up for demonstration. If you experience lag, please view on Chrome, Firefox,
7374
> or Edge browser on your computer.
7475
7576
## Architecture
@@ -84,7 +85,7 @@ cost-effective
8485
solution, as shown in
8586
this [example](https://github.com/awslabs/aws-lambda-web-adapter/tree/main/examples/fastapi-response-streaming).
8687

87-
## Getting Started
88+
## Getting Started with Amazon Bedrock
8889

8990
### Prerequisites
9091

@@ -95,7 +96,8 @@ Ensure you have access to Amazon Bedrock foundation models. SwiftChat default se
9596
- Image Model: `Stable Diffusion 3.5 Large`
9697

9798
If you are using the image generation feature, please make sure you have enabled access to the `Amazon Nova Lite` model.
98-
Please follow the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) to
99+
Please follow
100+
the [Amazon Bedrock User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) to
99101
enable your models.
100102

101103
### Step 1: Set up your API Key
@@ -105,11 +107,11 @@ enable your models.
105107
2. Check whether you are in the [supported region](#supported-region), then click on the **Create parameter** button.
106108
3. Fill in the parameters below, leaving other options as default:
107109

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

110-
- **Type**: Select `SecureString`
112+
- **Type**: Select `SecureString`
111113

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

114116
4. Click **Create parameter**.
115117

@@ -118,17 +120,17 @@ enable your models.
118120
1. Click one of the following buttons to launch the CloudFormation Stack in the same region where your API Key was
119121
created.
120122

121-
- **App Runner**
123+
- **App Runner**
122124

123-
[![Launch Stack](assets/launch-stack.png)](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatAPI&templateURL=https://aws-gcr-solutions.s3.amazonaws.com/swift-chat/latest/SwiftChatAppRunner.template)
125+
[![Launch Stack](assets/launch-stack.png)](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatAPI&templateURL=https://aws-gcr-solutions.s3.amazonaws.com/swift-chat/latest/SwiftChatAppRunner.template)
124126

125-
- **Lambda** (Note: For AWS customer use only)
127+
- **Lambda** (Note: For AWS customer use only)
126128

127-
[![Launch Stack](assets/launch-stack.png)](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatLambda&templateURL=https://aws-gcr-solutions.s3.amazonaws.com/swift-chat/latest/SwiftChatLambda.template)
129+
[![Launch Stack](assets/launch-stack.png)](https://console.aws.amazon.com/cloudformation/home#/stacks/create/template?stackName=SwiftChatLambda&templateURL=https://aws-gcr-solutions.s3.amazonaws.com/swift-chat/latest/SwiftChatLambda.template)
128130

129131
2. Click **Next**, On the "Specify stack details" page, provide the following information:
130-
- Fill the `ApiKeyParam` with the parameter name you used for storing the API key (e.g., "SwiftChatAPIKey").
131-
- For App Runner, choose an `InstanceTypeParam` based on your needs.
132+
- Fill the `ApiKeyParam` with the parameter name you used for storing the API key (e.g., "SwiftChatAPIKey").
133+
- For App Runner, choose an `InstanceTypeParam` based on your needs.
132134
3. Click **Next**, Keep the "Configure stack options" page as default, Read the Capabilities and Check the "I
133135
acknowledge that AWS CloudFormation might create IAM resources" checkbox at the bottom.
134136
4. Click **Next**, In the "Review and create" Review your configuration and click **Submit**.
@@ -140,9 +142,9 @@ can find the **API URL** which looks like: `https://xxx.xxx.awsapprunner.com` or
140142

141143
1. Download the App
142144

143-
- Android App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.9.0/SwiftChat.apk)
144-
- macOS App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.9.0/SwiftChat.dmg)
145-
- iOS (Currently we do not provide the iOS version, you can build it locally with Xcode)
145+
- Android App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.9.0/SwiftChat.apk)
146+
- macOS App click to [Download](https://github.com/aws-samples/swift-chat/releases/download/1.9.0/SwiftChat.dmg)
147+
- iOS (Currently we do not provide the iOS version, you can build it locally with Xcode)
146148

147149
2. Launch the App, open the drawer menu, and tap **Settings**.
148150
3. Paste the `API URL` and `API Key` then select the Region.
@@ -164,6 +166,37 @@ Congratulations 🎉 Your SwiftChat App is ready to use!
164166
- Europe (Paris): eu-west-3
165167
- South America (São Paulo): sa-east-1
166168

169+
## Getting Started with Other Model Providers
170+
171+
### Configure Ollama
172+
173+
1. Navigate to the **Settings Page** and select the **Ollama** tab.
174+
2. Enter your Ollama Server URL. For example:
175+
```bash
176+
http://localhost:11434
177+
```
178+
3. Once the correct Server URL is entered, you can select your desired Ollama models from the **Text Model** dropdown
179+
list.
180+
181+
### Configure DeepSeek
182+
183+
1. Go to the **Settings Page** and select the **DeepSeek** tab.
184+
2. Input your DeepSeek API Key.
185+
3. Choose DeepSeek models from the **Text Model** dropdown list. Currently, the following DeepSeek models are supported:
186+
- `DeepSeek-V3`
187+
- `DeepSeek-R1`
188+
189+
### Configure OpenAI
190+
191+
1. Navigate to the **Settings Page** and select the **OpenAI** tab.
192+
2. Enter your OpenAI API Key.
193+
3. Select OpenAI models from the **Text Model** dropdown list. The following OpenAI models are currently supported:
194+
- `GPT-4o`
195+
- `GPT-4o mini`
196+
197+
Additionally, if you have deployed the [ClickStream Server](#step-2-deploy-stack-and-get-your-api-url), you can enable
198+
the **Use Proxy** option to forward your requests.
199+
167200
## Detailed Features
168201

169202
**Quick Access Tools**: Code Copy, Selection Mode, Scroll Controls and Token Counter
@@ -178,18 +211,18 @@ We feature streamlined chat History, Settings pages, and intuitive Usage statist
178211

179212
![](assets/history_settings.png)
180213

181-
Similarly, for the Mac version, we not only support the display of history, but also added a permanent sidebar
182-
display mode after v1.9.0.
214+
Similarly, for the Mac version, we not only support the display of history, but also added a permanent sidebar
215+
display mode after v1.9.0, Below is a demo animation for how to add custom system prompt.
183216

184-
![](assets/mac_ui.png)
217+
![](assets/avif/english_teacher.avif)
185218

186219
### Message Handling
187220

188221
- [x] Text copy support:
189-
- Copy button in message header
190-
- Copy button in code blocks
191-
- Direct Select and copy code on macOS (double click or long click on iOS)
192-
- Long press text to copy entire sentence (Right-click on macOS)
222+
- Copy button in message header
223+
- Copy button in code blocks
224+
- Direct Select and copy code on macOS (double click or long click on iOS)
225+
- Long press text to copy entire sentence (Right-click on macOS)
193226
- [x] Text selection mode by tapping message title or double-clicking text
194227
- [x] Message timeline view in history
195228
- [x] Delete messages through long press in history
@@ -214,13 +247,10 @@ display mode after v1.9.0.
214247
- [x] Check detailed token usage and image generation count in Settings
215248
- [x] In-app upgrade notifications (Android & macOS)
216249

217-
We have optimized the layout for landscape mode. As shown below, you can comfortably view table contents in landscape
250+
We have optimized the layout for landscape mode. As shown below, you can comfortably view table/code contents in
251+
landscape
218252
orientation.
219253

220-
![](assets/landscape.png)
221-
222-
Similarly, for code that requires horizontal scrolling, rotate to landscape mode for better viewing.
223-
224254
![](assets/avif/landscape.avif)
225255

226256
## What Makes SwiftChat Really "Swift"?
@@ -276,16 +306,16 @@ npm run android
276306

277307
### Build for iOS
278308

279-
also open a new terminal, for the first time you need to install the native dependencies
280-
by execute `cd ios && pod install && cd ..`, then execute the follow command:
309+
also open a new terminal, for the first time you need to install the native dependencies
310+
by execute `cd ios && pod install && cd ..`, then execute the follow command:
281311

282312
```bash
283313
npm run ios
284314
```
285315

286316
### Build for macOS
287317

288-
1. Modify as `isMac = true` in `/src/App.tsx` and execute `npm start`.
318+
1. Execute `npm start`.
289319
2. Double click `ios/SwiftChat.xcworkspace` to open the project in your Xcode.
290320
3. Change the build destination to `My Mac (Mac Catalyst)` then click the ▶ Run button.
291321

0 commit comments

Comments
 (0)