Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/lobehub/lobe-chat
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 22, 2024
2 parents c1809da + 653bb34 commit a6326a8
Show file tree
Hide file tree
Showing 42 changed files with 464 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ OPENAI_API_KEY=sk-xxxxxxxxx
#S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com

# Public access domain for the bucket
#NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
#S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com

# Bucket region, such as us-west-1, generally not needed to add
# but some service providers may require configuration
Expand Down
100 changes: 100 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,106 @@

# Changelog

### [Version 1.12.8](https://github.com/lobehub/lobe-chat/compare/v1.12.7...v1.12.8)

<sup>Released on **2024-08-22**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix `NEXT_PUBLIC_S3_DOMAIN` error on Docker.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Fix `NEXT_PUBLIC_S3_DOMAIN` error on Docker, closes [#3564](https://github.com/lobehub/lobe-chat/issues/3564) ([bc6b64c](https://github.com/lobehub/lobe-chat/commit/bc6b64c))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.7](https://github.com/lobehub/lobe-chat/compare/v1.12.6...v1.12.7)

<sup>Released on **2024-08-22**</sup>

#### 🐛 Bug Fixes

- **misc**: Logout button not shown on mobile view when using nextauth.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Logout button not shown on mobile view when using nextauth, closes [#3561](https://github.com/lobehub/lobe-chat/issues/3561) ([0c4efe4](https://github.com/lobehub/lobe-chat/commit/0c4efe4))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.6](https://github.com/lobehub/lobe-chat/compare/v1.12.5...v1.12.6)

<sup>Released on **2024-08-22**</sup>

#### ♻ Code Refactoring

- **misc**: Refactor s3 env and support path-style for minio.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### Code refactoring

- **misc**: Refactor s3 env and support path-style for minio, closes [#3559](https://github.com/lobehub/lobe-chat/issues/3559) ([1658403](https://github.com/lobehub/lobe-chat/commit/1658403))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.5](https://github.com/lobehub/lobe-chat/compare/v1.12.4...v1.12.5)

<sup>Released on **2024-08-22**</sup>

#### 🐛 Bug Fixes

- **misc**: Fix clipboard copy issue and improve upload cors feedback.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **misc**: Fix clipboard copy issue and improve upload cors feedback, closes [#3557](https://github.com/lobehub/lobe-chat/issues/3557) ([86c5a99](https://github.com/lobehub/lobe-chat/commit/86c5a99))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.4](https://github.com/lobehub/lobe-chat/compare/v1.12.3...v1.12.4)

<sup>Released on **2024-08-22**</sup>
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.database
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ ENV NEXT_AUTH_SECRET="" \

# S3
ENV NEXT_PUBLIC_S3_DOMAIN="" \
S3_PUBLIC_DOMAIN="" \
S3_ACCESS_KEY_ID="" \
S3_BUCKET="" \
S3_ENDPOINT="" \
Expand Down
22 changes: 21 additions & 1 deletion docs/self-hosting/advanced/s3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,34 @@ In this documentation, S3 refers to a compatible S3 storage solution, which supp

Whether to set the ACL to `public-read` when uploading files. This option is enabled by default. If the service provider does not support setting individual ACLs for files (i.e., all files inherit the ACL of the storage bucket), enabling this option may cause request errors. Set `S3_SET_ACL` to `0` to disable it.

### `NEXT_PUBLIC_S3_DOMAIN`
### `S3_PUBLIC_DOMAIN`

The public access domain of the storage bucket, used to access files in the storage bucket. This address needs to be **publicly readable**. The reason is that when OpenAI's gpt-4o and other vision models recognize images, OpenAI will try to download this image link on their servers. Therefore, this link must be publicly accessible. If it is a private link, OpenAI will not be able to access the image and thus will not be able to recognize the image content properly.

<Callout type={'warning'}>
Additionally, since this access domain is often a separate URL, it needs to be configured to allow cross-origin access to the site. Otherwise, cross-origin issues will occur in the browser.
</Callout>

### `S3_ENABLE_PATH_STYLE`

Whether to enable the `path-style` access mode of S3. This option is disabled by default. If your S3 service provider uses `path-style`, set `S3_ENABLE_PATH_STYLE` to `1` to enable it.

<Callout type={'info'}>

`path-style` and `virtual-host` are different ways to access buckets and objects in S3, with different URL structures and domain name resolutions.

Assuming the domain name of the S3 service provider is s3.example.net, the bucket is mybucket, and the object is config.env, the specific differences are as follows:
- path-style: `s3.example.net/mybucket/config.env`
- virtual-host: `mybucket.s3.example.net/config.env`

</Callout>

<Callout type={'tip'}>

Common S3 cloud service providers often default to the `virtual-host` mode, while self-deployed services like Minio default to using `path-style`. Therefore, if you use Minio as the S3 service, you need to set `S3_ENABLE_PATH_STYLE=1`.

</Callout>

</Steps>

## S3 Configuration Guide
Expand Down
24 changes: 23 additions & 1 deletion docs/self-hosting/advanced/s3.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com

是否在上传文件时设置 ACL 为 `public-read`。该选项默认启用。如果服务商不支持为文件设置单独的 ACL(即所有文件继承存储桶的 ACL),启用此选项可能会导致请求错误,将 `S3_SET_ACL` 设置为 `0` 即可关闭。

### `NEXT_PUBLIC_S3_DOMAIN`
### `S3_PUBLIC_DOMAIN`

存储桶对外的访问域名,用于访问存储桶中的文件,这个地址需要**允许互联网可读**。 原因是 OpenAI 的 gpt-4o 等视觉模型识别图片时,OpenAI 会尝试在他们的服务器中下载这个图片链接,因此这个链接必须是公开可访问的,如果是私有的链接,OpenAI 将无法访问到这个图片,进而无法正常识别到图片内容。

Expand All @@ -55,6 +55,28 @@ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com

</Callout>

### `S3_ENABLE_PATH_STYLE`

是否启用 S3 的 `path-style` 访问模式。此选项默认禁用。如果您的 S3 服务提供商使用 `path-style`,请将 `S3_ENABLE_PATH_STYLE` 设置为 `1` 以启用它。

<Callout type={'info'}>

`path-style``virtual-host` 在 S3 中是访问 bucket 和 object 的不同方式,URL 的结构和域名解析不太一样

假设 S3 服务商的域名是 s3.example.net ,bucket为mybucket,object为config.env,具体区别如下:
- path-style : `s3.example.net/mybucket/config.env`
- virtual-host : `mybucket.s3.example.net/config.env`

</Callout>

<Callout type={'tip'}>

常见的 S3 Cloud 服务商往往默认采用 `virtual-host` 模式,而自部署服务 minio 则默认使用的是 `path-style`。 因此如果你使用了 minio 作为 S3 服务,你需要设置 `S3_ENABLE_PATH_STYLE=1`


</Callout>


</Steps>

## S3 配置指南
Expand Down
4 changes: 2 additions & 2 deletions docs/self-hosting/advanced/s3/cloudflare-r2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ S3_BUCKET=lobechat
# Request endpoint of the bucket (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the page for applying S3 API token)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Access domain of the bucket
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

<Callout type={'warning'}>`S3_ENDPOINT` must have its path removed, otherwise uploaded files cannot be accessed.</Callout>
Expand Down Expand Up @@ -138,7 +138,7 @@ S3_BUCKET=lobechat
# Bucket Request Endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public Access Domain for the Bucket
NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com

# Bucket Region, such as us-west-1. Generally not required, but some service providers may need it.
# S3_REGION=us-west-1
Expand Down
4 changes: 2 additions & 2 deletions docs/self-hosting/advanced/s3/cloudflare-r2.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ S3_BUCKET=lobechat
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
Expand Down Expand Up @@ -139,7 +139,7 @@ S3_BUCKET=lobechat
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com

# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
Expand Down
4 changes: 2 additions & 2 deletions docs/self-hosting/server-database/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ S3_ACCESS_KEY_ID=xxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=lobechat
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

### Start the lobe-chat-database Docker image
Expand Down Expand Up @@ -125,7 +125,7 @@ $ docker run -it -d --name lobe-chat-database -p 3210:3210 \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=lobechat \
-e NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com \
-e S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com \
lobehub/lobe-chat-database
```

Expand Down
4 changes: 2 additions & 2 deletions docs/self-hosting/server-database/docker.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ S3_ACCESS_KEY_ID=xxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=lobechat
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

### 启动 lobe-chat-database docker 镜像
Expand Down Expand Up @@ -130,7 +130,7 @@ $ docker run -it -d --name lobe-chat-database -p 3210:3210 \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=lobechat \
-e NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com \
-e S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com \
lobehub/lobe-chat-database
```

Expand Down
8 changes: 4 additions & 4 deletions docs/self-hosting/server-database/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ S3_BUCKET=lobechat
# Storage bucket request endpoint (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the S3 API token application page)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public access domain for the storage bucket
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

<Callout type={'warning'}>
Expand Down Expand Up @@ -312,7 +312,7 @@ S3_BUCKET=lobechat
# Bucket request endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public domain for bucket access
NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com

# Bucket region, such as us-west-1, generally not required, but some providers may need to configure
# S3_REGION=us-west-1
Expand Down Expand Up @@ -384,7 +384,7 @@ src={'https://github.com/lobehub/lobe-chat/assets/28616219/da84edc3-46f7-4e2b-a0
<Image
alt={'Login successful state'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/9cb5150d-6e1e-4c59-9a18-4e418dce1a5d'}/>

</Steps>

## Appendix
Expand Down Expand Up @@ -416,7 +416,7 @@ S3_BUCKET=lobechat
# Bucket request endpoint
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Public access domain for the bucket
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
# Bucket region, such as us-west-1, generally not needed to add, but some service providers may require configuration
# S3_REGION=us-west-1
```
12 changes: 6 additions & 6 deletions docs/self-hosting/server-database/vercel.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ tags:

<Callout type={'warning'}>
进行后续操作前,请务必确认以下事项:
- 导出所有数据,部署服务端数据库后,原有用户数据无法自动迁移,只能提前备份后进行手动导入!
- 环境变量中的`ACCESS_CODE`未设置或已清除!
- 导出所有数据,部署服务端数据库后,原有用户数据无法自动迁移,只能提前备份后进行手动导入!
- 环境变量中的`ACCESS_CODE`未设置或已清除!
- 配置服务端数据库所需要的环境变量时,需全部填入后再进行部署,否则可能遭遇数据库迁移问题!
</Callout>

Expand All @@ -46,7 +46,7 @@ tags:

<Callout type={'warning'}>
请确认您的供应商所提供的 `Postgres` 类型,若为 `Node Postgres`,请切换到 `Node Postgres` Tab 。

</Callout>

Serverless Postgres 需要填写的变量如下:
Expand Down Expand Up @@ -233,7 +233,7 @@ S3_BUCKET=lobechat
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```

<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
Expand Down Expand Up @@ -291,7 +291,7 @@ S3_BUCKET=lobechat
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
NEXT_PUBLIC_S3_DOMAIN=https://s3-dev.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com

# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
Expand Down Expand Up @@ -397,7 +397,7 @@ S3_BUCKET=lobechat
# 存储桶的请求端点
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
# S3_REGION=us-west-1
```
5 changes: 4 additions & 1 deletion locales/ar/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"upload": {
"desc": "التفاصيل: {{detail}}",
"fileOnlySupportInServerMode": "وضع النشر الحالي لا يدعم تحميل ملفات غير الصور. إذا كنت بحاجة إلى تحميل تنسيق {{ext}}، يرجى التبديل إلى نشر قاعدة بيانات الخادم أو استخدام خدمة LobeChat Cloud.",
"title": "فشل تحميل الملف، يرجى التحقق من الاتصال بالشبكة أو المحاولة لاحقًا"
"networkError": "يرجى التأكد من أن اتصال الشبكة لديك يعمل بشكل صحيح، والتحقق من إعدادات تكوين خدمة تخزين الملفات عبر النطاق.",
"title": "فشل تحميل الملف، يرجى التحقق من الاتصال بالشبكة أو المحاولة لاحقًا",
"unknownError": "سبب الخطأ: {{reason}}",
"uploadFailed": "فشل تحميل الملف"
}
}
5 changes: 4 additions & 1 deletion locales/bg-BG/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"upload": {
"desc": "Подробности: {{detail}}",
"fileOnlySupportInServerMode": "Текущият режим на разполагане не поддържа качване на файлове, различни от изображения. За да качите формат {{ext}}, моля, превключете на разполагане с база данни на сървъра или използвайте услугата LobeChat Cloud.",
"title": "Неуспешно качване на файл, моля проверете интернет връзката или опитайте по-късно"
"networkError": "Моля, уверете се, че вашата мрежа работи нормално и проверете дали конфигурацията за крос-домейн на услугата за съхранение на файлове е правилна.",
"title": "Неуспешно качване на файл, моля проверете интернет връзката или опитайте по-късно",
"unknownError": "Причина за грешка: {{reason}}",
"uploadFailed": "Неуспешно качване на файла."
}
}
5 changes: 4 additions & 1 deletion locales/de-DE/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"upload": {
"desc": "Details: {{detail}}",
"fileOnlySupportInServerMode": "Der aktuelle Bereitstellungsmodus unterstützt das Hochladen von Nicht-Bilddateien nicht. Um Dateien im {{ext}}-Format hochzuladen, wechseln Sie bitte zum Serverdatenbank-Bereitstellungsmodus oder verwenden Sie den LobeChat Cloud-Dienst.",
"title": "Dateiupload fehlgeschlagen. Bitte überprüfen Sie Ihre Netzwerkverbindung und versuchen Sie es später erneut."
"networkError": "Bitte überprüfen Sie, ob Ihre Internetverbindung stabil ist, und prüfen Sie die Cross-Origin-Konfiguration des Dateispeicherdienstes.",
"title": "Dateiupload fehlgeschlagen. Bitte überprüfen Sie Ihre Netzwerkverbindung und versuchen Sie es später erneut.",
"unknownError": "Fehlerursache: {{reason}}",
"uploadFailed": "Der Datei-Upload ist fehlgeschlagen."
}
}
5 changes: 4 additions & 1 deletion locales/en-US/error.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"upload": {
"desc": "Details: {{detail}}",
"fileOnlySupportInServerMode": "The current deployment mode does not support uploading non-image files. To upload files in {{ext}} format, please switch to server database deployment or use LobeChat Cloud service.",
"title": "File upload failed. Please check your network connection or try again later"
"networkError": "Please check your network connection and ensure that the file storage service's cross-origin configuration is correct.",
"title": "File upload failed. Please check your network connection or try again later",
"unknownError": "Error reason: {{reason}}",
"uploadFailed": "File upload failed."
}
}
Loading

0 comments on commit a6326a8

Please sign in to comment.