@lobehub/chat 0.89.2 → 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 CHANGED
@@ -2,6 +2,56 @@
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
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 0.89.3](https://github.com/lobehub/lobe-chat/compare/v0.89.2...v0.89.3)
31
+
32
+ <sup>Released on **2023-10-12**</sup>
33
+
34
+ #### 🐛 Bug Fixes
35
+
36
+ - **misc**: Fix plugin error with nginx reverse proxy.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's fixed
44
+
45
+ - **misc**: Fix plugin error with nginx reverse proxy, closes [#315](https://github.com/lobehub/lobe-chat/issues/315) ([3ba3a3b](https://github.com/lobehub/lobe-chat/commit/3ba3a3b))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 0.89.2](https://github.com/lobehub/lobe-chat/compare/v0.89.1...v0.89.2)
6
56
 
7
57
  <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 a 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.
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,7 +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
- - [Keep Updated](#keep-updated)
52
+ - [`A` Deploying with Vercel](#a-deploying-with-vercel)
53
+ - [`B` Deploying with Docker](#b-deploying-with-docker)
54
+ - [Environment Variable](#environment-variable)
53
55
  - [📦 Ecosystem](#-ecosystem)
54
56
  - [🧩 Plugins](#-plugins)
55
57
  - [⌨️ Local Development](#️-local-development)
@@ -174,21 +176,62 @@ We have carried out a series of optimization designs for mobile devices to enhan
174
176
 
175
177
  ## 🛳 Self Hosting
176
178
 
177
- LobeChat provides a [self-hosted version][deploy-link] with Vercel. This allows you to build your own chatbot within a few minutes, without any prior knowledge. If you want to deploy this service yourself, you can follow these steps:
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.
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:
178
186
 
179
187
  - Prepare your [OpenAI API Key](https://platform.openai.com/account/api-keys).
180
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;
181
189
  - After deployment, you can start using it;
182
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.
183
191
 
184
- <div align="center">
192
+ #### Keep Updated
185
193
 
186
- [![][deploy-button-image]][deploy-link]
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.
187
195
 
188
- </div>
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).
198
+
199
+ <br/>
200
+
201
+ ### `B` Deploying with Docker
202
+
203
+ [![][docker-release-shield]][docker-release-link]
204
+ [![][docker-size-shield]][docker-size-link]
205
+ [![][docker-pulls-shield]][docker-pulls-link]
206
+
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:
208
+
209
+ ```fish
210
+ $ docker run -d -p 3210:3210 \
211
+ -e OPENAI_API_KEY=sk-xxxx \
212
+ -e ACCESS_CODE=lobe66 \
213
+ lobehub/lobe-chat
214
+ ```
215
+
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
+
219
+ ```fish
220
+ $ docker run -d -p 3210:3210 \
221
+ -e OPENAI_API_KEY=sk-xxxx \
222
+ -e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
223
+ -e ACCESS_CODE=lobe66 \
224
+ lobehub/lobe-chat
225
+ ```
189
226
 
190
227
  > **Note**\
191
- > 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) :
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:
192
235
 
193
236
  | Environment Variable | Required | Description | Example |
194
237
  | -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
@@ -196,9 +239,8 @@ LobeChat provides a [self-hosted version][deploy-link] with Vercel. This allows
196
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` |
197
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!` |
198
241
 
199
- ### Keep Updated
200
-
201
- 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. We suggest you redeploy using the following steps, [📘 Maintaining Updates with LobeChat Self-Deployment](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync).
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)
202
244
 
203
245
  <div align="right">
204
246
 
@@ -258,7 +300,7 @@ Or clone it for local development:
258
300
 
259
301
  [![][bun-shield]][bun-link]
260
302
 
261
- ```bash
303
+ ```fish
262
304
  $ git clone https://github.com/lobehub/lobe-chat.git
263
305
  $ cd lobe-chat
264
306
  $ bun install
@@ -329,13 +371,16 @@ This project is [MIT](./LICENSE) licensed.
329
371
  [codespaces-shield]: https://github.com/codespaces/badge.svg
330
372
  [contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-chat
331
373
  [contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
332
- [deploy-button-image]: https://vercel.com/button
333
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
334
375
  [discord-link]: https://discord.gg/AYFPHvv2jT
335
376
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
336
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
337
380
  [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
338
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
339
384
  [fc-link]: https://sspai.com/post/81986
340
385
  [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
341
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,7 +49,9 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
49
49
  - [📸 快照预览](#-快照预览)
50
50
  - [⚡️ 性能测试](#️-性能测试)
51
51
  - [🛳 开箱即用](#-开箱即用)
52
- - [保持更新](#保持更新)
52
+ - [`A` 使用 Vercel 部署](#a-使用-vercel-部署)
53
+ - [`B` 使用 Docker 部署](#b-使用-docker-部署)
54
+ - [环境变量](#环境变量)
53
55
  - [📦 生态系统](#-生态系统)
54
56
  - [🧩 插件体系](#-插件体系)
55
57
  - [⌨️ 本地开发](#️-本地开发)
@@ -176,21 +178,62 @@ LobeChat 提供了两种独特的主题模式 - 明亮模式和暗黑模式,
176
178
 
177
179
  ## 🛳 开箱即用
178
180
 
179
- LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以在几分钟内构建自己的聊天机器人,无需任何基础知识。如果想自己部署该服务,可以按照以下步骤进行操作:
181
+ LobeChat 提供了 Vercel 的 [自托管版本][deploy-link] 和 [Docker 镜像][docker-release-link],这使你可以在几分钟内构建自己的聊天机器人,无需任何基础知识。
182
+
183
+ <br/>
184
+
185
+ ### `A` 使用 Vercel 部署
186
+
187
+ 如果想在 Vercel 上部署该服务,可以按照以下步骤进行操作:
180
188
 
181
189
  - 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys) 。
182
190
  - 点击下方按钮开始部署: Deploy with Vercel,直接使用 GitHub 账号登录即可,记得在环境变量页填入 API Key 和页面访问密码 CODE;
183
191
  - 部署完毕后,即可开始使用;
184
192
  - 绑定自定义域名(可选):Vercel 分配的域名 DNS 在某些区域被污染了,绑定自定义域名即可直连。
185
193
 
186
- <div align="center">
194
+ #### 保持更新
187
195
 
188
- [![][deploy-button-image]][deploy-link]
196
+ 如果你根据 README 中的一键部署步骤部署了自己的项目,你可能会发现总是被提示 “有可用更新”。这是因为 Vercel 默认为你创建新项目而非 fork 本项目,这将导致无法准确检测更新。
189
197
 
190
- </div>
198
+ > **Important**\
199
+ > 我们建议按照 [📘 LobeChat 自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN) 步骤重新部署。
200
+
201
+ <br/>
202
+
203
+ ### `B` 使用 Docker 部署
204
+
205
+ [![][docker-release-shield]][docker-release-link]
206
+ [![][docker-size-shield]][docker-size-link]
207
+ [![][docker-pulls-shield]][docker-pulls-link]
208
+
209
+ 我们提供了 Docker 镜像,供你在自己的私有设备上部署 LobeChat 服务。使用以下命令即可使用一键启动 LobeChat 服务:
210
+
211
+ ```fish
212
+ $ docker run -d -p 3210:3210 \
213
+ -e OPENAI_API_KEY=sk-xxxx \
214
+ -e ACCESS_CODE=lobe66 \
215
+ lobehub/lobe-chat
216
+ ```
217
+
218
+ > **Note**\
219
+ > 如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
220
+
221
+ ```fish
222
+ $ docker run -d -p 3210:3210 \
223
+ -e OPENAI_API_KEY=sk-xxxx \
224
+ -e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
225
+ -e ACCESS_CODE=lobe66 \
226
+ lobehub/lobe-chat
227
+ ```
191
228
 
192
229
  > **Note**\
193
- > 本项目提供了一些额外的配置项,使用环境变量进行设置,完整环境变量可见 [📘环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN):
230
+ > 有关 Docker 部署的详细说明,详见 [📘 使用 Docker 部署](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment.zh-CN)
231
+
232
+ <br/>
233
+
234
+ ### 环境变量
235
+
236
+ 本项目提供了一些额外的配置项,使用环境变量进行设置:
194
237
 
195
238
  | 环境变量 | 类型 | 描述 | 示例 |
196
239
  | ------------------ | ---- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
@@ -198,9 +241,8 @@ LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以
198
241
  | `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
199
242
  | `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
200
243
 
201
- ### 保持更新
202
-
203
- 如果你根据 README 中的一键部署步骤部署了自己的项目,你可能会发现总是被提示 “有可用更新”。这是因为 Vercel 默认为你创建新项目而非 fork 本项目,这将导致无法准确检测更新。我们建议按照 [📘 LobeChat 自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN) 步骤重新部署。
244
+ > **Note**\
245
+ > 完整环境变量可见 [📘环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable.zh-CN)
204
246
 
205
247
  <div align="right">
206
248
 
@@ -260,7 +302,7 @@ LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以
260
302
 
261
303
  [![][bun-shield]][bun-link]
262
304
 
263
- ```bash
305
+ ```fish
264
306
  $ git clone https://github.com/lobehub/lobe-chat.git
265
307
  $ cd lobe-chat
266
308
  $ bun install
@@ -331,13 +373,16 @@ This project is [MIT](./LICENSE) licensed.
331
373
  [codespaces-shield]: https://github.com/codespaces/badge.svg
332
374
  [contributors-contrib]: https://contrib.rocks/image?repo=lobehub/lobe-chat
333
375
  [contributors-link]: https://github.com/lobehub/lobe-chat/graphs/contributors
334
- [deploy-button-image]: https://vercel.com/button
335
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
336
377
  [discord-link]: https://discord.gg/AYFPHvv2jT
337
378
  [discord-shield]: https://img.shields.io/discord/1127171173982154893?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square
338
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
339
382
  [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
340
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
341
386
  [fc-link]: https://sspai.com/post/81986
342
387
  [fossa-license-link]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
343
388
  [fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
@@ -6,14 +6,10 @@
6
6
 
7
7
  [Vercel Analytics](https://vercel.com/analytics) 是 Vercel 推出的一款数据分析服务,它可以帮助你收集网站的访问情况,包括访问量、访问来源、访问设备等等。
8
8
 
9
- 由于我们推荐使用 Vercel 一键部署 LobeChat,因此我们在代码中默认集成了 Vercel Analytics,你可以通过自行打开部署项目中 \[Insights] tab,查看你的应用访问情况。
9
+ 我们在代码中集成了 Vercel Analytics,你可以通过设置环境变量 `NEXT_PUBLIC_ANALYTICS_VERCEL=1` 来开启它,并打开 Vercel 部署项目中 Analytics tab 查看你的应用访问情况。
10
10
 
11
11
  Vercel Analytics 提供了 2500 次 / 月的免费 Web Analytics Events (可以理解为 PV),对于个人部署自用的产品来说基本够用。
12
12
 
13
13
  如果你需要了解 Vercel Analytics 的详细使用教程,请查阅[Vercel Web Analytics 快速开始](https://vercel.com/docs/analytics/quickstart)
14
14
 
15
- 如果你不需要 Vercel Analytics,你可以通过设置环境变量 `NEXT_PUBLIC_ANALYTICS_VERCEL=0` 来关闭它。
16
-
17
15
  ## 🚧 Posthog
18
-
19
- ## 🚧 Mixpanel
@@ -0,0 +1,40 @@
1
+ # 目录架构
2
+
3
+ LobeChat 的文件夹目录架构如下:
4
+
5
+ ```bash
6
+ src
7
+ ├── app # 应用主要逻辑和状态管理相关的代码
8
+ ├── components # 可复用的 UI 组件
9
+ ├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量
10
+ ├── const # 用于定义常量,如 action 类型、路由名等
11
+ ├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等
12
+ ├── hooks # 全应用复用自定义的工具 Hooks
13
+ ├── layout # 应用的布局组件,如导航栏、侧边栏等
14
+ ├── locales # 国际化的语言文件
15
+ ├── services # 封装的后端服务接口,如 HTTP 请求
16
+ ├── store # 用于状态管理的 zustand store
17
+ ├── types # TypeScript 的类型定义文件
18
+ └── utils # 通用的工具函数
19
+ ```
20
+
21
+ ## app
22
+
23
+ 在 `app` 文件夹中,我们将每个路由页面按照 app router 的 [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups) 进行组织,以此来分别处理桌面端和移动端的代码实现。以 `welcome` 页面的文件结构为例:
24
+
25
+ ```bash
26
+ welcome
27
+ ├── (desktop) # 桌面端实现
28
+ │ ├── features # 桌面端特有的功能
29
+ │ ├── index.tsx # 桌面端的主入口文件
30
+ │ └── layout.desktop.tsx # 桌面端的布局组件
31
+ ├── (mobile) # 移动端实现
32
+ │ ├── features # 移动端特有的功能
33
+ │ ├── index.tsx # 移动端的主入口文件
34
+ │ └── layout.mobile.tsx # 移动端的布局组件
35
+ ├── features # 此文件夹包含双端共享的特性代码,如 Banner 组件
36
+ │ └── Banner
37
+ └── page.tsx # 此为页面的主入口文件,用于根据设备类型选择加载桌面端或移动端的代码
38
+ ```
39
+
40
+ 通过这种方式,我们可以清晰地区分和管理桌面端和移动端的代码,同时也能方便地复用在两种设备上都需要的代码,从而提高开发效率并保持代码的整洁和可维护性。
@@ -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
+ ![](https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/274655364-414bc31e-8511-47a3-af17-209b530effc7.png)
58
+
59
+ 在开发过程中,如果你在环境设置上遇到任何问题,或者有任何关于 LobeChat 开发的问题,欢迎随时向我们提问。我们期待看到你的贡献!
60
+
61
+ [codespaces-link]: https://codespaces.new/lobehub/lobe-chat
62
+ [codespaces-shield]: https://github.com/codespaces/badge.svg
@@ -0,0 +1,38 @@
1
+ # LobeChat 技术开发上手指南
2
+
3
+ 欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。
4
+
5
+ ## 基础技术栈
6
+
7
+ LobeChat 的核心技术栈如下:
8
+
9
+ - **框架**:我们选择了 [Next.js](https://nextjs.org/),这是一款强大的 React 框架,为我们的项目提供了服务端渲染、路由框架、Router Handler 等关键功能。
10
+ - **组件库**:我们使用了 [Ant Design (antd)](https://ant.design/) 作为基础组件库,同时引入了 [lobe-ui](https://github.com/lobehub/lobe-ui) 作为我们的业务组件库。
11
+ - **状态管理**:我们选用了 [zustand](https://github.com/pmndrs/zustand),一款轻量级且易于使用的状态管理库。
12
+ - **网络请求**:我们采用 [swr](https://swr.vercel.app/),这是一款用于数据获取的 React Hooks 库。
13
+ - **路由**:路由管理我们直接使用 [Next.js](https://nextjs.org/) 自身提供的解决方案。
14
+ - **国际化**:我们使用 [i18next](https://www.i18next.com/) 来实现应用的多语言支持。
15
+ - **样式**:我们使用 [antd-style](https://github.com/ant-design/antd-style),这是一款与 Ant Design 配套的 CSS-in-JS 库。
16
+ - **单元测试**:我们使用 [vitest](https://github.com/vitejs/vitest) 进行单元测试。
17
+
18
+ ## 文件夹目录架构
19
+
20
+ LobeChat 的文件夹目录架构如下:
21
+
22
+ ```bash
23
+ src
24
+ ├── app # 应用主要逻辑和状态管理相关的代码
25
+ ├── components # 可复用的 UI 组件
26
+ ├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量
27
+ ├── const # 用于定义常量,如 action 类型、路由名等
28
+ ├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等
29
+ ├── hooks # 全应用复用自定义的工具 Hooks
30
+ ├── layout # 应用的布局组件,如导航栏、侧边栏等
31
+ ├── locales # 国际化的语言文件
32
+ ├── services # 封装的后端服务接口,如 HTTP 请求
33
+ ├── store # 用于状态管理的 zustand store
34
+ ├── types # TypeScript 的类型定义文件
35
+ └── utils # 通用的工具函数
36
+ ```
37
+
38
+ 有关目录架构的详细介绍,详见: [文件夹目录架构](Folder-Structure.zh-CN.md)
@@ -0,0 +1,86 @@
1
+ # Docker Deployment Guide
2
+
3
+ [![][docker-release-shield]][docker-release-link]
4
+ [![][docker-size-shield]][docker-size-link]
5
+ [![][docker-pulls-shield]][docker-pulls-link]
6
+
7
+ We provide [Docker Images][docker-release-link] for you to deploy LobeChat service on your private device.
8
+
9
+ ## Install Docker container environment
10
+
11
+ If already installed, skip this step.
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
+ ## 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 \
33
+ -e OPENAI_API_KEY=sk-xxxx \
34
+ -e ACCESS_CODE=lobe66 \
35
+ lobehub/lobe-chat
36
+ ```
37
+
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
46
+
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:
48
+
49
+ ```fish
50
+ $ docker run -d -p 3210:3210 \
51
+ -e OPENAI_API_KEY=sk-xxxx \
52
+ -e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
53
+ -e ACCESS_CODE=lobe66 \
54
+ lobehub/lobe-chat
55
+ ```
56
+
57
+ > **Note**\
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
61
+
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
+ ```
78
+
79
+ <!-- LINK GROUP -->
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
83
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
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
@@ -0,0 +1,84 @@
1
+ # Docker 部署指引
2
+
3
+ [![][docker-release-shield]][docker-release-link]
4
+ [![][docker-size-shield]][docker-size-link]
5
+ [![][docker-pulls-shield]][docker-pulls-link]
6
+
7
+ 我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务
8
+
9
+ ## 安装 Docker 容器环境
10
+
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` 指令部署(推荐)
28
+
29
+ 使用以下命令即可使用一键启动 LobeChat 服务:
30
+
31
+ ```fish
32
+ $ docker run -d -p 3210:3210 \
33
+ -e OPENAI_API_KEY=sk-xxxx \
34
+ -e ACCESS_CODE=lobe66 \
35
+ lobehub/lobe-chat
36
+ ```
37
+
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) 部分
44
+
45
+ #### 使用代理地址
46
+
47
+ 如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
48
+
49
+ ```fish
50
+ $ docker run -d -p 3210:3210 \
51
+ -e OPENAI_API_KEY=sk-xxxx \
52
+ -e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
53
+ -e ACCESS_CODE=lobe66 \
54
+ lobehub/lobe-chat
55
+ ```
56
+
57
+ > **Note**\
58
+ > 由于官方的 Docker 镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
59
+
60
+ ### `B` Docker Compose
61
+
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
+ ```
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
81
+ [docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
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
@@ -19,7 +19,6 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
19
19
  - [`AGENTS_INDEX_URL`](#agents_index_url)
20
20
  - [数据统计](#数据统计)
21
21
  - [Vercel Analytics](#vercel-analytics)
22
- - [Mixpanel Analytics](#mixpanel-analytics)
23
22
  - [Posthog Analytics](#posthog-analytics)
24
23
 
25
24
  ## 通用变量
@@ -114,29 +113,6 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
114
113
  - 默认值: -
115
114
  - 示例:`1`
116
115
 
117
- ### Mixpanel Analytics
118
-
119
- #### `NEXT_PUBLIC_ANALYTICS_MIXPANEL`
120
-
121
- - 类型:可选
122
- - 描述:用于开启 [Mixpanel Analytics][mixpanel-analytics-url] 的环境变量,设为 `1` 时开启 Mixpanel Analytics
123
- - 默认值: -
124
- - 示例:`1`
125
-
126
- #### `NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN`
127
-
128
- - 类型:可选
129
- - 描述:设置 Mixpanel 项目的识别 Token,可以在[这里][mixpanel-project-url]找到
130
- - 默认值: -
131
- - 示例:`60db2abae7fdd29961f4e8f91b074b3a`
132
-
133
- #### `NEXT_PUBLIC_MIXPANEL_DEBUG`
134
-
135
- - 类型:可选
136
- - 描述:开启 Mixpanel 的调试模式
137
- - 默认值: -
138
- - 示例:`1`
139
-
140
116
  ### Posthog Analytics
141
117
 
142
118
  #### `NEXT_PUBLIC_ANALYTICS_POSTHOG`
@@ -168,7 +144,5 @@ LobeChat 在部署时提供了一些额外的配置项,使用环境变量进
168
144
  - 示例:`1`
169
145
 
170
146
  [azure-api-verion-url]: https://docs.microsoft.com/zh-cn/azure/developer/javascript/api-reference/es-modules/azure-sdk/ai-translation/translationconfiguration?view=azure-node-latest#api-version
171
- [mixpanel-analytics-url]: https://mixpanel.com
172
- [mixpanel-project-url]: https://mixpanel.com/settings/project
173
147
  [openai-api-page]: https://platform.openai.com/account/api-keys
174
148
  [posthog-analytics-url]: https://posthog.com
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.2",
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,11 +65,11 @@
65
65
  ]
66
66
  },
67
67
  "dependencies": {
68
- "@ant-design/colors": "^7",
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",
72
- "@lobehub/chat-plugin-sdk": "latest",
72
+ "@lobehub/chat-plugin-sdk": "^1.17.8",
73
73
  "@lobehub/chat-plugins-gateway": "latest",
74
74
  "@lobehub/ui": "latest",
75
75
  "@vercel/analytics": "^1",
@@ -91,7 +91,6 @@
91
91
  "immer": "^10",
92
92
  "lodash-es": "^4",
93
93
  "lucide-react": "latest",
94
- "mixpanel-browser": "^2",
95
94
  "modern-screenshot": "^4",
96
95
  "nanoid": "^5",
97
96
  "next": "^13.5.3",
@@ -130,7 +129,6 @@
130
129
  "@types/chroma-js": "^2",
131
130
  "@types/lodash": "^4",
132
131
  "@types/lodash-es": "^4",
133
- "@types/mixpanel-browser": "^2",
134
132
  "@types/node": "^20",
135
133
  "@types/react": "^18",
136
134
  "@types/react-dom": "^18",
@@ -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
- messages: formatMessages,
28
- ...params,
29
- stream: true,
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) {
@@ -3,19 +3,16 @@ import dynamic from 'next/dynamic';
3
3
  import { getClientConfig } from '@/config/client';
4
4
 
5
5
  const Vercel = dynamic(() => import('./Vercel'), { ssr: false });
6
- const Mixpanel = dynamic(() => import('./Mixpanel'), { ssr: false });
7
6
  const Plausible = dynamic(() => import('./Plausible'), { ssr: false });
8
7
  const Posthog = dynamic(() => import('./Posthog'), { ssr: false });
9
8
 
10
- const { ANALYTICS_VERCEL, ANALYTICS_POSTHOG, ANALYTICS_MIXPANEL, ANALYTICS_PLAUSIBLE } =
11
- getClientConfig();
9
+ const { ANALYTICS_VERCEL, ANALYTICS_POSTHOG, ANALYTICS_PLAUSIBLE } = getClientConfig();
12
10
 
13
11
  const Analytics = () => {
14
12
  return (
15
13
  <>
16
14
  {ANALYTICS_VERCEL && <Vercel />}
17
15
  {ANALYTICS_PLAUSIBLE && <Plausible />}
18
- {ANALYTICS_MIXPANEL && <Mixpanel />}
19
16
  {ANALYTICS_POSTHOG && <Posthog />}
20
17
  </>
21
18
  );
@@ -34,18 +34,13 @@ export const getClientConfig = () => ({
34
34
  PLUGINS_INDEX_URL: process.env.PLUGINS_INDEX_URL,
35
35
 
36
36
  // Vercel Analytics
37
- ANALYTICS_VERCEL: process.env.NEXT_PUBLIC_ANALYTICS_VERCEL !== '0',
37
+ ANALYTICS_VERCEL: process.env.NEXT_PUBLIC_ANALYTICS_VERCEL === '1',
38
38
  VERCEL_DEBUG: process.env.NEXT_PUBLIC_VERCEL_DEBUG === '1',
39
39
 
40
40
  // Plausible Analytics
41
41
  ANALYTICS_PLAUSIBLE: process.env.NEXT_PUBLIC_ANALYTICS_PLAUSIBLE === '1',
42
42
  PLAUSIBLE_DOMAIN: process.env.NEXT_PUBLIC_PLAUSIBLE_DOMAIN,
43
43
 
44
- // Mixpanel Analytics
45
- ANALYTICS_MIXPANEL: process.env.NEXT_PUBLIC_ANALYTICS_MIXPANEL === '1',
46
- MIXPANEL_PROJECT_TOKEN: process.env.NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN,
47
- MIXPANEL_DEBUG: process.env.NEXT_PUBLIC_MIXPANEL_DEBUG === '1',
48
-
49
44
  // Posthog Analytics
50
45
  ANALYTICS_POSTHOG: process.env.NEXT_PUBLIC_ANALYTICS_POSTHOG === '1',
51
46
  POSTHOG_KEY: process.env.NEXT_PUBLIC_POSTHOG_KEY,
@@ -1,23 +0,0 @@
1
- 'use client';
2
-
3
- import mixpanel from 'mixpanel-browser';
4
- import { memo, useEffect } from 'react';
5
-
6
- import { getClientConfig } from '@/config/client';
7
-
8
- const { MIXPANEL_PROJECT_TOKEN, MIXPANEL_DEBUG } = getClientConfig();
9
-
10
- const MixpanelAnalytics = memo(() => {
11
- useEffect(() => {
12
- if (!MIXPANEL_PROJECT_TOKEN) return;
13
-
14
- mixpanel.init(MIXPANEL_PROJECT_TOKEN, {
15
- debug: MIXPANEL_DEBUG,
16
- persistence: 'localStorage',
17
- track_pageview: true,
18
- });
19
- }, []);
20
- return null;
21
- });
22
-
23
- export default MixpanelAnalytics;