@lobehub/chat 0.89.3 → 0.89.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +48 -29
- package/README.zh-CN.md +46 -27
- package/docs/Development-Guide/Folder-Structure.zh-CN.md +4 -2
- package/docs/Development-Guide/Steup-Development.zh-CN.md +62 -0
- package/docs/Docker-Deployment.md +60 -16
- package/docs/Docker-Deployment.zh-CN.md +54 -14
- package/docs/Home.md +1 -0
- package/docs/_Sidebar.md +1 -0
- package/package.json +2 -2
- package/src/app/api/openai/createChatCompletion.ts +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.89.4](https://github.com/lobehub/lobe-chat/compare/v0.89.3...v0.89.4)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-15**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix qwen, chatglm request failed.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix qwen, chatglm request failed, closes [#318](https://github.com/lobehub/lobe-chat/issues/318) ([a5699e2](https://github.com/lobehub/lobe-chat/commit/a5699e2))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
5
30
|
### [Version 0.89.3](https://github.com/lobehub/lobe-chat/compare/v0.89.2...v0.89.3)
|
|
6
31
|
|
|
7
32
|
<sup>Released on **2023-10-12**</sup>
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<h1>Lobe Chat</h1>
|
|
10
10
|
|
|
11
|
-
LobeChat is
|
|
11
|
+
LobeChat is an open-source, extensible ([Function Calling][fc-link]), high-performance chatbot framework. <br/> It supports one-click free deployment of your private ChatGPT/LLM web application.
|
|
12
12
|
|
|
13
13
|
**English** · [简体中文](./README.zh-CN.md) · [Changelog](./CHANGELOG.md) · [Wiki][github-wiki-link] · [Report Bug][github-issues-link] · [Request Feature][github-issues-link]
|
|
14
14
|
|
|
@@ -49,8 +49,9 @@ LobeChat is a open-source, extensible ([Function Calling][fc-link]), high-perfor
|
|
|
49
49
|
- [📸 Snapshot](#-snapshot)
|
|
50
50
|
- [⚡️ Performance](#️-performance)
|
|
51
51
|
- [🛳 Self Hosting](#-self-hosting)
|
|
52
|
-
- [Deploying with Vercel](#deploying-with-vercel)
|
|
53
|
-
- [Deploying with Docker](#deploying-with-docker)
|
|
52
|
+
- [`A` Deploying with Vercel](#a-deploying-with-vercel)
|
|
53
|
+
- [`B` Deploying with Docker](#b-deploying-with-docker)
|
|
54
|
+
- [Environment Variable](#environment-variable)
|
|
54
55
|
- [📦 Ecosystem](#-ecosystem)
|
|
55
56
|
- [🧩 Plugins](#-plugins)
|
|
56
57
|
- [⌨️ Local Development](#️-local-development)
|
|
@@ -175,56 +176,71 @@ We have carried out a series of optimization designs for mobile devices to enhan
|
|
|
175
176
|
|
|
176
177
|
## 🛳 Self Hosting
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
LobeChat provides [Self-Hosted Version][deploy-link] with Vercel and [Docker Image][docker-release-link]. This allows you to deploy your own chatbot within a few minutes, without any prior knowledge.
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
<br/>
|
|
182
|
+
|
|
183
|
+
### `A` Deploying with Vercel
|
|
184
|
+
|
|
185
|
+
If you want to deploy this service yourself on Vercel, you can follow these steps:
|
|
181
186
|
|
|
182
187
|
- Prepare your [OpenAI API Key](https://platform.openai.com/account/api-keys).
|
|
183
188
|
- Click the button below to start deployment: Deploy with Vercel. Log in directly with your GitHub account and remember to fill in the API Key and access code CODE on the environment variable page;
|
|
184
189
|
- After deployment, you can start using it;
|
|
185
190
|
- Bind a custom domain (optional): The DNS of the domain assigned by Vercel is polluted in some areas, binding a custom domain can connect directly.
|
|
186
191
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
[![][deploy-button-image]][deploy-link]
|
|
190
|
-
|
|
191
|
-
</div>
|
|
192
|
+
#### Keep Updated
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
> This project provides some additional configuration items, set with environment variables, The complete list of environment variables can be found in the [📘 Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) :
|
|
194
|
+
If you have deployed your own project following the one-click deployment steps in the README, you might encounter constant prompts indicating "updates available". This is because Vercel defaults to creating a new project instead of forking this one, resulting in an inability to accurately detect updates.
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
| `OPENAI_API_KEY` | Yes | This is the API key you apply on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
|
|
199
|
-
| `OPENAI_PROXY_URL` | No | If you manually configure the OpenAI interface proxy, you can use this configuration item to override the default OpenAI API request base URL | `https://api.chatanywhere.cn/v1`<br/>The default value is<br/>`https://api.openai.com/v1` |
|
|
200
|
-
| `ACCESS_CODE` | No | Add a password to access this service, the password should be a 6-digit number or letter | `awCT74` or `e3@09!` |
|
|
196
|
+
> **Important**\
|
|
197
|
+
> We suggest you redeploy using the following steps, [📘 Maintaining Updates with LobeChat Self-Deployment](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync).
|
|
201
198
|
|
|
202
|
-
|
|
199
|
+
<br/>
|
|
203
200
|
|
|
204
|
-
|
|
201
|
+
### `B` Deploying with Docker
|
|
205
202
|
|
|
206
|
-
|
|
203
|
+
[![][docker-release-shield]][docker-release-link]
|
|
204
|
+
[![][docker-size-shield]][docker-size-link]
|
|
205
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
207
206
|
|
|
208
|
-
We provide a Docker image for deploying the LobeChat service on your own private device. Use the following command to start the LobeChat service
|
|
207
|
+
We provide a Docker image for deploying the LobeChat service on your own private device. Use the following command to start the LobeChat service:
|
|
209
208
|
|
|
210
|
-
```
|
|
211
|
-
docker run -d -p 3210:3210 \
|
|
209
|
+
```fish
|
|
210
|
+
$ docker run -d -p 3210:3210 \
|
|
212
211
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
213
212
|
-e ACCESS_CODE=lobe66 \
|
|
214
213
|
lobehub/lobe-chat
|
|
215
214
|
```
|
|
216
215
|
|
|
217
|
-
|
|
216
|
+
> **Note**\
|
|
217
|
+
> If you need to use the OpenAI service through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
|
|
218
218
|
|
|
219
|
-
```
|
|
220
|
-
docker run -d -p 3210:3210 \
|
|
219
|
+
```fish
|
|
220
|
+
$ docker run -d -p 3210:3210 \
|
|
221
221
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
222
222
|
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
223
223
|
-e ACCESS_CODE=lobe66 \
|
|
224
224
|
lobehub/lobe-chat
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
> **Note**\
|
|
228
|
+
> For detailed instructions on deploying with Docker, please refer to the [📘 Docker Deployment Guide](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment)
|
|
229
|
+
|
|
230
|
+
<br/>
|
|
231
|
+
|
|
232
|
+
### Environment Variable
|
|
233
|
+
|
|
234
|
+
This project provides some additional configuration items, set with environment variables:
|
|
235
|
+
|
|
236
|
+
| Environment Variable | Required | Description | Example |
|
|
237
|
+
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
238
|
+
| `OPENAI_API_KEY` | Yes | This is the API key you apply on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
|
|
239
|
+
| `OPENAI_PROXY_URL` | No | If you manually configure the OpenAI interface proxy, you can use this configuration item to override the default OpenAI API request base URL | `https://api.chatanywhere.cn/v1`<br/>The default value is<br/>`https://api.openai.com/v1` |
|
|
240
|
+
| `ACCESS_CODE` | No | Add a password to access this service, the password should be a 6-digit number or letter | `awCT74` or `e3@09!` |
|
|
241
|
+
|
|
242
|
+
> **Note**\
|
|
243
|
+
> The complete list of environment variables can be found in the [📘 Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable)
|
|
228
244
|
|
|
229
245
|
<div align="right">
|
|
230
246
|
|
|
@@ -284,7 +300,7 @@ Or clone it for local development:
|
|
|
284
300
|
|
|
285
301
|
[![][bun-shield]][bun-link]
|
|
286
302
|
|
|
287
|
-
```
|
|
303
|
+
```fish
|
|
288
304
|
$ git clone https://github.com/lobehub/lobe-chat.git
|
|
289
305
|
$ cd lobe-chat
|
|
290
306
|
$ bun install
|
|
@@ -355,13 +371,16 @@ This project is [MIT](./LICENSE) licensed.
|
|
|
355
371
|
[codespaces-shield]: https://github.com/codespaces/badge.svg
|
|
356
372
|
[contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-chat
|
|
357
373
|
[contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
|
|
358
|
-
[deploy-button-image]: https://vercel.com/button
|
|
359
374
|
[deploy-link]: https://vercel.com/new/clone?repository-link=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.%20%20&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
|
|
360
375
|
[discord-link]: https://discord.gg/AYFPHvv2jT
|
|
361
376
|
[discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
|
|
362
377
|
[discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
|
|
378
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
379
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
363
380
|
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
364
381
|
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
382
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
383
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
365
384
|
[fc-link]: https://sspai.com/post/81986
|
|
366
385
|
[fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
|
|
367
386
|
[fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
|
package/README.zh-CN.md
CHANGED
|
@@ -49,8 +49,9 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
|
|
|
49
49
|
- [📸 快照预览](#-快照预览)
|
|
50
50
|
- [⚡️ 性能测试](#️-性能测试)
|
|
51
51
|
- [🛳 开箱即用](#-开箱即用)
|
|
52
|
-
- [
|
|
53
|
-
- [使用 Docker 部署](
|
|
52
|
+
- [`A` 使用 Vercel 部署](#a-使用-vercel-部署)
|
|
53
|
+
- [`B` 使用 Docker 部署](#b-使用-docker-部署)
|
|
54
|
+
- [环境变量](#环境变量)
|
|
54
55
|
- [📦 生态系统](#-生态系统)
|
|
55
56
|
- [🧩 插件体系](#-插件体系)
|
|
56
57
|
- [⌨️ 本地开发](#️-本地开发)
|
|
@@ -177,56 +178,71 @@ LobeChat 提供了两种独特的主题模式 - 明亮模式和暗黑模式,
|
|
|
177
178
|
|
|
178
179
|
## 🛳 开箱即用
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
LobeChat 提供了 Vercel 的 [自托管版本][deploy-link] 和 [Docker 镜像][docker-release-link],这使你可以在几分钟内构建自己的聊天机器人,无需任何基础知识。
|
|
181
182
|
|
|
182
|
-
|
|
183
|
+
<br/>
|
|
184
|
+
|
|
185
|
+
### `A` 使用 Vercel 部署
|
|
186
|
+
|
|
187
|
+
如果想在 Vercel 上部署该服务,可以按照以下步骤进行操作:
|
|
183
188
|
|
|
184
189
|
- 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys) 。
|
|
185
190
|
- 点击下方按钮开始部署: Deploy with Vercel,直接使用 GitHub 账号登录即可,记得在环境变量页填入 API Key 和页面访问密码 CODE;
|
|
186
191
|
- 部署完毕后,即可开始使用;
|
|
187
192
|
- 绑定自定义域名(可选):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
|
|
188
193
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
[![][deploy-button-image]][deploy-link]
|
|
192
|
-
|
|
193
|
-
</div>
|
|
194
|
+
#### 保持更新
|
|
194
195
|
|
|
195
|
-
|
|
196
|
-
> 本项目提供了一些额外的配置项,使用环境变量进行设置,完整环境变量可见 [📘环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN):
|
|
196
|
+
如果你根据 README 中的一键部署步骤部署了自己的项目,你可能会发现总是被提示 “有可用更新”。这是因为 Vercel 默认为你创建新项目而非 fork 本项目,这将导致无法准确检测更新。
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
| `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
|
|
201
|
-
| `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
|
|
202
|
-
| `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
|
|
198
|
+
> **Important**\
|
|
199
|
+
> 我们建议按照 [📘 LobeChat 自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN) 步骤重新部署。
|
|
203
200
|
|
|
204
|
-
|
|
201
|
+
<br/>
|
|
205
202
|
|
|
206
|
-
|
|
203
|
+
### `B` 使用 Docker 部署
|
|
207
204
|
|
|
208
|
-
|
|
205
|
+
[![][docker-release-shield]][docker-release-link]
|
|
206
|
+
[![][docker-size-shield]][docker-size-link]
|
|
207
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
209
208
|
|
|
210
209
|
我们提供了 Docker 镜像,供你在自己的私有设备上部署 LobeChat 服务。使用以下命令即可使用一键启动 LobeChat 服务:
|
|
211
210
|
|
|
212
|
-
```
|
|
213
|
-
docker run -d -p 3210:3210 \
|
|
211
|
+
```fish
|
|
212
|
+
$ docker run -d -p 3210:3210 \
|
|
214
213
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
215
214
|
-e ACCESS_CODE=lobe66 \
|
|
216
215
|
lobehub/lobe-chat
|
|
217
216
|
```
|
|
218
217
|
|
|
219
|
-
|
|
218
|
+
> **Note**\
|
|
219
|
+
> 如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
220
220
|
|
|
221
|
-
```
|
|
222
|
-
docker run -d -p 3210:3210 \
|
|
221
|
+
```fish
|
|
222
|
+
$ docker run -d -p 3210:3210 \
|
|
223
223
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
224
224
|
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
225
225
|
-e ACCESS_CODE=lobe66 \
|
|
226
226
|
lobehub/lobe-chat
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
> **Note**\
|
|
230
|
+
> 有关 Docker 部署的详细说明,详见 [📘 使用 Docker 部署](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment.zh-CN)
|
|
231
|
+
|
|
232
|
+
<br/>
|
|
233
|
+
|
|
234
|
+
### 环境变量
|
|
235
|
+
|
|
236
|
+
本项目提供了一些额外的配置项,使用环境变量进行设置:
|
|
237
|
+
|
|
238
|
+
| 环境变量 | 类型 | 描述 | 示例 |
|
|
239
|
+
| ------------------ | ---- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
240
|
+
| `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
|
|
241
|
+
| `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
|
|
242
|
+
| `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
|
|
243
|
+
|
|
244
|
+
> **Note**\
|
|
245
|
+
> 完整环境变量可见 [📘环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
|
|
230
246
|
|
|
231
247
|
<div align="right">
|
|
232
248
|
|
|
@@ -286,7 +302,7 @@ docker run -d -p 3210:3210 \
|
|
|
286
302
|
|
|
287
303
|
[![][bun-shield]][bun-link]
|
|
288
304
|
|
|
289
|
-
```
|
|
305
|
+
```fish
|
|
290
306
|
$ git clone https://github.com/lobehub/lobe-chat.git
|
|
291
307
|
$ cd lobe-chat
|
|
292
308
|
$ bun install
|
|
@@ -357,13 +373,16 @@ This project is [MIT](./LICENSE) licensed.
|
|
|
357
373
|
[codespaces-shield]: https://github.com/codespaces/badge.svg
|
|
358
374
|
[contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-chat
|
|
359
375
|
[contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
|
|
360
|
-
[deploy-button-image]: https://vercel.com/button
|
|
361
376
|
[deploy-link]: https://vercel.com/new/clone?repository-link=https%3A%2F%2Fgithub.com%2Flobehub%2Flobe-chat&env=OPENAI_API_KEY&envDescription=Find%20your%20OpenAI%20API%20Key%20by%20click%20the%20right%20Learn%20More%20button.%20%20&envLink=https%3A%2F%2Fplatform.openai.com%2Faccount%2Fapi-keys&project-name=lobe-chat&repository-name=lobe-chat
|
|
362
377
|
[discord-link]: https://discord.gg/AYFPHvv2jT
|
|
363
378
|
[discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
|
|
364
379
|
[discord-shield-badge]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=for-the-badge
|
|
380
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
381
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
365
382
|
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
366
383
|
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
384
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
385
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
367
386
|
[fc-link]: https://sspai.com/post/81986
|
|
368
387
|
[fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
|
|
369
388
|
[fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# 目录架构
|
|
2
|
+
|
|
1
3
|
LobeChat 的文件夹目录架构如下:
|
|
2
4
|
|
|
3
5
|
```bash
|
|
@@ -18,10 +20,10 @@ src
|
|
|
18
20
|
|
|
19
21
|
## app
|
|
20
22
|
|
|
21
|
-
在 `app` 文件夹中,我们将每个路由页面按照 app router 的 [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups)
|
|
23
|
+
在 `app` 文件夹中,我们将每个路由页面按照 app router 的 [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups) 进行组织,以此来分别处理桌面端和移动端的代码实现。以 `welcome` 页面的文件结构为例:
|
|
22
24
|
|
|
23
25
|
```bash
|
|
24
|
-
|
|
26
|
+
welcome
|
|
25
27
|
├── (desktop) # 桌面端实现
|
|
26
28
|
│ ├── features # 桌面端特有的功能
|
|
27
29
|
│ ├── index.tsx # 桌面端的主入口文件
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# LobeChat 环境设置指南
|
|
2
|
+
|
|
3
|
+
欢迎阅读 LobeChat 的开发环境设置指南。
|
|
4
|
+
|
|
5
|
+
## 在线开发
|
|
6
|
+
|
|
7
|
+
如果你有 GitHub Codespaces 的使用权限,可以点击下方按钮一键进入在线开发环境:
|
|
8
|
+
|
|
9
|
+
[![][codespaces-shield]][codespaces-link]
|
|
10
|
+
|
|
11
|
+
## 本地开发
|
|
12
|
+
|
|
13
|
+
在开始开发 LobeChat 之前,你需要在本地环境中安装和配置一些必要的软件和工具。本文档将指导你完成这些步骤。
|
|
14
|
+
|
|
15
|
+
### 开发环境需求
|
|
16
|
+
|
|
17
|
+
首先,你需要安装以下软件:
|
|
18
|
+
|
|
19
|
+
- Node.js:LobeChat 是基于 Node.js 构建的,因此你需要安装 Node.js。我们建议安装最新的稳定版。
|
|
20
|
+
- Bun:我们使用 Bun 作为首选包管理器。你可以从 Bun 的官方网站上下载并安装。
|
|
21
|
+
- PNPM:我们使用 PNPM 作为辅助包管理器。你可以从 pnpm 的官方网站上下载并安装。
|
|
22
|
+
- Git:我们使用 Git 进行版本控制。你可以从 Git 的官方网站上下载并安装。
|
|
23
|
+
- IDE:你可以选择你喜欢的集成开发环境(IDE)。我们推荐使用 WebStorm,它是一款功能强大的 IDE,特别适合 TypeScript 开发。
|
|
24
|
+
|
|
25
|
+
### 项目设置
|
|
26
|
+
|
|
27
|
+
完成上述软件的安装后,你可以开始设置 LobeChat 项目了。
|
|
28
|
+
|
|
29
|
+
1. **获取代码**:首先,你需要从 GitHub 上克隆 LobeChat 的代码库。在终端中运行以下命令:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/lobehub/lobe-chat.git
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **安装依赖**:然后,进入项目目录,并使用 bun 安装项目的依赖包:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd lobe-chat
|
|
39
|
+
bun i
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
如果你使用 pnpm ,可以执行:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
cd lobe-chat
|
|
46
|
+
pnpm i
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. **启动开发服务器**:安装完依赖后,你可以启动开发服务器:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bun run dev
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
现在,你可以在浏览器中打开 `http://localhost:3010`,你应该能看到 LobeChat 的欢迎页面。这表明你已经成功地设置了开发环境。
|
|
56
|
+
|
|
57
|
+

|
|
58
|
+
|
|
59
|
+
在开发过程中,如果你在环境设置上遇到任何问题,或者有任何关于 LobeChat 开发的问题,欢迎随时向我们提问。我们期待看到你的贡献!
|
|
60
|
+
|
|
61
|
+
[codespaces-link]: https://codespaces.new/lobehub/lobe-chat
|
|
62
|
+
[codespaces-shield]: https://github.com/codespaces/badge.svg
|
|
@@ -1,42 +1,86 @@
|
|
|
1
|
-
# Deployment
|
|
1
|
+
# Docker Deployment Guide
|
|
2
2
|
|
|
3
3
|
[![][docker-release-shield]][docker-release-link]
|
|
4
|
+
[![][docker-size-shield]][docker-size-link]
|
|
5
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
4
6
|
|
|
5
|
-
We provide Docker
|
|
7
|
+
We provide [Docker Images][docker-release-link] for you to deploy LobeChat service on your private device.
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## Install Docker container environment
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
If already installed, skip this step.
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
**Ubuntu:**
|
|
12
14
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
+
```fish
|
|
16
|
+
$ apt install docker.io
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**CentOS:**
|
|
20
|
+
|
|
21
|
+
```fish
|
|
22
|
+
$ yum install docker
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Deploy container image
|
|
26
|
+
|
|
27
|
+
### `A` Command deployment (recommended)
|
|
28
|
+
|
|
29
|
+
Use the following command to start LobeChat service with one click:
|
|
30
|
+
|
|
31
|
+
```fish
|
|
32
|
+
$ docker run -d -p 3210:3210 \
|
|
15
33
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
16
34
|
-e ACCESS_CODE=lobe66 \
|
|
17
35
|
lobehub/lobe-chat
|
|
18
36
|
```
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
> **Note**
|
|
39
|
+
>
|
|
40
|
+
> - The default mapped port is `3210`. Make sure it is not occupied or manually change the port mapping.
|
|
41
|
+
> - Replace `sk-xxxx` in the above command with your own OpenAI API Key.
|
|
42
|
+
> - The password set in the official Docker image is `lobe66` by default. Replace it with your own password to improve security.
|
|
43
|
+
> - For a complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN) section.
|
|
44
|
+
|
|
45
|
+
#### Use a proxy address
|
|
21
46
|
|
|
22
|
-
If you need to use OpenAI
|
|
47
|
+
If you need to use OpenAI service through a proxy, you can use the `OPENAI_PROXY_URL` environment variable to configure the proxy address:
|
|
23
48
|
|
|
24
|
-
```
|
|
25
|
-
docker run -d -p 3210:3210 \
|
|
49
|
+
```fish
|
|
50
|
+
$ docker run -d -p 3210:3210 \
|
|
26
51
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
27
52
|
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
28
53
|
-e ACCESS_CODE=lobe66 \
|
|
29
54
|
lobehub/lobe-chat
|
|
30
55
|
```
|
|
31
56
|
|
|
32
|
-
For a complete list of environment variables for LobeChat, please refer to the [Environment Variables](./Environment-Variable.md) section.
|
|
33
|
-
|
|
34
57
|
> **Note**\
|
|
35
|
-
>
|
|
58
|
+
> As the official Docker image build takes about half an hour, if there is a "update available" prompt after updating deployment, wait for the image to finish building before deploying again.
|
|
59
|
+
|
|
60
|
+
### `B` Docker Compose
|
|
36
61
|
|
|
37
|
-
|
|
62
|
+
The configuration file for using `docker-compose` is as follows:
|
|
63
|
+
|
|
64
|
+
```yml
|
|
65
|
+
version: '3.8'
|
|
66
|
+
|
|
67
|
+
services:
|
|
68
|
+
lobe-chat:
|
|
69
|
+
image: lobehub/lobe-chat
|
|
70
|
+
container_name: lobe-chat
|
|
71
|
+
ports:
|
|
72
|
+
- '3210:3210'
|
|
73
|
+
environment:
|
|
74
|
+
OPENAI_API_KEY: sk-xxxx
|
|
75
|
+
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
76
|
+
ACCESS_CODE: lobe66
|
|
77
|
+
```
|
|
38
78
|
|
|
39
|
-
|
|
79
|
+
<!-- LINK GROUP -->
|
|
40
80
|
|
|
81
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
82
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
41
83
|
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
42
84
|
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
85
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
86
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
|
@@ -1,44 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Docker 部署指引
|
|
2
2
|
|
|
3
3
|
[![][docker-release-shield]][docker-release-link]
|
|
4
|
+
[![][docker-size-shield]][docker-size-link]
|
|
5
|
+
[![][docker-pulls-shield]][docker-pulls-link]
|
|
4
6
|
|
|
5
|
-
我们提供了 Docker
|
|
7
|
+
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务
|
|
6
8
|
|
|
7
|
-
##
|
|
9
|
+
## 安装 Docker 容器环境
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
如果已安装,请跳过此步
|
|
12
|
+
|
|
13
|
+
**Ubuntu**
|
|
14
|
+
|
|
15
|
+
```fish
|
|
16
|
+
$ apt install docker.io
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**CentOS**
|
|
20
|
+
|
|
21
|
+
```fish
|
|
22
|
+
$ yum install docker
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 部署容器镜像
|
|
26
|
+
|
|
27
|
+
### `A` 指令部署(推荐)
|
|
10
28
|
|
|
11
29
|
使用以下命令即可使用一键启动 LobeChat 服务:
|
|
12
30
|
|
|
13
|
-
```
|
|
14
|
-
docker run -d -p 3210:3210 \
|
|
31
|
+
```fish
|
|
32
|
+
$ docker run -d -p 3210:3210 \
|
|
15
33
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
16
34
|
-e ACCESS_CODE=lobe66 \
|
|
17
35
|
lobehub/lobe-chat
|
|
18
36
|
```
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
> **Note**
|
|
39
|
+
>
|
|
40
|
+
> - 默认映射端口为 `3210`, 请确保未被占用或手动更改端口映射
|
|
41
|
+
> - 使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx`
|
|
42
|
+
> - 官方 Docker 镜像中设定的密码默认为 `lobe66`,请将其替换为自己的密码以提升安全性
|
|
43
|
+
> - LobeChat 支持的完整环境变量列表请参考 [环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN) 部分
|
|
21
44
|
|
|
22
|
-
|
|
45
|
+
#### 使用代理地址
|
|
23
46
|
|
|
24
47
|
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
25
48
|
|
|
26
|
-
```
|
|
27
|
-
docker run -d -p 3210:3210 \
|
|
49
|
+
```fish
|
|
50
|
+
$ docker run -d -p 3210:3210 \
|
|
28
51
|
-e OPENAI_API_KEY=sk-xxxx \
|
|
29
52
|
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
30
53
|
-e ACCESS_CODE=lobe66 \
|
|
31
54
|
lobehub/lobe-chat
|
|
32
55
|
```
|
|
33
56
|
|
|
34
|
-
LobeChat 支持的完整环境变量列表请参考 [环境变量](./Environment-Variable.zh-CN.md) 部分。
|
|
35
|
-
|
|
36
57
|
> **Note**\
|
|
37
58
|
> 由于官方的 Docker 镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
|
|
38
59
|
|
|
39
|
-
###
|
|
60
|
+
### `B` Docker Compose
|
|
40
61
|
|
|
41
|
-
|
|
62
|
+
使用 `docker-compose` 时配置文件如下:
|
|
63
|
+
|
|
64
|
+
```yml
|
|
65
|
+
version: '3.8'
|
|
66
|
+
|
|
67
|
+
services:
|
|
68
|
+
lobe-chat:
|
|
69
|
+
image: lobehub/lobe-chat
|
|
70
|
+
container_name: lobe-chat
|
|
71
|
+
ports:
|
|
72
|
+
- '3210:3210'
|
|
73
|
+
environment:
|
|
74
|
+
OPENAI_API_KEY: sk-xxxx
|
|
75
|
+
OPENAI_PROXY_URL: https://api-proxy.com/v1
|
|
76
|
+
ACCESS_CODE: lobe66
|
|
77
|
+
```
|
|
42
78
|
|
|
79
|
+
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
80
|
+
[docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square
|
|
43
81
|
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
44
82
|
[docker-release-shield]: https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square
|
|
83
|
+
[docker-size-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
84
|
+
[docker-size-shield]: https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square
|
package/docs/Home.md
CHANGED
|
@@ -17,6 +17,7 @@ LobeChat is a open-source, extensible ([Function Calling][fc-url]), high-perform
|
|
|
17
17
|
- [Environment Variables](Environment-Variable) | [环境变量](Environment-Variable.zh-CN)
|
|
18
18
|
- [Maintaining Updates with LobeChat Self-Deployment](Upstream-Sync) | [自部署保持更新](Upstream-Sync.zh-CN)
|
|
19
19
|
- [Deploying with Azure OpenAI](Deploy-with-Azure-OpenAI) | [使用 Azure OpenAI 部署](Deploy-with-Azure-OpenAI.zh-CN)
|
|
20
|
+
- [Docker Deployment Guide](Docker-Deployment) | [Docker 部署指引](Docker-Deployment.zh-CN)
|
|
20
21
|
- [Lighthouse Report](Lighthouse) | [性能测试](Lighthouse.zh-CN)
|
|
21
22
|
|
|
22
23
|
---
|
package/docs/_Sidebar.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
- [Environment Variables](Environment-Variable) | [中文](Environment-Variable.zh-CN)
|
|
10
10
|
- [Upstream Sync](Upstream-Sync) | [中文](Upstream-Sync.zh-CN)
|
|
11
11
|
- [Deploying with Azure OpenAI](Deploy-with-Azure-OpenAI) | [中文](Deploy-with-Azure-OpenAI.zh-CN)
|
|
12
|
+
- [Docker Deployment Guide](Docker-Deployment) | [中文](Docker-Deployment.zh-CN)
|
|
12
13
|
- [Lighthouse Report](Lighthouse) | [中文](Lighthouse.zh-CN)
|
|
13
14
|
|
|
14
15
|
#### 🤖 Agents
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.89.
|
|
3
|
+
"version": "0.89.4",
|
|
4
4
|
"description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chatbot",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@ant-design/
|
|
68
|
+
"@ant-design/icons": "^5",
|
|
69
69
|
"@emoji-mart/data": "^1",
|
|
70
70
|
"@emoji-mart/react": "^1",
|
|
71
71
|
"@icons-pack/react-simple-icons": "^9",
|
|
@@ -23,11 +23,14 @@ export const createChatCompletion = async ({ payload, openai }: CreateChatComple
|
|
|
23
23
|
// ============ 2. send api ============ //
|
|
24
24
|
|
|
25
25
|
try {
|
|
26
|
-
const response = await openai.chat.completions.create(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const response = await openai.chat.completions.create(
|
|
27
|
+
{
|
|
28
|
+
messages: formatMessages,
|
|
29
|
+
...params,
|
|
30
|
+
stream: true,
|
|
31
|
+
},
|
|
32
|
+
{ headers: { Accept: '*/*' } },
|
|
33
|
+
);
|
|
31
34
|
const stream = OpenAIStream(response);
|
|
32
35
|
return new StreamingTextResponse(stream);
|
|
33
36
|
} catch (error) {
|