@lobehub/chat 0.89.1 → 0.89.3
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 +50 -0
- package/README.md +28 -2
- package/README.zh-CN.md +28 -2
- package/docs/Analytics.zh-CN.md +1 -5
- package/docs/Development-Guide/Folder-Structure.zh-CN.md +38 -0
- package/docs/Development-Guide/index.zh-CN.md +38 -0
- package/docs/Docker-Deployment.md +42 -0
- package/docs/Docker-Deployment.zh-CN.md +44 -0
- package/docs/Environment-Variable.zh-CN.md +0 -26
- package/package.json +2 -4
- package/src/app/chat/(mobile)/features/SessionHeader.tsx +1 -1
- package/src/app/home/index.tsx +1 -1
- package/src/components/Analytics/index.tsx +1 -4
- package/src/components/ResponsiveIndex.tsx +9 -2
- package/src/config/client.ts +1 -6
- package/src/layout/ResponsiveLayout.client.tsx +1 -1
- package/src/locales/default/common.ts +2 -1
- package/src/components/Analytics/Mixpanel.tsx +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 0.89.3](https://github.com/lobehub/lobe-chat/compare/v0.89.2...v0.89.3)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2023-10-12**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix plugin error with nginx reverse proxy.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **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))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 0.89.2](https://github.com/lobehub/lobe-chat/compare/v0.89.1...v0.89.2)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2023-10-12**</sup>
|
|
33
|
+
|
|
34
|
+
#### 💄 Styles
|
|
35
|
+
|
|
36
|
+
- **misc**: Modify onClick event in SessionHeader, change title in Loading component,.
|
|
37
|
+
|
|
38
|
+
<br/>
|
|
39
|
+
|
|
40
|
+
<details>
|
|
41
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
42
|
+
|
|
43
|
+
#### Styles
|
|
44
|
+
|
|
45
|
+
- **misc**: Modify onClick event in SessionHeader, change title in Loading component, ([b984f6a](https://github.com/lobehub/lobe-chat/commit/b984f6a))
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
<div align="right">
|
|
50
|
+
|
|
51
|
+
[](#readme-top)
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
5
55
|
### [Version 0.89.1](https://github.com/lobehub/lobe-chat/compare/v0.89.0...v0.89.1)
|
|
6
56
|
|
|
7
57
|
<sup>Released on **2023-10-12**</sup>
|
package/README.md
CHANGED
|
@@ -49,7 +49,8 @@ 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
|
-
- [
|
|
52
|
+
- [Deploying with Vercel](#deploying-with-vercel)
|
|
53
|
+
- [Deploying with Docker](#deploying-with-docker)
|
|
53
54
|
- [📦 Ecosystem](#-ecosystem)
|
|
54
55
|
- [🧩 Plugins](#-plugins)
|
|
55
56
|
- [⌨️ Local Development](#️-local-development)
|
|
@@ -174,6 +175,8 @@ We have carried out a series of optimization designs for mobile devices to enhan
|
|
|
174
175
|
|
|
175
176
|
## 🛳 Self Hosting
|
|
176
177
|
|
|
178
|
+
### Deploying with Vercel
|
|
179
|
+
|
|
177
180
|
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:
|
|
178
181
|
|
|
179
182
|
- Prepare your [OpenAI API Key](https://platform.openai.com/account/api-keys).
|
|
@@ -196,10 +199,33 @@ LobeChat provides a [self-hosted version][deploy-link] with Vercel. This allows
|
|
|
196
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` |
|
|
197
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!` |
|
|
198
201
|
|
|
199
|
-
|
|
202
|
+
#### Keep Updated
|
|
200
203
|
|
|
201
204
|
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).
|
|
202
205
|
|
|
206
|
+
### Deploying with Docker
|
|
207
|
+
|
|
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 with one-click:
|
|
209
|
+
|
|
210
|
+
```shell
|
|
211
|
+
docker run -d -p 3210:3210 \
|
|
212
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
213
|
+
-e ACCESS_CODE=lobe66 \
|
|
214
|
+
lobehub/lobe-chat
|
|
215
|
+
```
|
|
216
|
+
|
|
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
|
+
```shell
|
|
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
|
+
```
|
|
226
|
+
|
|
227
|
+
For detailed instructions on deploying with Docker, please refer to the [📘 Docker Deployment Guide](docs/Docker-Deployment.md)
|
|
228
|
+
|
|
203
229
|
<div align="right">
|
|
204
230
|
|
|
205
231
|
[![][back-to-top]](#readme-top)
|
package/README.zh-CN.md
CHANGED
|
@@ -49,7 +49,8 @@ LobeChat 是一个开源的、可扩展的([Function Calling][fc-link])高
|
|
|
49
49
|
- [📸 快照预览](#-快照预览)
|
|
50
50
|
- [⚡️ 性能测试](#️-性能测试)
|
|
51
51
|
- [🛳 开箱即用](#-开箱即用)
|
|
52
|
-
- [
|
|
52
|
+
- [一键部署到 Vercel](#一键部署到-vercel)
|
|
53
|
+
- [使用 Docker 部署](#使用-docker-部署)
|
|
53
54
|
- [📦 生态系统](#-生态系统)
|
|
54
55
|
- [🧩 插件体系](#-插件体系)
|
|
55
56
|
- [⌨️ 本地开发](#️-本地开发)
|
|
@@ -176,6 +177,8 @@ LobeChat 提供了两种独特的主题模式 - 明亮模式和暗黑模式,
|
|
|
176
177
|
|
|
177
178
|
## 🛳 开箱即用
|
|
178
179
|
|
|
180
|
+
### 一键部署到 Vercel
|
|
181
|
+
|
|
179
182
|
LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以在几分钟内构建自己的聊天机器人,无需任何基础知识。如果想自己部署该服务,可以按照以下步骤进行操作:
|
|
180
183
|
|
|
181
184
|
- 准备好你的 [OpenAI API Key](https://platform.openai.com/account/api-keys) 。
|
|
@@ -198,10 +201,33 @@ LobeChat 提供了 Vercel 的 [自托管版本][deploy-link]。这使你可以
|
|
|
198
201
|
| `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://api.chatanywhere.cn/v1`<br/>默认值:<br/>`https://api.openai.com/v1` |
|
|
199
202
|
| `ACCESS_CODE` | 可选 | 添加访问此服务的密码,密码应为 6 位数字或字母 | `awCT74` 或 `e3@09!` |
|
|
200
203
|
|
|
201
|
-
|
|
204
|
+
#### 保持更新
|
|
202
205
|
|
|
203
206
|
如果你根据 README 中的一键部署步骤部署了自己的项目,你可能会发现总是被提示 “有可用更新”。这是因为 Vercel 默认为你创建新项目而非 fork 本项目,这将导致无法准确检测更新。我们建议按照 [📘 LobeChat 自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync.zh-CN) 步骤重新部署。
|
|
204
207
|
|
|
208
|
+
### 使用 Docker 部署
|
|
209
|
+
|
|
210
|
+
我们提供了 Docker 镜像,供你在自己的私有设备上部署 LobeChat 服务。使用以下命令即可使用一键启动 LobeChat 服务:
|
|
211
|
+
|
|
212
|
+
```shell
|
|
213
|
+
docker run -d -p 3210:3210 \
|
|
214
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
215
|
+
-e ACCESS_CODE=lobe66 \
|
|
216
|
+
lobehub/lobe-chat
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
220
|
+
|
|
221
|
+
```shell
|
|
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
|
+
```
|
|
228
|
+
|
|
229
|
+
有关 Docker 部署的详细说明,详见 [📘 使用 Docker 部署](docs/Docker-Deployment.zh-CN.md)
|
|
230
|
+
|
|
205
231
|
<div align="right">
|
|
206
232
|
|
|
207
233
|
[![][back-to-top]](#readme-top)
|
package/docs/Analytics.zh-CN.md
CHANGED
|
@@ -6,14 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
[Vercel Analytics](https://vercel.com/analytics) 是 Vercel 推出的一款数据分析服务,它可以帮助你收集网站的访问情况,包括访问量、访问来源、访问设备等等。
|
|
8
8
|
|
|
9
|
-
|
|
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,38 @@
|
|
|
1
|
+
LobeChat 的文件夹目录架构如下:
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
src
|
|
5
|
+
├── app # 应用主要逻辑和状态管理相关的代码
|
|
6
|
+
├── components # 可复用的 UI 组件
|
|
7
|
+
├── config # 应用的配置文件,包含客户端环境变量与服务端环境变量
|
|
8
|
+
├── const # 用于定义常量,如 action 类型、路由名等
|
|
9
|
+
├── features # 与业务功能相关的功能模块,如 Agent 设置、插件开发弹窗等
|
|
10
|
+
├── hooks # 全应用复用自定义的工具 Hooks
|
|
11
|
+
├── layout # 应用的布局组件,如导航栏、侧边栏等
|
|
12
|
+
├── locales # 国际化的语言文件
|
|
13
|
+
├── services # 封装的后端服务接口,如 HTTP 请求
|
|
14
|
+
├── store # 用于状态管理的 zustand store
|
|
15
|
+
├── types # TypeScript 的类型定义文件
|
|
16
|
+
└── utils # 通用的工具函数
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## app
|
|
20
|
+
|
|
21
|
+
在 `app` 文件夹中,我们将每个路由页面按照 app router 的 [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups) 进行组织,以此来分别处理桌面端和移动端的代码实现。以下是 `welcome` 页面的文件结构为例:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
.
|
|
25
|
+
├── (desktop) # 桌面端实现
|
|
26
|
+
│ ├── features # 桌面端特有的功能
|
|
27
|
+
│ ├── index.tsx # 桌面端的主入口文件
|
|
28
|
+
│ └── layout.desktop.tsx # 桌面端的布局组件
|
|
29
|
+
├── (mobile) # 移动端实现
|
|
30
|
+
│ ├── features # 移动端特有的功能
|
|
31
|
+
│ ├── index.tsx # 移动端的主入口文件
|
|
32
|
+
│ └── layout.mobile.tsx # 移动端的布局组件
|
|
33
|
+
├── features # 此文件夹包含双端共享的特性代码,如 Banner 组件
|
|
34
|
+
│ └── Banner
|
|
35
|
+
└── page.tsx # 此为页面的主入口文件,用于根据设备类型选择加载桌面端或移动端的代码
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
通过这种方式,我们可以清晰地区分和管理桌面端和移动端的代码,同时也能方便地复用在两种设备上都需要的代码,从而提高开发效率并保持代码的整洁和可维护性。
|
|
@@ -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,42 @@
|
|
|
1
|
+
# Deployment using Docker
|
|
2
|
+
|
|
3
|
+
[![][docker-release-shield]][docker-release-link]
|
|
4
|
+
|
|
5
|
+
We provide Docker images for deploying the LobeChat service on your own private devices.
|
|
6
|
+
|
|
7
|
+
## Container Image
|
|
8
|
+
|
|
9
|
+
### Command Deployment (Recommended)
|
|
10
|
+
|
|
11
|
+
Use the following command to start the LobeChat service with one-click:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
docker run -d -p 3210:3210 \
|
|
15
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
16
|
+
-e ACCESS_CODE=lobe66 \
|
|
17
|
+
lobehub/lobe-chat
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Using Proxy Address
|
|
21
|
+
|
|
22
|
+
If you need to use OpenAI services through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
|
|
23
|
+
|
|
24
|
+
```shell
|
|
25
|
+
docker run -d -p 3210:3210 \
|
|
26
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
27
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
28
|
+
-e ACCESS_CODE=lobe66 \
|
|
29
|
+
lobehub/lobe-chat
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
For a complete list of environment variables for LobeChat, please refer to the [Environment Variables](./Environment-Variable.md) section.
|
|
33
|
+
|
|
34
|
+
> **Note**\
|
|
35
|
+
> Since the official Docker image construction takes about half an hour, if you see the "update available" message after updating the deployment, you can wait for the image construction to complete before redeploying.
|
|
36
|
+
|
|
37
|
+
### 🚧 Docker Compose
|
|
38
|
+
|
|
39
|
+
Under construction, please be patient\~
|
|
40
|
+
|
|
41
|
+
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
42
|
+
[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
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# 使用 Docker 部署
|
|
2
|
+
|
|
3
|
+
[![][docker-release-shield]][docker-release-link]
|
|
4
|
+
|
|
5
|
+
我们提供了 Docker 镜像,供你在自己的私有设备上部署 LobeChat 服务。
|
|
6
|
+
|
|
7
|
+
## 容器镜像
|
|
8
|
+
|
|
9
|
+
### 指令部署 (推荐)
|
|
10
|
+
|
|
11
|
+
使用以下命令即可使用一键启动 LobeChat 服务:
|
|
12
|
+
|
|
13
|
+
```shell
|
|
14
|
+
docker run -d -p 3210:3210 \
|
|
15
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
16
|
+
-e ACCESS_CODE=lobe66 \
|
|
17
|
+
lobehub/lobe-chat
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx` , 官方 Docker 镜像中设定的密码默认为 `lobe66`,请将其替换为自己的密码以提升安全性。
|
|
21
|
+
|
|
22
|
+
### 使用代理地址
|
|
23
|
+
|
|
24
|
+
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
docker run -d -p 3210:3210 \
|
|
28
|
+
-e OPENAI_API_KEY=sk-xxxx \
|
|
29
|
+
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
|
|
30
|
+
-e ACCESS_CODE=lobe66 \
|
|
31
|
+
lobehub/lobe-chat
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
LobeChat 支持的完整环境变量列表请参考 [环境变量](./Environment-Variable.zh-CN.md) 部分。
|
|
35
|
+
|
|
36
|
+
> **Note**\
|
|
37
|
+
> 由于官方的 Docker 镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
|
|
38
|
+
|
|
39
|
+
### 🚧 Docker Compose
|
|
40
|
+
|
|
41
|
+
施工中,请耐心等待~
|
|
42
|
+
|
|
43
|
+
[docker-release-link]: https://hub.docker.com/r/lobehub/lobe-chat
|
|
44
|
+
[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
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.89.
|
|
3
|
+
"version": "0.89.3",
|
|
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",
|
|
@@ -69,7 +69,7 @@
|
|
|
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": "
|
|
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",
|
|
@@ -26,7 +26,7 @@ const Header = memo(() => {
|
|
|
26
26
|
<MobileNavBar
|
|
27
27
|
center={<Logo type={'text'} />}
|
|
28
28
|
left={
|
|
29
|
-
<div onClick={() => router.push('/settings
|
|
29
|
+
<div onClick={() => router.push('/settings')} style={{ marginLeft: 8 }}>
|
|
30
30
|
{avatar ? <Avatar avatar={avatar} size={28} /> : <Logo size={28} />}
|
|
31
31
|
</div>
|
|
32
32
|
}
|
package/src/app/home/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import FullscreenLoading from '@/components/FullscreenLoading';
|
|
|
7
7
|
const Loading = () => {
|
|
8
8
|
const { t } = useTranslation();
|
|
9
9
|
|
|
10
|
-
return <FullscreenLoading title={t('
|
|
10
|
+
return <FullscreenLoading title={t('appInitializing', { ns: 'common' })} />;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export default Loading;
|
|
@@ -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,
|
|
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
|
);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { FC, ReactNode, Suspense } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
4
5
|
|
|
6
|
+
import FullscreenLoading from '@/components/FullscreenLoading';
|
|
5
7
|
import { useIsMobile } from '@/hooks/useIsMobile';
|
|
6
8
|
|
|
7
9
|
interface ResponsiveIndexProps {
|
|
@@ -9,9 +11,14 @@ interface ResponsiveIndexProps {
|
|
|
9
11
|
children: ReactNode;
|
|
10
12
|
}
|
|
11
13
|
const ResponsiveIndex = ({ children, Mobile }: ResponsiveIndexProps) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
12
15
|
const mobile = useIsMobile();
|
|
13
16
|
|
|
14
|
-
return
|
|
17
|
+
return (
|
|
18
|
+
<Suspense fallback={<FullscreenLoading title={t('layoutInitializing', { ns: 'common' })} />}>
|
|
19
|
+
{mobile ? <Mobile /> : children}
|
|
20
|
+
</Suspense>
|
|
21
|
+
);
|
|
15
22
|
};
|
|
16
23
|
|
|
17
24
|
export default ResponsiveIndex;
|
package/src/config/client.ts
CHANGED
|
@@ -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
|
|
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,
|
|
@@ -16,7 +16,7 @@ const ResponsiveLayout = ({ children, Desktop, Mobile }: ServerResponsiveLayoutP
|
|
|
16
16
|
const mobile = useIsMobile();
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<Suspense fallback={<FullscreenLoading title={t('
|
|
19
|
+
<Suspense fallback={<FullscreenLoading title={t('layoutInitializing', { ns: 'common' })} />}>
|
|
20
20
|
{mobile ? <Mobile>{children}</Mobile> : <Desktop>{children}</Desktop>}
|
|
21
21
|
</Suspense>
|
|
22
22
|
);
|
|
@@ -36,12 +36,14 @@ export default {
|
|
|
36
36
|
feedback: '反馈与建议',
|
|
37
37
|
historyRange: '历史范围',
|
|
38
38
|
import: '导入配置',
|
|
39
|
+
|
|
39
40
|
inbox: {
|
|
40
41
|
defaultMessage:
|
|
41
42
|
'你好,我是你的智能助手,你可以问我任何问题,我会尽力回答你。如果需要获得更加专业或定制的助手,可以点击`+`创建自定义助手',
|
|
42
43
|
desc: '开启大脑集群,激发思维火花。你的智能助理,在这里与你交流一切',
|
|
43
44
|
title: '随便聊聊',
|
|
44
45
|
},
|
|
46
|
+
layoutInitializing: '正在加载布局...',
|
|
45
47
|
message: {
|
|
46
48
|
function_loading: '插件请求中...',
|
|
47
49
|
},
|
|
@@ -75,7 +77,6 @@ export default {
|
|
|
75
77
|
withSystemRole: '包含助手角色设定',
|
|
76
78
|
},
|
|
77
79
|
stop: '停止',
|
|
78
|
-
switchMobileLayout: '正在切换到移动端布局...',
|
|
79
80
|
tab: {
|
|
80
81
|
chat: '会话',
|
|
81
82
|
market: '发现',
|
|
@@ -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;
|