mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-17 04:55:51 +00:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d74daf6c68 | |||
| 87f2fd91b7 | |||
| 093c24f119 | |||
| bcf8628087 | |||
| 0160fbde83 | |||
| 12b1d56e33 | |||
| 8e3d3dbb1b | |||
| 55abddc532 | |||
| bae270e7da | |||
| 22283a43de | |||
| 5664b84ba8 | |||
| 404c5776be | |||
| 26ce317313 | |||
| 3110e2c356 | |||
| 3a955e600f | |||
| 90a5935670 | |||
| d450dd9742 | |||
| e1666a57e4 | |||
| 3a7862f7f5 | |||
| 9ac84e6ac8 | |||
| 4e8b3e8fa8 | |||
| c8694b5c7d | |||
| 9de773ba7d | |||
| 8443904600 | |||
| c628b8aade | |||
| 06d41e5153 | |||
| c0f9875195 | |||
| a8b042f406 | |||
| af234ac25c | |||
| 95a7011437 | |||
| 98cf57bc2c | |||
| 32c0623770 | |||
| f223a12e8f | |||
| ad51305f19 | |||
| 70e1d995c5 | |||
| 44549b9856 |
@@ -307,9 +307,6 @@ OPENAI_API_KEY=sk-xxxxxxxxx
|
||||
# Shared between Better-Auth and Next-Auth
|
||||
# AUTH_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
|
||||
# Auth URL (accessible from browser, optional if same domain)
|
||||
# NEXT_PUBLIC_AUTH_URL=http://localhost:3210
|
||||
|
||||
# Require email verification before allowing users to sign in (default: false)
|
||||
# Set to '1' to force users to verify their email before signing in
|
||||
# NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION=0
|
||||
|
||||
@@ -43,9 +43,6 @@ NEXT_PUBLIC_ENABLE_BETTER_AUTH=1
|
||||
# Better Auth secret for JWT signing (generate with: openssl rand -base64 32)
|
||||
AUTH_SECRET=${UNSAFE_SECRET}
|
||||
|
||||
# Authentication URL
|
||||
NEXT_PUBLIC_AUTH_URL=${APP_URL}
|
||||
|
||||
# SSO providers configuration - using Casdoor for development
|
||||
AUTH_SSO_PROVIDERS=casdoor
|
||||
|
||||
|
||||
+268
@@ -2,6 +2,274 @@
|
||||
|
||||
# Changelog
|
||||
|
||||
## [Version 2.0.0-next.335](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.334...v2.0.0-next.335)
|
||||
|
||||
<sup>Released on **2026-01-22**</sup>
|
||||
|
||||
#### ✨ Features
|
||||
|
||||
- **database**: Added user memory activity.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's improved
|
||||
|
||||
- **database**: Added user memory activity, closes [#11680](https://github.com/lobehub/lobe-chat/issues/11680) ([0160fbd](https://github.com/lobehub/lobe-chat/commit/0160fbd))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.334](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.333...v2.0.0-next.334)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### ✨ Features
|
||||
|
||||
- **misc**: Add platform-aware download client menu option.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's improved
|
||||
|
||||
- **misc**: Add platform-aware download client menu option, closes [#11676](https://github.com/lobehub/lobe-chat/issues/11676) ([55abddc](https://github.com/lobehub/lobe-chat/commit/55abddc))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.333](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.332...v2.0.0-next.333)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### ✨ Features
|
||||
|
||||
- **desktop**: Add legacy local database detection and migration guidance.
|
||||
- **misc**: Update the sandbox preinstall libs in sys role.
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Fix multi tasks no summary issue.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's improved
|
||||
|
||||
- **desktop**: Add legacy local database detection and migration guidance, closes [#11682](https://github.com/lobehub/lobe-chat/issues/11682) ([5664b84](https://github.com/lobehub/lobe-chat/commit/5664b84))
|
||||
- **misc**: Update the sandbox preinstall libs in sys role, closes [#11688](https://github.com/lobehub/lobe-chat/issues/11688) ([404c577](https://github.com/lobehub/lobe-chat/commit/404c577))
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Fix multi tasks no summary issue, closes [#11685](https://github.com/lobehub/lobe-chat/issues/11685) ([26ce317](https://github.com/lobehub/lobe-chat/commit/26ce317))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.332](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.331...v2.0.0-next.332)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Improve e2e server and complete i18n resources.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Improve e2e server and complete i18n resources, closes [#11678](https://github.com/lobehub/lobe-chat/issues/11678) ([d450dd9](https://github.com/lobehub/lobe-chat/commit/d450dd9))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.331](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.330...v2.0.0-next.331)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Slove the agent group editor not focus in editdata area.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Slove the agent group editor not focus in editdata area, closes [#11677](https://github.com/lobehub/lobe-chat/issues/11677) ([9ac84e6](https://github.com/lobehub/lobe-chat/commit/9ac84e6))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.330](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.329...v2.0.0-next.330)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Fix multi agent tasks issue.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Fix multi agent tasks issue, closes [#11672](https://github.com/lobehub/lobe-chat/issues/11672) ([9de773b](https://github.com/lobehub/lobe-chat/commit/9de773b))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.329](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.328...v2.0.0-next.329)
|
||||
|
||||
<sup>Released on **2026-01-21**</sup>
|
||||
|
||||
#### ♻ Code Refactoring
|
||||
|
||||
- **auth**: Remove NEXT_PUBLIC_AUTH_URL env variable.
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **misc**: Sloved the old removeSessionTopics not work.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### Code refactoring
|
||||
|
||||
- **auth**: Remove NEXT_PUBLIC_AUTH_URL env variable, closes [#11658](https://github.com/lobehub/lobe-chat/issues/11658) ([c0f9875](https://github.com/lobehub/lobe-chat/commit/c0f9875))
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **misc**: Sloved the old removeSessionTopics not work, closes [#11671](https://github.com/lobehub/lobe-chat/issues/11671) ([06d41e5](https://github.com/lobehub/lobe-chat/commit/06d41e5))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.328](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.327...v2.0.0-next.328)
|
||||
|
||||
<sup>Released on **2026-01-20**</sup>
|
||||
|
||||
#### ✨ Features
|
||||
|
||||
- **misc**: Support client tasks mode.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's improved
|
||||
|
||||
- **misc**: Support client tasks mode, closes [#11666](https://github.com/lobehub/lobe-chat/issues/11666) ([98cf57b](https://github.com/lobehub/lobe-chat/commit/98cf57b))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.327](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.326...v2.0.0-next.327)
|
||||
|
||||
<sup>Released on **2026-01-20**</sup>
|
||||
|
||||
#### ♻ Code Refactoring
|
||||
|
||||
- **model-select**: Migrate FunctionCallingModelSelect to LobeSelect.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### Code refactoring
|
||||
|
||||
- **model-select**: Migrate FunctionCallingModelSelect to LobeSelect, closes [#11664](https://github.com/lobehub/lobe-chat/issues/11664) ([ad51305](https://github.com/lobehub/lobe-chat/commit/ad51305))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.326](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.325...v2.0.0-next.326)
|
||||
|
||||
<sup>Released on **2026-01-20**</sup>
|
||||
|
||||
#### 🐛 Bug Fixes
|
||||
|
||||
- **desktop**: Gracefully handle missing update manifest 404 errors.
|
||||
|
||||
<br/>
|
||||
|
||||
<details>
|
||||
<summary><kbd>Improvements and Fixes</kbd></summary>
|
||||
|
||||
#### What's fixed
|
||||
|
||||
- **desktop**: Gracefully handle missing update manifest 404 errors, closes [#11625](https://github.com/lobehub/lobe-chat/issues/11625) ([13e95b9](https://github.com/lobehub/lobe-chat/commit/13e95b9))
|
||||
|
||||
</details>
|
||||
|
||||
<div align="right">
|
||||
|
||||
[](#readme-top)
|
||||
|
||||
</div>
|
||||
|
||||
## [Version 2.0.0-next.325](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.324...v2.0.0-next.325)
|
||||
|
||||
<sup>Released on **2026-01-20**</sup>
|
||||
|
||||
+1
-2
@@ -189,8 +189,7 @@ ENV KEY_VAULTS_SECRET="" \
|
||||
|
||||
# Better Auth
|
||||
ENV AUTH_SECRET="" \
|
||||
AUTH_SSO_PROVIDERS="" \
|
||||
NEXT_PUBLIC_AUTH_URL=""
|
||||
AUTH_SSO_PROVIDERS=""
|
||||
|
||||
# Clerk
|
||||
ENV CLERK_SECRET_KEY="" \
|
||||
|
||||
@@ -23,6 +23,9 @@ export const userDataDir = app.getPath('userData');
|
||||
|
||||
export const appStorageDir = join(userDataDir, 'lobehub-storage');
|
||||
|
||||
// Legacy local database directory used in older desktop versions
|
||||
export const legacyLocalDbDir = join(appStorageDir, 'lobehub-local-db');
|
||||
|
||||
// ------ Application storage directory ---- //
|
||||
|
||||
// Local storage files (simulating S3)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { ElectronAppState, ThemeMode } from '@lobechat/electron-client-ipc';
|
||||
import { app, dialog, nativeTheme, shell } from 'electron';
|
||||
import { macOS } from 'electron-is';
|
||||
import { pathExists, readdir } from 'fs-extra';
|
||||
import process from 'node:process';
|
||||
|
||||
import { legacyLocalDbDir } from '@/const/dir';
|
||||
import { createLogger } from '@/utils/logger';
|
||||
import {
|
||||
getAccessibilityStatus,
|
||||
@@ -214,6 +216,23 @@ export default class SystemController extends ControllerModule {
|
||||
return nativeTheme.themeSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect whether user used the legacy local database in older desktop versions.
|
||||
* Legacy path: {app.getPath('userData')}/lobehub-storage/lobehub-local-db
|
||||
*/
|
||||
@IpcMethod()
|
||||
async hasLegacyLocalDb(): Promise<boolean> {
|
||||
if (!(await pathExists(legacyLocalDbDir))) return false;
|
||||
|
||||
try {
|
||||
const entries = await readdir(legacyLocalDbDir);
|
||||
return entries.length > 0;
|
||||
} catch {
|
||||
// If directory exists but cannot be read, treat as "used" to surface guidance.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private async setSystemThemeMode(themeMode: ThemeMode) {
|
||||
nativeTheme.themeSource = themeMode;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ vi.mock('@/utils/logger', () => ({
|
||||
// Mock electron
|
||||
vi.mock('electron', () => ({
|
||||
app: {
|
||||
getAppPath: vi.fn(() => '/mock/app/path'),
|
||||
getLocale: vi.fn(() => 'en-US'),
|
||||
getPath: vi.fn((name: string) => `/mock/path/${name}`),
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@ vi.mock('electron', () => ({
|
||||
setApplicationMenu: vi.fn(),
|
||||
},
|
||||
app: {
|
||||
getAppPath: vi.fn(() => '/mock/app/path'),
|
||||
getName: vi.fn(() => 'LobeChat'),
|
||||
getPath: vi.fn((type: string) => {
|
||||
if (type === 'logs') return '/path/to/logs';
|
||||
|
||||
@@ -1,4 +1,69 @@
|
||||
[
|
||||
{
|
||||
"children": {},
|
||||
"date": "2026-01-22",
|
||||
"version": "2.0.0-next.335"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"features": ["Add platform-aware download client menu option."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.334"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"features": ["Update the sandbox preinstall libs in sys role."],
|
||||
"fixes": ["Fix multi tasks no summary issue."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.333"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Improve e2e server and complete i18n resources."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.332"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Slove the agent group editor not focus in editdata area."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.331"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Fix multi agent tasks issue."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.330"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"fixes": ["Sloved the old removeSessionTopics not work."]
|
||||
},
|
||||
"date": "2026-01-21",
|
||||
"version": "2.0.0-next.329"
|
||||
},
|
||||
{
|
||||
"children": {
|
||||
"features": ["Support client tasks mode."]
|
||||
},
|
||||
"date": "2026-01-20",
|
||||
"version": "2.0.0-next.328"
|
||||
},
|
||||
{
|
||||
"children": {},
|
||||
"date": "2026-01-20",
|
||||
"version": "2.0.0-next.327"
|
||||
},
|
||||
{
|
||||
"children": {},
|
||||
"date": "2026-01-20",
|
||||
"version": "2.0.0-next.326"
|
||||
},
|
||||
{
|
||||
"children": {},
|
||||
"date": "2026-01-20",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: LobeChat Plugin Ecosystem - Functionality Extensions and Development Resources
|
||||
description: >-
|
||||
Discover how the LobeChat plugin ecosystem enhances the utility and flexibility of the LobeChat assistant, along with the development resources and plugin development guidelines provided.
|
||||
|
||||
Discover how the LobeChat plugin ecosystem enhances the utility and
|
||||
flexibility of the LobeChat assistant, along with the development resources
|
||||
and plugin development guidelines provided.
|
||||
tags:
|
||||
- LobeChat
|
||||
- Plugins
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
---
|
||||
title: >-
|
||||
LobeChat Supports Multimodal Interaction: Visual Recognition Enhances Intelligent Dialogue
|
||||
|
||||
LobeChat Supports Multimodal Interaction: Visual Recognition Enhances
|
||||
Intelligent Dialogue
|
||||
description: >-
|
||||
LobeChat supports various large language models with visual recognition capabilities, allowing users to upload or drag and drop images. The assistant will recognize the content and engage in intelligent dialogue, creating a more intelligent and diverse chat environment.
|
||||
|
||||
LobeChat supports various large language models with visual recognition
|
||||
capabilities, allowing users to upload or drag and drop images. The assistant
|
||||
will recognize the content and engage in intelligent dialogue, creating a more
|
||||
intelligent and diverse chat environment.
|
||||
tags:
|
||||
- Visual Recognition
|
||||
- LobeChat
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: LobeChat Text-to-Image Generation Technology
|
||||
description: >-
|
||||
LobeChat supports Text-to-Speech (TTS) and Speech-to-Text (STT) technologies, offering high-quality voice options for a personalized communication experience. Learn more about Lobe TTS Toolkit.
|
||||
|
||||
LobeChat supports Text-to-Speech (TTS) and Speech-to-Text (STT) technologies,
|
||||
offering high-quality voice options for a personalized communication
|
||||
experience. Learn more about Lobe TTS Toolkit.
|
||||
tags:
|
||||
- TTS
|
||||
- STT
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
---
|
||||
title: 'LobeChat Text-to-Image: Text-to-Image Generation Technology'
|
||||
description: >-
|
||||
LobeChat now supports the latest text-to-image generation technology, allowing users to directly invoke the text-to-image tool during conversations with the assistant for creative purposes. By utilizing AI tools such as DALL-E 3, MidJourney, and Pollinations, assistants can turn your ideas into images, making the creative process more intimate and immersive.
|
||||
|
||||
LobeChat now supports the latest text-to-image generation technology, allowing
|
||||
users to directly invoke the text-to-image tool during conversations with the
|
||||
assistant for creative purposes. By utilizing AI tools such as DALL-E 3,
|
||||
MidJourney, and Pollinations, assistants can turn your ideas into images,
|
||||
making the creative process more intimate and immersive.
|
||||
tags:
|
||||
- Text-to-Image
|
||||
- LobeChat
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat 文生图:文本转图片生成技术
|
||||
description: >-
|
||||
LobeChat 现在支持最新的文本到图片生成技术,让用户可以在与助手对话中直接调用文生图工具进行创作。利用 DALL-E 3、MidJourney 和 Pollinations 等 AI 工具,助手们可以将你的想法转化为图像,让创作过程更私密和沉浸式。
|
||||
|
||||
LobeChat 现在支持最新的文本到图片生成技术,让用户可以在与助手对话中直接调用文生图工具进行创作。利用 DALL-E 3、MidJourney 和
|
||||
Pollinations 等 AI 工具,助手们可以将你的想法转化为图像,让创作过程更私密和沉浸式。
|
||||
tags:
|
||||
- Text to Image
|
||||
- 文生图
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat Supports Multi-User Management with Clerk and Next-Auth
|
||||
description: >-
|
||||
LobeChat offers various user authentication and management solutions, including Clerk and Next-Auth, to meet the diverse needs of different users.
|
||||
|
||||
LobeChat offers various user authentication and management solutions,
|
||||
including Clerk and Next-Auth, to meet the diverse needs of different users.
|
||||
tags:
|
||||
- User Management
|
||||
- Next-Auth
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: 'LobeChat 1.0: New Architecture and New Possibilities'
|
||||
description: >-
|
||||
LobeChat 1.0 brings a brand-new architecture and features for server-side databases and user authentication management, opening up new possibilities. On this basis, LobeChat Cloud has entered beta testing.
|
||||
|
||||
LobeChat 1.0 brings a brand-new architecture and features for server-side
|
||||
databases and user authentication management, opening up new possibilities. On
|
||||
this basis, LobeChat Cloud has entered beta testing.
|
||||
tags:
|
||||
- LobeChat
|
||||
- Version 1.0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat 1.0:新的架构与新的可能
|
||||
description: >-
|
||||
LobeChat 1.0 带来了服务端数据库、用户鉴权管理的全新架构与特性,开启了新的可能 。在此基础上, LobeChat Cloud 开启 Beta 版测试。
|
||||
|
||||
LobeChat 1.0 带来了服务端数据库、用户鉴权管理的全新架构与特性,开启了新的可能 。在此基础上, LobeChat Cloud 开启 Beta
|
||||
版测试。
|
||||
tags:
|
||||
- LobeChat
|
||||
- 服务端数据库
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: 'LobeChat Fully Enters the GPT-4 Era: GPT-4o Mini Officially Launched'
|
||||
description: >-
|
||||
LobeChat v1.6 has been released with support for GPT-4o mini, while LobeChat Cloud services have been fully upgraded to provide users with a more powerful AI conversation experience.
|
||||
|
||||
LobeChat v1.6 has been released with support for GPT-4o mini, while LobeChat
|
||||
Cloud services have been fully upgraded to provide users with a more powerful
|
||||
AI conversation experience.
|
||||
tags:
|
||||
- LobeChat
|
||||
- GPT-4o Mini
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat 全面进入 GPT-4 时代:GPT-4o mini 正式上线
|
||||
description: >-
|
||||
LobeChat v1.6 重磅发布 GPT-4o mini 支持,同时 LobeChat Cloud 服务全面升级默认模型,为用户带来更强大的 AI 对话体验。
|
||||
|
||||
LobeChat v1.6 重磅发布 GPT-4o mini 支持,同时 LobeChat Cloud 服务全面升级默认模型,为用户带来更强大的 AI
|
||||
对话体验。
|
||||
tags:
|
||||
- LobeChat
|
||||
- GPT-4o mini
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: LobeChat Database Docker Image Official Release
|
||||
description: >-
|
||||
LobeChat v1.8.0 launches the official database Docker image, supporting cloud data synchronization and user management, along with comprehensive self-deployment documentation.
|
||||
|
||||
LobeChat v1.8.0 launches the official database Docker image, supporting cloud
|
||||
data synchronization and user management, along with comprehensive
|
||||
self-deployment documentation.
|
||||
tags:
|
||||
- LobeChat
|
||||
- Docker Image
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
---
|
||||
title: >-
|
||||
LobeChat Launches Knowledge Base Feature: A New Experience in Intelligent File Management and Dialogue
|
||||
|
||||
LobeChat Launches Knowledge Base Feature: A New Experience in Intelligent File
|
||||
Management and Dialogue
|
||||
description: >-
|
||||
LobeChat introduces a brand new knowledge base feature that supports all types of file management, intelligent vectorization, and file dialogue, making knowledge management and information retrieval easier and smarter.
|
||||
|
||||
LobeChat introduces a brand new knowledge base feature that supports all types
|
||||
of file management, intelligent vectorization, and file dialogue, making
|
||||
knowledge management and information retrieval easier and smarter.
|
||||
tags:
|
||||
- LobeChat
|
||||
- Knowledge Base
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat Perfectly Adapts to OpenAI O1 Series Models
|
||||
description: >-
|
||||
LobeChat v1.17.0 now supports OpenAI's latest o1-preview and o1-mini models, bringing users enhanced coding and mathematical capabilities.
|
||||
|
||||
LobeChat v1.17.0 now supports OpenAI's latest o1-preview and o1-mini models,
|
||||
bringing users enhanced coding and mathematical capabilities.
|
||||
tags:
|
||||
- OpenAI O1
|
||||
- LobeChat
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: 'Major Update: LobeChat Enters the Era of Artifacts'
|
||||
description: >-
|
||||
LobeChat v1.19 brings significant updates, including full feature support for Claude Artifacts, a brand new discovery page design, and support for GitHub Models providers, greatly enhancing the capabilities of the AI assistant.
|
||||
|
||||
LobeChat v1.19 brings significant updates, including full feature support for
|
||||
Claude Artifacts, a brand new discovery page design, and support for GitHub
|
||||
Models providers, greatly enhancing the capabilities of the AI assistant.
|
||||
tags:
|
||||
- LobeChat
|
||||
- AI Assistant
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: 重磅更新:LobeChat 迎来 Artifacts 时代
|
||||
description: >-
|
||||
LobeChat v1.19 带来了重大更新,包括 Claude Artifacts 完整特性支持、全新的发现页面设计,以及 GitHub Models 服务商支持,让 AI 助手的能力得到显著提升。
|
||||
|
||||
LobeChat v1.19 带来了重大更新,包括 Claude Artifacts 完整特性支持、全新的发现页面设计,以及 GitHub Models
|
||||
服务商支持,让 AI 助手的能力得到显著提升。
|
||||
tags:
|
||||
- LobeChat
|
||||
- Artifacts
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: LobeChat Introduces Persistent Assistant Sidebar Feature
|
||||
description: >-
|
||||
LobeChat v1.26.0 launches the persistent assistant sidebar feature, supporting quick key switching for easy access to frequently used assistants, significantly enhancing efficiency.
|
||||
|
||||
LobeChat v1.26.0 launches the persistent assistant sidebar feature, supporting
|
||||
quick key switching for easy access to frequently used assistants,
|
||||
significantly enhancing efficiency.
|
||||
tags:
|
||||
- Persistent Assistant
|
||||
- Sidebar Feature
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
---
|
||||
title: LobeChat Supports Sharing Conversations in Text Format (Markdown/JSON)
|
||||
description: >-
|
||||
LobeChat v1.28.0 introduces support for exporting conversations in Markdown and OpenAI format JSON, making it easy to convert conversation content into note materials, development debugging data, and training corpora, significantly enhancing the reusability of conversation content.
|
||||
|
||||
LobeChat v1.28.0 introduces support for exporting conversations in Markdown
|
||||
and OpenAI format JSON, making it easy to convert conversation content into
|
||||
note materials, development debugging data, and training corpora,
|
||||
significantly enhancing the reusability of conversation content.
|
||||
tags:
|
||||
- Text Format Export
|
||||
- Markdown Export
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat 支持分享对话为文本格式(Markdown/JSON)
|
||||
description: >-
|
||||
LobeChat v1.28.0 新增 Markdown 和 OpenAI 格式 JSON 导出支持,让对话内容能轻松转化为笔记素材、开发调试数据和训练语料,显著提升对话内容的复用价值。
|
||||
|
||||
LobeChat v1.28.0 新增 Markdown 和 OpenAI 格式 JSON
|
||||
导出支持,让对话内容能轻松转化为笔记素材、开发调试数据和训练语料,显著提升对话内容的复用价值。
|
||||
tags:
|
||||
- 对话内容
|
||||
- Markdown导出
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: New Model Providers Added to LobeChat in November
|
||||
description: >-
|
||||
LobeChat model providers now support Gitee AI, InternLM (ShuSheng PuYu), xAI, and Cloudflare WorkersAI
|
||||
|
||||
LobeChat model providers now support Gitee AI, InternLM (ShuSheng PuYu), xAI,
|
||||
and Cloudflare WorkersAI
|
||||
tags:
|
||||
- LobeChat
|
||||
- AI Model Providers
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat Supports Branching Conversations
|
||||
description: >-
|
||||
LobeChat now allows you to create new conversation branches from any message, freeing your thoughts.
|
||||
|
||||
LobeChat now allows you to create new conversation branches from any message,
|
||||
freeing your thoughts.
|
||||
tags:
|
||||
- Branching Conversations
|
||||
- LobeChat
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat Supports User Data Statistics and Activity Sharing
|
||||
description: >-
|
||||
LobeChat now supports multi-dimensional user data statistics and activity sharing
|
||||
|
||||
LobeChat now supports multi-dimensional user data statistics and activity
|
||||
sharing
|
||||
tags:
|
||||
- LobeChat
|
||||
- User Statistics
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: LobeChat Launches New AI Provider Management System
|
||||
description: >-
|
||||
LobeChat has revamped its AI Provider Management System, now supporting custom AI providers and models.
|
||||
|
||||
LobeChat has revamped its AI Provider Management System, now supporting custom
|
||||
AI providers and models.
|
||||
tags:
|
||||
- LobeChat
|
||||
- AI Provider
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
---
|
||||
title: >-
|
||||
LobeChat Integrates DeepSeek R1, Bringing a Revolutionary Chain of Thought Experience
|
||||
|
||||
LobeChat Integrates DeepSeek R1, Bringing a Revolutionary Chain of Thought
|
||||
Experience
|
||||
description: >-
|
||||
LobeChat v1.49.12 fully supports the DeepSeek R1 model, providing users with an unprecedented interactive experience in the chain of thought.
|
||||
|
||||
LobeChat v1.49.12 fully supports the DeepSeek R1 model, providing users with
|
||||
an unprecedented interactive experience in the chain of thought.
|
||||
tags:
|
||||
- LobeChat
|
||||
- DeepSeek
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: New Authentication Provider Guide
|
||||
---
|
||||
|
||||
# New Authentication Provider Guide
|
||||
|
||||
LobeChat uses [Auth.js v5](https://authjs.dev/) as the external authentication service. Auth.js is an open-source authentication library that provides a simple way to implement authentication and authorization features. This document will introduce how to use Auth.js to implement a new authentication provider.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 新身份验证方式开发指南
|
||||
---
|
||||
|
||||
# 新身份验证方式开发指南
|
||||
|
||||
LobeChat 使用 [Auth.js v5](https://authjs.dev/) 作为外部身份验证服务。Auth.js 是一个开源的身份验证库,它提供了一种简单的方式来实现身份验证和授权功能。本文档将介绍如何使用 Auth.js 来实现新的身份验证方式。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Adding New Image Models
|
||||
---
|
||||
|
||||
# Adding New Image Models
|
||||
|
||||
> Learn more about the AI image generation modal design in the [AI Image Generation Modal Design Discussion](https://github.com/lobehub/lobe-chat/discussions/7442)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 添加新的图像模型
|
||||
---
|
||||
|
||||
# 添加新的图像模型
|
||||
|
||||
> 了解更多关于 AI 绘画模态的设计,请参考 [AI 绘画模态设计讨论](https://github.com/lobehub/lobe-chat/discussions/7442)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Architecture Design
|
||||
---
|
||||
|
||||
# Architecture Design
|
||||
|
||||
LobeChat is an AI chat application built on the Next.js framework, aiming to provide an AI productivity platform that enables users to interact with AI through natural language. The following is an overview of the architecture design of LobeChat:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 架构设计
|
||||
---
|
||||
|
||||
# 架构设计
|
||||
|
||||
LobeChat 是一个基于 Next.js 框架构建的 AI 聊天应用,旨在提供一个 AI 生产力平台,使用户能够与 AI 进行自然语言交互。以下是 LobeChat 的架构设计介稿:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Lobe Chat API Client-Server Interaction Logic
|
||||
---
|
||||
|
||||
# Lobe Chat API Client-Server Interaction Logic
|
||||
|
||||
This document explains the implementation logic of Lobe Chat API in client-server interactions, including event sequences and core components involved.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Lobe Chat API 前后端交互逻辑
|
||||
---
|
||||
|
||||
# Lobe Chat API 前后端交互逻辑
|
||||
|
||||
本文档说明了 Lobe Chat API 在前后端交互中的实现逻辑,包括事件序列和涉及的核心组件。
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
---
|
||||
title: ComfyUI Extension Development Guide
|
||||
description: Learn how to add new models, workflows, and features to LobeChat's ComfyUI integration
|
||||
description: >-
|
||||
Learn how to add new models, workflows, and features to LobeChat's ComfyUI
|
||||
integration
|
||||
tags:
|
||||
- ComfyUI
|
||||
- Development Guide
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Code Style and Contribution Guidelines
|
||||
---
|
||||
|
||||
# Code Style and Contribution Guidelines
|
||||
|
||||
Welcome to the Code Style and Contribution Guidelines for LobeChat. This guide will help you understand our code standards and contribution process, ensuring code consistency and smooth project progression.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 代码风格与贡献指南
|
||||
---
|
||||
|
||||
# 代码风格与贡献指南
|
||||
|
||||
欢迎来到 LobeChat 的代码风格与贡献指南。本指南将帮助您理解我们的代码规范和贡献流程,确保代码的一致性和项目的顺利进行。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: How to Develop a New Feature
|
||||
---
|
||||
|
||||
# How to Develop a New Feature
|
||||
|
||||
LobeChat is built on the Next.js framework and uses TypeScript as the primary development language. When developing a new feature, we need to follow a certain development process to ensure the quality and stability of the code. The general process can be divided into the following five steps:
|
||||
@@ -76,7 +80,8 @@ const ChatPage = () => {
|
||||
renderItem={(message) => (
|
||||
<List.Item>
|
||||
<Typography.Text>{message.content}</Typography.Text>
|
||||
</List.Item>
|
||||
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -86,6 +91,7 @@ export default ChatPage;
|
||||
```
|
||||
|
||||
> **Note on Feature Organization**: LobeChat uses two patterns for organizing features:
|
||||
>
|
||||
> - **Global features** (`src/features/`): Shared components like `ChatInput`, `Conversation` used across the app
|
||||
> - **Page-specific features** (`src/app/<page>/features/`): Components used only within a specific page route
|
||||
>
|
||||
@@ -113,11 +119,13 @@ const ChatPage = () => {
|
||||
renderItem={(message) => (
|
||||
<List.Item>
|
||||
<Typography.Text>{message.content}</Typography.Text>
|
||||
</List.Item>
|
||||
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<Button onClick={handleSend}>Send</Button>
|
||||
</>
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 如何开发一个新功能:前端实现
|
||||
---
|
||||
|
||||
# 如何开发一个新功能:前端实现
|
||||
|
||||
LobeChat 基于 Next.js 框架构建,使用 TypeScript 作为主要开发语言。在开发新功能时,我们需要遵循一定的开发流程,以确保代码的质量和稳定性。大致的流程分为以下五步:
|
||||
@@ -76,7 +80,8 @@ const ChatPage = () => {
|
||||
renderItem={(message) => (
|
||||
<List.Item>
|
||||
<Typography.Text>{message.content}</Typography.Text>
|
||||
</List.Item>
|
||||
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
@@ -86,6 +91,7 @@ export default ChatPage;
|
||||
```
|
||||
|
||||
> **关于功能组件组织方式的说明**:LobeChat 使用两种模式来组织功能组件:
|
||||
>
|
||||
> - **全局功能**(`src/features/`):跨应用共享的组件,如 `ChatInput`、`Conversation` 等
|
||||
> - **页面专属功能**(`src/app/<page>/features/`):仅在特定页面路由中使用的组件
|
||||
>
|
||||
@@ -113,11 +119,13 @@ const ChatPage = () => {
|
||||
renderItem={(message) => (
|
||||
<List.Item>
|
||||
<Typography.Text>{message.content}</Typography.Text>
|
||||
</List.Item>
|
||||
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
<Button onClick={handleSend}>Send</Button>
|
||||
</>
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: LobeChat Feature Development Complete Guide
|
||||
---
|
||||
|
||||
# LobeChat Feature Development Complete Guide
|
||||
|
||||
This document aims to guide developers on how to develop a complete feature in LobeChat.
|
||||
@@ -362,7 +366,8 @@ const OpeningQuestions = memo(() => {
|
||||
{isRepeat && (
|
||||
<p className={styles.repeatError}>{t('settingOpening.openingQuestions.repeat')}</p>
|
||||
)}
|
||||
</Flexbox>
|
||||
|
||||
</Flexbox>
|
||||
|
||||
<div className={styles.questionsList}>
|
||||
{openingQuestions.length > 0 ? (
|
||||
@@ -378,7 +383,8 @@ const OpeningQuestions = memo(() => {
|
||||
onClick={() => removeQuestion(item.content)}
|
||||
type="text"
|
||||
/>
|
||||
</SortableList.Item>
|
||||
|
||||
</SortableList.Item>
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
@@ -387,8 +393,10 @@ const OpeningQuestions = memo(() => {
|
||||
description={t('settingOpening.openingQuestions.empty')}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Flexbox>
|
||||
|
||||
</div>
|
||||
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -440,7 +448,8 @@ const WelcomeMessage = () => {
|
||||
{chatItem}
|
||||
{/* Render guiding questions */}
|
||||
<OpeningQuestions mobile={mobile} questions={openingQuestions} />
|
||||
</Flexbox>
|
||||
|
||||
</Flexbox>
|
||||
) : (
|
||||
chatItem
|
||||
);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: LobeChat 功能开发完全指南
|
||||
---
|
||||
|
||||
# LobeChat 功能开发完全指南
|
||||
|
||||
本文档旨在指导开发者了解如何在 LobeChat 中开发一块完整的功能需求。
|
||||
@@ -362,7 +366,8 @@ const OpeningQuestions = memo(() => {
|
||||
{isRepeat && (
|
||||
<p className={styles.repeatError}>{t('settingOpening.openingQuestions.repeat')}</p>
|
||||
)}
|
||||
</Flexbox>
|
||||
|
||||
</Flexbox>
|
||||
|
||||
<div className={styles.questionsList}>
|
||||
{openingQuestions.length > 0 ? (
|
||||
@@ -378,7 +383,8 @@ const OpeningQuestions = memo(() => {
|
||||
onClick={() => removeQuestion(item.content)}
|
||||
type="text"
|
||||
/>
|
||||
</SortableList.Item>
|
||||
|
||||
</SortableList.Item>
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
@@ -387,8 +393,10 @@ const OpeningQuestions = memo(() => {
|
||||
description={t('settingOpening.openingQuestions.empty')}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Flexbox>
|
||||
|
||||
</div>
|
||||
|
||||
</Flexbox>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -440,7 +448,8 @@ const WelcomeMessage = () => {
|
||||
{chatItem}
|
||||
{/* 渲染引导性问题 */}
|
||||
<OpeningQuestions mobile={mobile} questions={openingQuestions} />
|
||||
</Flexbox>
|
||||
|
||||
</Flexbox>
|
||||
) : (
|
||||
chatItem
|
||||
);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Directory Structure
|
||||
---
|
||||
|
||||
# Directory Structure
|
||||
|
||||
The directory structure of LobeChat is as follows:
|
||||
@@ -73,17 +77,20 @@ app
|
||||
### Architecture Explanation
|
||||
|
||||
**Route Groups:**
|
||||
|
||||
- `(backend)` - Contains all server-side API routes, middleware, and backend services
|
||||
- `[variants]` - Dynamic route group handling different platform variants and main application pages
|
||||
- `@modal` - Parallel routes for modal dialogs using Next.js parallel routing
|
||||
|
||||
**Platform Organization:**
|
||||
|
||||
- The architecture supports multiple platforms (web, desktop, mobile) through route organization
|
||||
- Desktop-specific routes are in the `desktop/` directory
|
||||
- Mobile-specific routes are organized under `(main)/(mobile)/`
|
||||
- Shared layouts and components are in `_layout/` directories
|
||||
|
||||
**API Architecture:**
|
||||
|
||||
- REST APIs in `(backend)/api/` and `(backend)/webapi/`
|
||||
- tRPC endpoints organized by runtime environment (edge, lambda, async, desktop)
|
||||
- Authentication and OIDC handling in dedicated route groups
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 目录架构
|
||||
---
|
||||
|
||||
# 目录架构
|
||||
|
||||
LobeChat 的文件夹目录架构如下:
|
||||
@@ -73,17 +77,20 @@ app
|
||||
### 架构说明
|
||||
|
||||
**路由组:**
|
||||
|
||||
- `(backend)` - 包含所有服务端 API 路由、中间件和后端服务
|
||||
- `[variants]` - 处理不同平台变体和主应用页面的动态路由组
|
||||
- `@modal` - 使用 Next.js 并行路由的模态框对话框并行路由
|
||||
|
||||
**平台组织:**
|
||||
|
||||
- 架构通过路由组织支持多个平台(Web、桌面端、移动端)
|
||||
- 桌面端专用路由位于 `desktop/` 目录中
|
||||
- 移动端专用路由组织在 `(main)/(mobile)/` 下
|
||||
- 共享布局和组件位于 `_layout/` 目录中
|
||||
|
||||
**API 架构:**
|
||||
|
||||
- `(backend)/api/` 和 `(backend)/webapi/` 中的 REST API
|
||||
- 按运行时环境组织的 tRPC 端点(edge、lambda、async、desktop)
|
||||
- 专用路由组中的身份验证和 OIDC 处理
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Resources and References
|
||||
---
|
||||
|
||||
# Resources and References
|
||||
|
||||
The design and development of LobeChat would not have been possible without the excellent projects in the community and ecosystem. We have used or referred to some outstanding resources and guides in the design and development process. Here are some key reference resources for developers to refer to during the development and learning process:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 资源与参考
|
||||
---
|
||||
|
||||
# 资源与参考
|
||||
|
||||
LobeChat 的设计和开发离不开社区和生态中的优秀项目。我们在设计和开发过程中使用或参考了一些优秀的资源和指南。以下是一些主要的参考资源,供开发者在开发和学习过程中参考:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Environment Setup Guide
|
||||
---
|
||||
|
||||
# Environment Setup Guide
|
||||
|
||||
Welcome to the LobeChat development environment setup guide.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 环境设置指南
|
||||
---
|
||||
|
||||
# 环境设置指南
|
||||
|
||||
欢迎阅读 LobeChat 的开发环境设置指南。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Testing Guide
|
||||
---
|
||||
|
||||
# Testing Guide
|
||||
|
||||
LobeChat's testing strategy includes unit testing and end-to-end (E2E) testing. Below are detailed explanations of each type of testing:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 测试指南
|
||||
---
|
||||
|
||||
# 测试指南
|
||||
|
||||
LobeChat 的测试策略包括单元测试和端到端 (E2E) 测试。下面是每种测试的详细说明:
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Work with Server-Side Database
|
||||
---
|
||||
|
||||
# Work with Server-Side Database
|
||||
|
||||
LobeChat provides a battery-included experience with its client-side database.
|
||||
@@ -19,7 +23,6 @@ cp docker-compose/local/.env.example docker-compose/local/.env
|
||||
|
||||
Edit `docker-compose/local/.env` as needed for your development setup. This file contains all necessary environment variables for the Docker services and configures:
|
||||
|
||||
- **Service Mode**: `NEXT_PUBLIC_SERVICE_MODE=server`
|
||||
- **Database**: PostgreSQL with connection string
|
||||
- **Authentication**: NextAuth with Casdoor SSO
|
||||
- **Storage**: MinIO S3-compatible storage
|
||||
@@ -80,7 +83,6 @@ The image generation feature requires:
|
||||
|
||||
- **PostgreSQL**: Stores metadata about generated images
|
||||
- **MinIO/S3**: Stores the actual image files
|
||||
- **Server Mode**: Required for file handling (`NEXT_PUBLIC_SERVICE_MODE=server`)
|
||||
|
||||
### Storage Configuration
|
||||
|
||||
@@ -138,14 +140,13 @@ await fetch(uploadUrl, {
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### Service URLs
|
||||
|
||||
When running with Docker Compose development setup:
|
||||
|
||||
- **PostgreSQL**: `postgres://postgres@localhost:5432/lobechat`
|
||||
- **MinIO API**: `http://localhost:9000`
|
||||
- **MinIO Console**: `http://localhost:9001` (admin/CHANGE_THIS_PASSWORD_IN_PRODUCTION)
|
||||
- **MinIO Console**: `http://localhost:9001` (admin/CHANGE\_THIS\_PASSWORD\_IN\_PRODUCTION)
|
||||
- **Application**: `http://localhost:3010`
|
||||
|
||||
### Reset Services
|
||||
@@ -164,7 +165,6 @@ docker-compose -f docker-compose.development.yml up -d
|
||||
pnpm db:migrate
|
||||
```
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
#### Port Conflicts
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 使用服务端数据库
|
||||
---
|
||||
|
||||
# 使用服务端数据库
|
||||
|
||||
LobeChat 提供了内置的客户端数据库体验。
|
||||
@@ -19,7 +23,6 @@ cp docker-compose/local/.env.example docker-compose/local/.env
|
||||
|
||||
根据需要编辑 `docker-compose/local/.env` 文件以适应你的开发设置。此文件包含 Docker 服务所需的所有环境变量,配置了:
|
||||
|
||||
- **服务模式**: `NEXT_PUBLIC_SERVICE_MODE=server`
|
||||
- **数据库**: 带连接字符串的 PostgreSQL
|
||||
- **身份验证**: 带 Casdoor SSO 的 NextAuth
|
||||
- **存储**: MinIO S3 兼容存储
|
||||
@@ -80,7 +83,6 @@ docker-compose -f docker-compose.development.yml ps
|
||||
|
||||
- **PostgreSQL**:存储生成图像的元数据
|
||||
- **MinIO/S3**:存储实际的图像文件
|
||||
- **服务器模式**:文件处理所需(`NEXT_PUBLIC_SERVICE_MODE=server`)
|
||||
|
||||
### 存储配置
|
||||
|
||||
@@ -138,14 +140,13 @@ await fetch(uploadUrl, {
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
### 服务地址
|
||||
|
||||
运行 Docker Compose 开发环境时:
|
||||
|
||||
- **PostgreSQL**:`postgres://postgres@localhost:5432/lobechat`
|
||||
- **MinIO API**:`http://localhost:9000`
|
||||
- **MinIO 控制台**:`http://localhost:9001` (admin/CHANGE_THIS_PASSWORD_IN_PRODUCTION)
|
||||
- **MinIO 控制台**:`http://localhost:9001` (admin/CHANGE\_THIS\_PASSWORD\_IN\_PRODUCTION)
|
||||
- **应用程序**:`http://localhost:3010`
|
||||
|
||||
### 重置服务
|
||||
@@ -164,7 +165,6 @@ docker-compose -f docker-compose.development.yml up -d
|
||||
pnpm db:migrate
|
||||
```
|
||||
|
||||
|
||||
### 故障排除
|
||||
|
||||
#### 端口冲突
|
||||
|
||||
@@ -1235,6 +1235,40 @@ table user_memories {
|
||||
}
|
||||
}
|
||||
|
||||
table user_memories_activities {
|
||||
id varchar(255) [pk, not null]
|
||||
user_id text
|
||||
user_memory_id varchar(255)
|
||||
metadata jsonb
|
||||
tags text[]
|
||||
type varchar(255) [not null]
|
||||
status varchar(255) [not null, default: 'pending']
|
||||
timezone varchar(255)
|
||||
starts_at "timestamp with time zone"
|
||||
ends_at "timestamp with time zone"
|
||||
associated_objects jsonb
|
||||
associated_subjects jsonb
|
||||
associated_locations jsonb
|
||||
notes text
|
||||
narrative text
|
||||
narrative_vector vector(1024)
|
||||
feedback text
|
||||
feedback_vector vector(1024)
|
||||
captured_at "timestamp with time zone" [not null, default: `now()`]
|
||||
accessed_at "timestamp with time zone" [not null, default: `now()`]
|
||||
created_at "timestamp with time zone" [not null, default: `now()`]
|
||||
updated_at "timestamp with time zone" [not null, default: `now()`]
|
||||
|
||||
indexes {
|
||||
narrative_vector [name: 'user_memories_activities_narrative_vector_index']
|
||||
feedback_vector [name: 'user_memories_activities_feedback_vector_index']
|
||||
type [name: 'user_memories_activities_type_index']
|
||||
user_id [name: 'user_memories_activities_user_id_index']
|
||||
user_memory_id [name: 'user_memories_activities_user_memory_id_index']
|
||||
status [name: 'user_memories_activities_status_index']
|
||||
}
|
||||
}
|
||||
|
||||
table user_memories_contexts {
|
||||
id varchar(255) [pk, not null]
|
||||
user_id text
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: New Locale Guide
|
||||
---
|
||||
|
||||
# New Locale Guide
|
||||
|
||||
LobeChat uses [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) as the i18n solution, which allows for quick addition of new language support in the application.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 新语种添加指南
|
||||
---
|
||||
|
||||
# 新语种添加指南
|
||||
|
||||
LobeChat 使用 [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) 作为 i18n 解决方案,可以在应用中快速添加新的语言支持。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Internationalization Implementation Guide
|
||||
---
|
||||
|
||||
# Internationalization Implementation Guide
|
||||
|
||||
Welcome to the LobeChat Internationalization Implementation Guide. This document will guide you through understanding the internationalization mechanism of LobeChat, including file structure and how to add new languages. LobeChat uses `i18next` and `lobe-i18n` as the internationalization solution, aiming to provide users with seamless multilingual support.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 国际化实现指南
|
||||
---
|
||||
|
||||
# 国际化实现指南
|
||||
|
||||
欢迎阅读 LobeChat 国际化实现指南。本文档将指导你了解 LobeChat 的国际化机制,包括文件结构、如何添加新语种。LobeChat 采用 `i18next` 和 `lobe-i18n` 作为国际化解决方案,旨在为用户提供流畅的多语言支持。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Lighthouse Reports
|
||||
---
|
||||
|
||||
# Lighthouse Reports
|
||||
|
||||
## Chat Page
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Lighthouse 测试报告
|
||||
---
|
||||
|
||||
# Lighthouse 测试报告
|
||||
|
||||
## Chat 聊天页面
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Technical Development Getting Started Guide
|
||||
---
|
||||
|
||||
# Technical Development Getting Started Guide
|
||||
|
||||
Welcome to the LobeChat Technical Development Getting Started Guide. LobeChat is an AI conversation application built on the Next.js framework, incorporating a range of technology stacks to achieve diverse functionalities and features. This guide will detail the main technical components of LobeChat and how to configure and use these technologies in your development environment.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 技术开发上手指南
|
||||
---
|
||||
|
||||
# 技术开发上手指南
|
||||
|
||||
欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Best Practices for State Management
|
||||
---
|
||||
|
||||
# Best Practices for State Management
|
||||
|
||||
LobeChat differs from traditional CRUD web applications in that it involves a large amount of rich interactive capabilities. Therefore, it is crucial to design a data flow architecture that is easy to develop and maintain. This document will introduce the best practices for data flow management in LobeChat.
|
||||
@@ -167,8 +171,6 @@ const createStore: StateCreator<SessionStore, [['zustand/devtools', never]]> = (
|
||||
...createSessionSlice(...parameters),
|
||||
});
|
||||
|
||||
|
||||
|
||||
// =============== Implement useStore ============ //
|
||||
|
||||
export const useSessionStore = createWithEqualityFn<SessionStore>()(
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 状态管理最佳实践
|
||||
---
|
||||
|
||||
# 状态管理最佳实践
|
||||
|
||||
LobeChat 不同于传统 CRUD 的网页,存在大量的富交互能力,如何设计一个易于开发与易于维护的数据流架构非常重要。本篇文档将介绍 LobeChat 中的数据流管理最佳实践。
|
||||
@@ -159,8 +163,6 @@ const createStore: StateCreator<SessionStore, [['zustand/devtools', never]]> = (
|
||||
...createSessionSlice(...parameters),
|
||||
});
|
||||
|
||||
|
||||
|
||||
// =============== 实装 useStore ============ //
|
||||
|
||||
export const useSessionStore = createWithEqualityFn<SessionStore>()(
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Data Store Selector
|
||||
---
|
||||
|
||||
# Data Store Selector
|
||||
|
||||
Selectors are data retrieval modules under the LobeChat data flow development framework. Their role is to extract data from the store using specific business logic for consumption by components.
|
||||
@@ -51,7 +55,8 @@ import { pluginSelectors } from '@/store/plugin/selectors';
|
||||
const Render = ({ plugins }) => {
|
||||
const list = usePluginStore(pluginSelectors.displayPluginList);
|
||||
|
||||
return <> ... </>;
|
||||
return <> ...
|
||||
</>;
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 数据存储取数模块
|
||||
---
|
||||
|
||||
# 数据存储取数模块
|
||||
|
||||
selectors 是 LobeChat 数据流研发框架下的取数模块,它的作用是从 store 中以特定特务逻辑取出数据,供组件消费使用。
|
||||
@@ -32,7 +36,8 @@ import { pluginSelectors } from '@/store/tool/selectors';
|
||||
const Render = () => {
|
||||
const list = useToolStore(pluginSelectors.installedPluginMetaList);
|
||||
|
||||
return <> ... </>;
|
||||
return <> ...
|
||||
</>;
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: 集成测试指南
|
||||
---
|
||||
|
||||
# 集成测试指南
|
||||
|
||||
## 概述
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Integrating Data Analytics Services in LobeChat for User Usage Analysis
|
||||
description: >-
|
||||
Learn how to integrate free/open-source data analytics services in LobeChat to collect user usage data efficiently.
|
||||
|
||||
Learn how to integrate free/open-source data analytics services in LobeChat to
|
||||
collect user usage data efficiently.
|
||||
tags:
|
||||
- LobeChat
|
||||
- data analytics
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
---
|
||||
title: LobeChat Authentication Service Configuration
|
||||
description: >-
|
||||
Learn how to configure external authentication services using Better Auth, Clerk, or Next Auth for centralized user authorization management. Supported authentication services include Auth0, Azure ID, etc.
|
||||
|
||||
tags:
|
||||
- Authentication Service
|
||||
- Better Auth
|
||||
- Next Auth
|
||||
- SSO
|
||||
- Clerk
|
||||
---
|
||||
|
||||
# Authentication Service
|
||||
|
||||
LobeChat supports the configuration of external authentication services using Better Auth, Clerk, or Next Auth for internal use within enterprises/organizations to centrally manage user authorization.
|
||||
|
||||
## Clerk
|
||||
|
||||
Clerk is a comprehensive identity verification solution that has recently gained popularity. It provides a simple yet powerful API and services to handle user authentication and session management. Clerk's design philosophy is to offer a concise and modern authentication solution that enables developers to easily integrate and use it.
|
||||
|
||||
LobeChat has deeply integrated with Clerk to provide users with a more secure and convenient login and registration experience. It also relieves developers from the burden of managing authentication logic. Clerk's concise and modern design philosophy aligns perfectly with LobeChat's goals, making user management on the entire platform more efficient and reliable.
|
||||
|
||||
By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` in LobeChat's environment, you can enable and use Clerk.
|
||||
|
||||
## Better Auth
|
||||
|
||||
[Better Auth](https://www.better-auth.com) is a modern, framework-agnostic authentication library designed to provide comprehensive, secure, and flexible authentication solutions. It supports various authentication methods including email/password, magic links, and multiple OAuth/SSO providers.
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Email/Password Authentication**: Built-in support for traditional email and password login with secure password hashing
|
||||
- **Email Verification**: Optional email verification flow with customizable email templates
|
||||
- **Magic Link Login**: Passwordless authentication via email magic links
|
||||
- **OAuth/SSO Support**: Integration with popular identity providers including Google, GitHub, Microsoft, AWS Cognito, and more
|
||||
- **Generic OIDC/OAuth**: Support for any OpenID Connect or OAuth 2.0 compliant provider
|
||||
|
||||
### Getting Started
|
||||
|
||||
To enable Better Auth in LobeChat, set the following environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_ENABLE_BETTER_AUTH` | Required | Set to `1` to enable Better Auth service |
|
||||
| `AUTH_SECRET` | Required | Key used to encrypt session tokens. Generate using: `openssl rand -base64 32` |
|
||||
| `NEXT_PUBLIC_AUTH_URL` | Required | The browser-accessible base URL for Better Auth (e.g., `http://localhost:3010`, `https://lobechat.com`). Optional for Vercel deployments (auto-detected from `VERCEL_URL`) |
|
||||
| `AUTH_SSO_PROVIDERS` | Optional | Comma-separated list of enabled SSO providers, e.g., `google,github,microsoft` |
|
||||
|
||||
<Callout type={'error'}>
|
||||
**Important**: Better Auth is currently only suitable for **fresh deployments**. If you are already using NextAuth or Clerk and have existing user data in your database, **do not switch to Better Auth yet**, otherwise existing users will not be able to log in.
|
||||
|
||||
We are developing user data migration tools from NextAuth/Clerk to Better Auth. Documentation will be updated once the migration solution is complete. For progress updates, please follow [GitHub Issue #10456](https://github.com/lobehub/lobe-chat/issues/10456).
|
||||
</Callout>
|
||||
|
||||
<Callout type={'warning'}>
|
||||
If you build/deploy with the official Docker image, the defaults keep **NextAuth enabled** and **Better
|
||||
Auth disabled** (`NEXT_PUBLIC_ENABLE_NEXT_AUTH=1`, `NEXT_PUBLIC_ENABLE_BETTER_AUTH=0`) to avoid unexpected
|
||||
login redirects. To switch to Better Auth, set both build args and runtime envs explicitly:
|
||||
`NEXT_PUBLIC_ENABLE_BETTER_AUTH=1` and `NEXT_PUBLIC_ENABLE_NEXT_AUTH=0`, then rebuild the image.
|
||||
</Callout>
|
||||
|
||||
### Supported SSO Providers
|
||||
|
||||
| Provider | Value | Environment Variables |
|
||||
| --------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
||||
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
||||
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
||||
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_ISSUER` |
|
||||
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
||||
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
||||
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
||||
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
||||
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
||||
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
||||
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
||||
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
||||
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
||||
| Feishu | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
||||
| WeChat | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
||||
|
||||
### Callback URL Format
|
||||
|
||||
When configuring OAuth providers, use the following callback URL format:
|
||||
|
||||
- **Development**: `http://localhost:3210/api/auth/callback/{provider}`
|
||||
- **Production**: `https://yourdomain.com/api/auth/callback/{provider}`
|
||||
|
||||
### Email Service Configuration
|
||||
|
||||
Used by email verification, password reset, and magic-link delivery. Choose a provider, then fill the matching variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| ------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification before users can sign in |
|
||||
| `EMAIL_SERVICE_PROVIDER` | Optional | Email provider selector: `nodemailer` (default, SMTP) or `resend` |
|
||||
| `SMTP_HOST` | Required | SMTP server hostname (e.g., `smtp.gmail.com`). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_PORT` | Required | SMTP server port (usually `587` for TLS, `465` for SSL). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_SECURE` | Optional | `true` for SSL (port 465), `false` for TLS (port 587). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_USER` | Required | SMTP auth username. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_PASS` | Required | SMTP auth password. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `RESEND_API_KEY` | Required | Resend API key. Required when `EMAIL_SERVICE_PROVIDER=resend` |
|
||||
| `RESEND_FROM` | Recommended | Default sender address (e.g., `noreply@your-verified-domain.com`). Must be a domain verified in Resend. Used when `EMAIL_SERVICE_PROVIDER=resend` |
|
||||
|
||||
### Magic Link (Passwordless) Login
|
||||
|
||||
Enable BetterAuth magic-link login (depends on a working email provider above):
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| ------------------------------- | -------- | -------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_ENABLE_MAGIC_LINK` | Optional | Set to `1` to enable passwordless magic-link login |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
For detailed provider configuration, refer to the [Next Auth provider documentation](/docs/self-hosting/advanced/auth/next-auth) as most configurations are compatible, or visit the official [Better Auth documentation](https://www.better-auth.com/docs/introduction).
|
||||
</Callout>
|
||||
|
||||
<Callout type={'tip'}>
|
||||
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
||||
</Callout>
|
||||
|
||||
## Next Auth
|
||||
|
||||
Before using NextAuth, please set the following variables in LobeChat's environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | Required | This is used to enable the NextAuth service. Set it to `1` to enable it; changing this setting requires recompiling the application. Users deploying with the `lobehub/lobe-chat-database` image have this configuration added by default. |
|
||||
| `AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can use the following command: `openssl rand -base64 32`, or visit `https://generate-secret.vercel.app/32` to generate the key. |
|
||||
| `AUTH_URL` | Required | This URL specifies the callback address for Auth.js when performing OAuth verification. Set this only if the default generated redirect address is incorrect. `https://example.com/api/auth` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | Optional | This environment variable is used to enable multiple identity verification sources simultaneously, separated by commas, for example, `auth0,microsoft-entra-id,authentik`. |
|
||||
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | Optional | The session strategy for Auth.js. Options are `jwt` or `database`. Default is `jwt`. |
|
||||
|
||||
Currently supported identity verification services include:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/google'} title={'Google'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
Click on the links to view the corresponding platform's configuration documentation.
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
To simultaneously enable multiple identity verification sources, please set the `NEXT_AUTH_SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,microsoft-entra-id,authentik`.
|
||||
|
||||
The order corresponds to the display order of the SSO providers.
|
||||
|
||||
| SSO Provider | Value | Additional Features |
|
||||
| --------------------- | ----------------------- | ------------------- |
|
||||
| Auth0 | `auth0` | |
|
||||
| Authenlia | `authenlia` | |
|
||||
| Authentik | `authentik` | |
|
||||
| Casdoor | `casdoor` | `Webhook` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
||||
| Github | `github` | |
|
||||
| Logto | `logto` | `Webhook` |
|
||||
| Microsoft Entra ID | `microsoft-entra-id` | |
|
||||
| ZITADEL | `zitadel` | |
|
||||
| Keycloak | `keycloak` | |
|
||||
| Google | `google` | |
|
||||
| Okta | `okta` | |
|
||||
|
||||
## Additional Features
|
||||
|
||||
### Webhook Support
|
||||
|
||||
Allow LobeChat to receive notifications when user information is updated in the identity provider. Supported providers include Casdoor and Logto. Please refer to the specific provider documentation for configuration details.
|
||||
|
||||
### Database Session
|
||||
|
||||
Allow the session store in database, see also the [Auth.js Session Documentation](https://authjs.dev/concepts/session-strategies#database-session).
|
||||
|
||||
## Other SSO Providers
|
||||
|
||||
Please refer to the [Auth.js](https://authjs.dev/getting-started/authentication/oauth) documentation and feel free to submit a Pull Request.
|
||||
@@ -1,190 +0,0 @@
|
||||
---
|
||||
title: LobeChat 身份验证服务配置
|
||||
description: 了解如何使用 Better Auth、Clerk 或 Next Auth 配置外部身份验证服务,以统一管理用户授权。支持的身份验证服务包括 Auth0、 Azure ID 等。
|
||||
tags:
|
||||
- 身份验证服务
|
||||
- Better Auth
|
||||
- LobeChat
|
||||
- SSO
|
||||
- Clerk
|
||||
---
|
||||
|
||||
# 身份验证服务
|
||||
|
||||
LobeChat 支持使用 Better Auth、Clerk 或者 Next Auth 配置外部身份验证服务,供企业 / 组织内部使用,统一管理用户授权。
|
||||
|
||||
## Clerk
|
||||
|
||||
Clerk 是一个近期流行起来的全面的身份验证解决方案,它提供了简单而强大的 API 和服务来处理用户认证和会话管理。Clerk 的设计哲学是提供一套简洁、现代的认证解决方案,使得开发者可以轻松集成和使用。
|
||||
|
||||
LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全、便捷的登录和注册体验,同时也为开发者减轻了管理身份验证逻辑的负担。Clerk 的简洁和现代的设计理念与 LobeChat 的目标非常契合,使得整个平台的用户管理更加高效和可靠。
|
||||
|
||||
在 LobeChat 的环境变量中设置 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY`,即可开启和使用 Clerk。
|
||||
|
||||
## Better Auth
|
||||
|
||||
[Better Auth](https://www.better-auth.com) 是一个现代化、框架无关的身份验证库,旨在提供全面、安全、灵活的身份验证解决方案。它支持多种认证方式,包括邮箱 / 密码登录、魔法链接登录以及多种 OAuth/SSO 提供商。
|
||||
|
||||
### 主要特性
|
||||
|
||||
- **邮箱 / 密码认证**:内置支持传统的邮箱和密码登录,采用安全的密码哈希算法
|
||||
- **邮箱验证**:可选的邮箱验证流程,支持自定义邮件模板
|
||||
- **魔法链接登录**:通过邮件魔法链接实现无密码认证
|
||||
- **OAuth/SSO 支持**:集成 Google、GitHub、Microsoft、AWS Cognito 等主流身份提供商
|
||||
- **通用 OIDC/OAuth**:支持任何符合 OpenID Connect 或 OAuth 2.0 标准的提供商
|
||||
|
||||
### 快速开始
|
||||
|
||||
要在 LobeChat 中启用 Better Auth,请设置以下环境变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| -------------------------------- | -- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_ENABLE_BETTER_AUTH` | 必选 | 设置为 `1` 以启用 Better Auth 服务 |
|
||||
| `AUTH_SECRET` | 必选 | 用于加密会话令牌的密钥。使用以下命令生成:`openssl rand -base64 32` |
|
||||
| `NEXT_PUBLIC_AUTH_URL` | 必选 | 浏览器可访问的 Better Auth 基础 URL(例如 `http://localhost:3010`、`https://lobechat.com`)。Vercel 部署时可选(会自动从 `VERCEL_URL` 获取) |
|
||||
| `AUTH_SSO_PROVIDERS` | 可选 | 启用的 SSO 提供商列表,以逗号分隔,例如 `google,github,microsoft` |
|
||||
|
||||
<Callout type={'error'}>
|
||||
**重要提示**:Better Auth 目前仅适用于**全新部署**的场景。如果你已经使用 NextAuth 或 Clerk 并且数据库中存在用户数据,**请暂时不要切换到 Better Auth**,否则现有用户将无法登录。
|
||||
|
||||
我们正在开发从 NextAuth/Clerk 到 Better Auth 的用户数据迁移工具,迁移方案完成后会更新文档。相关进度请关注 [GitHub Issue #10456](https://github.com/lobehub/lobe-chat/issues/10456)。
|
||||
</Callout>
|
||||
|
||||
<Callout type={'warning'}>
|
||||
若使用官方 Docker 镜像构建 / 部署,默认是 **开启 NextAuth、关闭 Better Auth**
|
||||
(`NEXT_PUBLIC_ENABLE_NEXT_AUTH=1`、`NEXT_PUBLIC_ENABLE_BETTER_AUTH=0`),以避免意外跳转到新版登录页。
|
||||
如果要切换到 Better Auth,请同时显式设置构建参数和运行时环境变量:
|
||||
`NEXT_PUBLIC_ENABLE_BETTER_AUTH=1`、`NEXT_PUBLIC_ENABLE_NEXT_AUTH=0`,并重新构建镜像。
|
||||
</Callout>
|
||||
|
||||
### 支持的 SSO 提供商
|
||||
|
||||
| 提供商 | 值 | 环境变量 |
|
||||
| --------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
||||
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
||||
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
||||
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_ISSUER` |
|
||||
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
||||
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
||||
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
||||
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
||||
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
||||
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
||||
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
||||
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
||||
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
||||
| 飞书 | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
||||
| 微信 | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
||||
|
||||
### 回调 URL 格式
|
||||
|
||||
配置 OAuth 提供商时,请使用以下回调 URL 格式:
|
||||
|
||||
- **开发环境**:`http://localhost:3210/api/auth/callback/{provider}`
|
||||
- **生产环境**:`https://yourdomain.com/api/auth/callback/{provider}`
|
||||
|
||||
### 邮件服务配置
|
||||
|
||||
用于邮箱验证、密码重置和魔法链接发送。先选择邮件服务,再填对应变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ------------------------------------- | -- | ----------------------------------------------------------------------------------------- |
|
||||
| `NEXT_PUBLIC_AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 以要求用户在登录前验证邮箱 |
|
||||
| `EMAIL_SERVICE_PROVIDER` | 可选 | 邮件服务选择:`nodemailer`(默认,SMTP)或 `resend` |
|
||||
| `SMTP_HOST` | 必选 | SMTP 服务器主机名(如 `smtp.gmail.com`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_PORT` | 必选 | SMTP 服务器端口(TLS 通常为 `587`,SSL 为 `465`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_SECURE` | 可选 | SSL 设置为 `true`(端口 465),TLS 设置为 `false`(端口 587),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_USER` | 必选 | SMTP 认证用户名,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_PASS` | 必选 | SMTP 认证密码,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `RESEND_API_KEY` | 必选 | Resend API Key,`EMAIL_SERVICE_PROVIDER=resend` 时必填 |
|
||||
| `RESEND_FROM` | 推荐 | 默认发件人地址(如 `noreply@已验证域名`),需为 Resend 已验证域名下的邮箱,`EMAIL_SERVICE_PROVIDER=resend` 时使用 |
|
||||
|
||||
### 魔法链接(免密)登录
|
||||
|
||||
启用 BetterAuth 魔法链接登录(依赖上方已配置好的邮件服务):
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ------------------------------- | -- | ----------------- |
|
||||
| `NEXT_PUBLIC_ENABLE_MAGIC_LINK` | 可选 | 设置为 `1` 以启用魔法链接登录 |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
详细的提供商配置可参考 [Next Auth 提供商文档](/zh/docs/self-hosting/advanced/auth/next-auth)(大部分配置兼容),或访问官方 [Better Auth 文档](https://www.better-auth.com/docs/introduction)。
|
||||
</Callout>
|
||||
|
||||
<Callout type={'tip'}>
|
||||
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#better-auth) 可查阅所有 Better Auth 相关变量详情。
|
||||
</Callout>
|
||||
|
||||
## Next Auth
|
||||
|
||||
在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| -------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |
|
||||
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
|
||||
| `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
|
||||
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | 可选 | Auth.js 的会话策略。选项为 `jwt` 或 `database`。默认值为 `jwt`。 |
|
||||
|
||||
目前支持的身份验证服务有:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
点击即可查看对应平台的配置文档。
|
||||
|
||||
## 进阶配置
|
||||
|
||||
同时启用多个身份验证源请设置 `NEXT_AUTH_SSO_PROVIDERS` 环境变量,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。
|
||||
|
||||
顺序为 SSO 提供商的显示顺序。
|
||||
|
||||
| SSO 提供商 | 值 | 额外功能 |
|
||||
| --------------------- | ----------------------- | --------- |
|
||||
| Auth0 | `auth0` | |
|
||||
| Authenlia | `authenlia` | |
|
||||
| Authentik | `authentik` | |
|
||||
| Casdoor | `casdoor` | `Webhook` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
||||
| Github | `github` | |
|
||||
| Logto | `logto` | `Webhook` |
|
||||
| Microsoft Entra ID | `microsoft-entra-id` | |
|
||||
| ZITADEL | `zitadel` | |
|
||||
| Keycloak | `keycloak` | |
|
||||
| Okta | `okta` | |
|
||||
|
||||
## 额外功能
|
||||
|
||||
### Webhook 支持
|
||||
|
||||
允许 LobeChat 在身份提供商中用户信息更新时接收通知。支持的提供商包括 Casdoor 和 Logto。请参考具体提供商文档进行配置。
|
||||
|
||||
### 数据库会话
|
||||
|
||||
允许会话存储在数据库中,详情请参阅 [Auth.js 会话文档](https://authjs.dev/concepts/session-strategies#database-session)。
|
||||
|
||||
## 其他 SSO 提供商
|
||||
|
||||
请参考 [NextAuth.js](https://next-auth.js.org/providers) 文档,欢迎提交 Pull Request。
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Configure Clerk Authentication Service - Step-by-Step Guide
|
||||
description: >-
|
||||
Learn how to set up Clerk authentication with environment variables and webhooks.
|
||||
|
||||
Learn how to set up Clerk authentication with environment variables and
|
||||
webhooks.
|
||||
tags:
|
||||
- Clerk Authentication
|
||||
- Environment Variables
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
---
|
||||
title: LobeChat Authentication Service Configuration
|
||||
description: >-
|
||||
Learn how to configure Better Auth for centralized user authorization
|
||||
management. Supported SSO providers include Google, GitHub, Microsoft, and
|
||||
more.
|
||||
tags:
|
||||
- Authentication Service
|
||||
- Better Auth
|
||||
- SSO
|
||||
---
|
||||
|
||||
# Authentication Service
|
||||
|
||||
LobeChat uses [Better Auth](https://www.better-auth.com) as its authentication solution, providing comprehensive, secure, and flexible identity verification for self-hosted deployments.
|
||||
|
||||
<Callout type={'info'}>
|
||||
Looking for legacy authentication methods? See [Legacy Authentication](/docs/self-hosting/advanced/auth/legacy) for NextAuth and Clerk documentation.
|
||||
</Callout>
|
||||
|
||||
## Key Features
|
||||
|
||||
- **Email/Password Authentication**: Built-in support for traditional email and password login with secure password hashing
|
||||
- **Email Verification**: Optional email verification flow with customizable email templates
|
||||
- **Magic Link Login**: Passwordless authentication via email magic links
|
||||
- **OAuth/SSO Support**: Integration with popular identity providers including Google, GitHub, Microsoft, AWS Cognito, and more
|
||||
- **Generic OIDC/OAuth**: Support for any OpenID Connect or OAuth 2.0 compliant provider
|
||||
|
||||
## Getting Started
|
||||
|
||||
To enable Better Auth in LobeChat, set the following environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------- | -------- | ------------------------------------------------------------------------------ |
|
||||
| `AUTH_SECRET` | Required | Key used to encrypt session tokens. Generate using: `openssl rand -base64 32` |
|
||||
| `AUTH_SSO_PROVIDERS` | Optional | Comma-separated list of enabled SSO providers, e.g., `google,github,microsoft` |
|
||||
|
||||
## Supported SSO Providers
|
||||
|
||||
| Provider | Value | Environment Variables |
|
||||
| --------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
||||
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
||||
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
||||
| Apple | `apple` | `AUTH_APPLE_CLIENT_ID`, `AUTH_APPLE_CLIENT_SECRET` |
|
||||
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_DOMAIN`, `AUTH_COGNITO_REGION`, `AUTH_COGNITO_USERPOOL_ID` |
|
||||
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
||||
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
||||
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
||||
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
||||
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
||||
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
||||
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
||||
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
||||
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
||||
| Feishu | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
||||
| WeChat | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
||||
|
||||
Click on a provider below for detailed configuration guides:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/github'} title={'GitHub'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/google'} title={'Google'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/microsoft'} title={'Microsoft'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/apple'} title={'Apple'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/cognito'} title={'AWS Cognito'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/casdoor'} title={'Casdoor'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/okta'} title={'Okta'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/generic-oidc'} title={'Generic OIDC'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/feishu'} title={'Feishu'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/better-auth/wechat'} title={'WeChat'} />
|
||||
</Cards>
|
||||
|
||||
## Callback URL Format
|
||||
|
||||
When configuring OAuth providers, use the following callback URL format:
|
||||
|
||||
- **Development**: `http://localhost:3210/api/auth/callback/{provider}`
|
||||
- **Production**: `https://yourdomain.com/api/auth/callback/{provider}`
|
||||
|
||||
## Email Service Configuration
|
||||
|
||||
Used by email verification, password reset, and magic-link delivery. Choose a provider, then fill the matching variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| ------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `AUTH_EMAIL_VERIFICATION` | Optional | Set to `1` to require email verification before sign in (off by default) |
|
||||
| `EMAIL_SERVICE_PROVIDER` | Optional | Email provider selector: `nodemailer` (default, SMTP) or `resend` |
|
||||
| `SMTP_HOST` | Required | SMTP server hostname (e.g., `smtp.gmail.com`). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_PORT` | Required | SMTP server port (usually `587` for TLS, `465` for SSL). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_SECURE` | Optional | `true` for SSL (port 465), `false` for TLS (port 587). Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_USER` | Required | SMTP auth username. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `SMTP_PASS` | Required | SMTP auth password. Used when `EMAIL_SERVICE_PROVIDER=nodemailer` |
|
||||
| `RESEND_API_KEY` | Required | Resend API key. Required when `EMAIL_SERVICE_PROVIDER=resend` |
|
||||
| `RESEND_FROM` | Recommended | Default sender address (e.g., `noreply@your-verified-domain.com`). Must be a domain verified in Resend. Used when `EMAIL_SERVICE_PROVIDER=resend` |
|
||||
|
||||
## Magic Link (Passwordless) Login
|
||||
|
||||
Enable magic-link login (depends on a working email provider above, off by default):
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------- | -------- | ------------------------------------------------------------------- |
|
||||
| `ENABLE_MAGIC_LINK` | Optional | Set to `1` to enable passwordless magic-link login (off by default) |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
Go to [Environment Variables](/docs/self-hosting/environment-variables/auth#better-auth) for detailed information on all Better Auth variables.
|
||||
</Callout>
|
||||
|
||||
## FAQ
|
||||
|
||||
### What SSO providers does Better Auth support?
|
||||
|
||||
Better Auth supports built-in providers (Google, GitHub, Microsoft, Apple, AWS Cognito) and Generic OIDC providers (Auth0, Authelia, Authentik, Casdoor, Cloudflare Zero Trust, Keycloak, Logto, Okta, ZITADEL, Generic OIDC, Feishu, WeChat).
|
||||
|
||||
### How do I enable multiple SSO providers?
|
||||
|
||||
Set the `AUTH_SSO_PROVIDERS` environment variable with a comma-separated list, e.g., `google,github,microsoft`. The order determines the display order on the login page.
|
||||
@@ -0,0 +1,138 @@
|
||||
---
|
||||
title: LobeChat 身份验证服务配置
|
||||
description: 了解如何配置 Better Auth 以统一管理用户授权。支持的 SSO 提供商包括 Google、GitHub、Microsoft 等。
|
||||
tags:
|
||||
- 身份验证服务
|
||||
- Better Auth
|
||||
- SSO
|
||||
---
|
||||
|
||||
# 身份验证服务
|
||||
|
||||
LobeChat 使用 [Better Auth](https://www.better-auth.com) 作为身份验证解决方案,为自托管部署提供全面、安全、灵活的身份验证服务。
|
||||
|
||||
<Callout type={'info'}>
|
||||
需要使用旧版身份验证方案?请参阅 [旧版身份验证](/zh/docs/self-hosting/advanced/auth/legacy) 了解 NextAuth 和 Clerk 的文档。
|
||||
</Callout>
|
||||
|
||||
## 主要特性
|
||||
|
||||
- **邮箱 / 密码认证**:内置支持传统的邮箱和密码登录,采用安全的密码哈希算法
|
||||
- **邮箱验证**:可选的邮箱验证流程,支持自定义邮件模板
|
||||
- **魔法链接登录**:通过邮件魔法链接实现无密码认证
|
||||
- **OAuth/SSO 支持**:集成 Google、GitHub、Microsoft、AWS Cognito 等主流身份提供商
|
||||
- **通用 OIDC/OAuth**:支持任何符合 OpenID Connect 或 OAuth 2.0 标准的提供商
|
||||
|
||||
## 快速开始
|
||||
|
||||
要在 LobeChat 中启用 Better Auth,请设置以下环境变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| -------------------- | -- | ------------------------------------------------ |
|
||||
| `AUTH_SECRET` | 必选 | 用于加密会话令牌的密钥。使用以下命令生成:`openssl rand -base64 32` |
|
||||
| `AUTH_SSO_PROVIDERS` | 可选 | 启用的 SSO 提供商列表,以逗号分隔,例如 `google,github,microsoft` |
|
||||
|
||||
## 支持的 SSO 提供商
|
||||
|
||||
| 提供商 | 值 | 环境变量 |
|
||||
| --------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
|
||||
| Google | `google` | `AUTH_GOOGLE_ID`, `AUTH_GOOGLE_SECRET` |
|
||||
| GitHub | `github` | `AUTH_GITHUB_ID`, `AUTH_GITHUB_SECRET` |
|
||||
| Microsoft | `microsoft` | `AUTH_MICROSOFT_ID`, `AUTH_MICROSOFT_SECRET` |
|
||||
| Apple | `apple` | `AUTH_APPLE_CLIENT_ID`, `AUTH_APPLE_CLIENT_SECRET` |
|
||||
| AWS Cognito | `cognito` | `AUTH_COGNITO_ID`, `AUTH_COGNITO_SECRET`, `AUTH_COGNITO_DOMAIN`, `AUTH_COGNITO_REGION`, `AUTH_COGNITO_USERPOOL_ID` |
|
||||
| Auth0 | `auth0` | `AUTH_AUTH0_ID`, `AUTH_AUTH0_SECRET`, `AUTH_AUTH0_ISSUER` |
|
||||
| Authelia | `authelia` | `AUTH_AUTHELIA_ID`, `AUTH_AUTHELIA_SECRET`, `AUTH_AUTHELIA_ISSUER` |
|
||||
| Authentik | `authentik` | `AUTH_AUTHENTIK_ID`, `AUTH_AUTHENTIK_SECRET`, `AUTH_AUTHENTIK_ISSUER` |
|
||||
| Casdoor | `casdoor` | `AUTH_CASDOOR_ID`, `AUTH_CASDOOR_SECRET`, `AUTH_CASDOOR_ISSUER` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | `AUTH_CLOUDFLARE_ZERO_TRUST_ID`, `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET`, `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` |
|
||||
| Keycloak | `keycloak` | `AUTH_KEYCLOAK_ID`, `AUTH_KEYCLOAK_SECRET`, `AUTH_KEYCLOAK_ISSUER` |
|
||||
| Logto | `logto` | `AUTH_LOGTO_ID`, `AUTH_LOGTO_SECRET`, `AUTH_LOGTO_ISSUER` |
|
||||
| Okta | `okta` | `AUTH_OKTA_ID`, `AUTH_OKTA_SECRET`, `AUTH_OKTA_ISSUER` |
|
||||
| ZITADEL | `zitadel` | `AUTH_ZITADEL_ID`, `AUTH_ZITADEL_SECRET`, `AUTH_ZITADEL_ISSUER` |
|
||||
| Generic OIDC | `generic-oidc` | `AUTH_GENERIC_OIDC_ID`, `AUTH_GENERIC_OIDC_SECRET`, `AUTH_GENERIC_OIDC_ISSUER` |
|
||||
| 飞书 | `feishu` | `AUTH_FEISHU_APP_ID`, `AUTH_FEISHU_APP_SECRET` |
|
||||
| 微信 | `wechat` | `AUTH_WECHAT_ID`, `AUTH_WECHAT_SECRET` |
|
||||
|
||||
点击下方提供商查看详细配置指南:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/github'} title={'GitHub'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/google'} title={'Google'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/microsoft'} title={'Microsoft'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/apple'} title={'Apple'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/cognito'} title={'AWS Cognito'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/casdoor'} title={'Casdoor'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/okta'} title={'Okta'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/generic-oidc'} title={'Generic OIDC'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/feishu'} title={'飞书'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/better-auth/wechat'} title={'微信'} />
|
||||
</Cards>
|
||||
|
||||
## 回调 URL 格式
|
||||
|
||||
配置 OAuth 提供商时,请使用以下回调 URL 格式:
|
||||
|
||||
- **开发环境**:`http://localhost:3210/api/auth/callback/{provider}`
|
||||
- **生产环境**:`https://yourdomain.com/api/auth/callback/{provider}`
|
||||
|
||||
## 邮件服务配置
|
||||
|
||||
用于邮箱验证、密码重置和魔法链接发送。先选择邮件服务,再填对应变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ------------------------- | -- | ----------------------------------------------------------------------------------------- |
|
||||
| `AUTH_EMAIL_VERIFICATION` | 可选 | 设置为 `1` 以要求用户在登录前验证邮箱(默认关闭) |
|
||||
| `EMAIL_SERVICE_PROVIDER` | 可选 | 邮件服务选择:`nodemailer`(默认,SMTP)或 `resend` |
|
||||
| `SMTP_HOST` | 必选 | SMTP 服务器主机名(如 `smtp.gmail.com`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_PORT` | 必选 | SMTP 服务器端口(TLS 通常为 `587`,SSL 为 `465`),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_SECURE` | 可选 | SSL 设置为 `true`(端口 465),TLS 设置为 `false`(端口 587),仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_USER` | 必选 | SMTP 认证用户名,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `SMTP_PASS` | 必选 | SMTP 认证密码,仅在 `EMAIL_SERVICE_PROVIDER=nodemailer` 时需要 |
|
||||
| `RESEND_API_KEY` | 必选 | Resend API Key,`EMAIL_SERVICE_PROVIDER=resend` 时必填 |
|
||||
| `RESEND_FROM` | 推荐 | 默认发件人地址(如 `noreply@已验证域名`),需为 Resend 已验证域名下的邮箱,`EMAIL_SERVICE_PROVIDER=resend` 时使用 |
|
||||
|
||||
## 魔法链接(免密)登录
|
||||
|
||||
启用魔法链接登录(依赖上方已配置好的邮件服务,默认关闭):
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ------------------- | -- | ----------------------- |
|
||||
| `ENABLE_MAGIC_LINK` | 可选 | 设置为 `1` 以启用魔法链接登录(默认关闭) |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
前往 [环境变量](/zh/docs/self-hosting/environment-variables/auth#better-auth) 可查阅所有 Better Auth 相关变量详情。
|
||||
</Callout>
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Better Auth 支持哪些 SSO 提供商?
|
||||
|
||||
Better Auth 支持内置提供商(Google、GitHub、Microsoft、Apple、AWS Cognito)和通用 OIDC 提供商(Auth0、Authelia、Authentik、Casdoor、Cloudflare Zero Trust、Keycloak、Logto、Okta、ZITADEL、Generic OIDC、飞书、微信)。
|
||||
|
||||
### 如何启用多个 SSO 提供商?
|
||||
|
||||
设置 `AUTH_SSO_PROVIDERS` 环境变量,使用逗号分隔多个提供商,例如 `google,github,microsoft`。顺序决定登录页面上的显示顺序。
|
||||
@@ -0,0 +1,106 @@
|
||||
---
|
||||
title: Legacy Authentication (NextAuth & Clerk)
|
||||
description: >-
|
||||
Documentation for legacy authentication methods including NextAuth and Clerk.
|
||||
For new deployments, we recommend using Better Auth.
|
||||
tags:
|
||||
- Authentication Service
|
||||
- Next Auth
|
||||
- Clerk
|
||||
- Legacy
|
||||
---
|
||||
|
||||
# Legacy Authentication
|
||||
|
||||
<Callout type={'warning'}>
|
||||
**Legacy Notice**: NextAuth and Clerk are legacy authentication methods. For new deployments, we strongly recommend using [Better Auth](/docs/self-hosting/advanced/auth) for its simplicity and flexibility.
|
||||
</Callout>
|
||||
|
||||
This page documents the legacy authentication methods (NextAuth and Clerk) for users who are still using these services.
|
||||
|
||||
## Clerk
|
||||
|
||||
Clerk is a comprehensive identity verification solution that provides a simple yet powerful API and services to handle user authentication and session management.
|
||||
|
||||
LobeChat has deeply integrated with Clerk to provide users with a secure and convenient login and registration experience.
|
||||
|
||||
By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` in LobeChat's environment, you can enable and use Clerk.
|
||||
|
||||
<Callout type={'info'}>
|
||||
For detailed Clerk configuration, see [Clerk Configuration Guide](/docs/self-hosting/advanced/auth/clerk).
|
||||
</Callout>
|
||||
|
||||
## Next Auth
|
||||
|
||||
Before using NextAuth, please set the following variables in LobeChat's environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | Required | This is used to enable the NextAuth service. Set it to `1` to enable it; changing this setting requires recompiling the application. Users deploying with the `lobehub/lobe-chat-database` image have this configuration added by default. |
|
||||
| `AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can use the following command: `openssl rand -base64 32`, or visit `https://generate-secret.vercel.app/32` to generate the key. |
|
||||
| `AUTH_URL` | Required | This URL specifies the callback address for Auth.js when performing OAuth verification. Set this only if the default generated redirect address is incorrect. `https://example.com/api/auth` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | Optional | This environment variable is used to enable multiple identity verification sources simultaneously, separated by commas, for example, `auth0,microsoft-entra-id,authentik`. |
|
||||
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | Optional | The session strategy for Auth.js. Options are `jwt` or `database`. Default is `jwt`. |
|
||||
|
||||
Currently supported identity verification services include:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/google'} title={'Google'} />
|
||||
|
||||
<Card href={'/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
Click on the links to view the corresponding platform's configuration documentation.
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
To simultaneously enable multiple identity verification sources, please set the `NEXT_AUTH_SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,microsoft-entra-id,authentik`.
|
||||
|
||||
The order corresponds to the display order of the SSO providers.
|
||||
|
||||
| SSO Provider | Value | Additional Features |
|
||||
| --------------------- | ----------------------- | ------------------- |
|
||||
| Auth0 | `auth0` | |
|
||||
| Authenlia | `authenlia` | |
|
||||
| Authentik | `authentik` | |
|
||||
| Casdoor | `casdoor` | `Webhook` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
||||
| Github | `github` | |
|
||||
| Logto | `logto` | `Webhook` |
|
||||
| Microsoft Entra ID | `microsoft-entra-id` | |
|
||||
| ZITADEL | `zitadel` | |
|
||||
| Keycloak | `keycloak` | |
|
||||
| Google | `google` | |
|
||||
| Okta | `okta` | |
|
||||
|
||||
## Additional Features
|
||||
|
||||
### Webhook Support
|
||||
|
||||
Allow LobeChat to receive notifications when user information is updated in the identity provider. Supported providers include Casdoor and Logto. Please refer to the specific provider documentation for configuration details.
|
||||
|
||||
### Database Session
|
||||
|
||||
Allow the session store in database, see also the [Auth.js Session Documentation](https://authjs.dev/concepts/session-strategies#database-session).
|
||||
|
||||
## Other SSO Providers
|
||||
|
||||
Please refer to the [Auth.js](https://authjs.dev/getting-started/authentication/oauth) documentation and feel free to submit a Pull Request.
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
title: 旧版身份验证(NextAuth 和 Clerk)
|
||||
description: 关于 NextAuth 和 Clerk 等旧版身份验证方法的文档。对于新部署,我们建议使用 Better Auth。
|
||||
tags:
|
||||
- 身份验证服务
|
||||
- Next Auth
|
||||
- Clerk
|
||||
- 旧版
|
||||
---
|
||||
|
||||
# 旧版身份验证
|
||||
|
||||
<Callout type={'warning'}>
|
||||
**旧版提示**:NextAuth 和 Clerk 是旧版身份验证方案。对于新部署,我们强烈建议使用 [Better Auth](/zh/docs/self-hosting/advanced/auth),它更简洁、更灵活。
|
||||
</Callout>
|
||||
|
||||
本页面为仍在使用这些服务的用户提供旧版身份验证方案(NextAuth 和 Clerk)的文档。
|
||||
|
||||
## Clerk
|
||||
|
||||
Clerk 是一个全面的身份验证解决方案,它提供了简单而强大的 API 和服务来处理用户认证和会话管理。
|
||||
|
||||
LobeChat 与 Clerk 做了深度集成,能够为用户提供安全、便捷的登录和注册体验。
|
||||
|
||||
在 LobeChat 的环境变量中设置 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY`,即可开启和使用 Clerk。
|
||||
|
||||
<Callout type={'info'}>
|
||||
详细的 Clerk 配置请参阅 [Clerk 配置指南](/zh/docs/self-hosting/advanced/auth/clerk)。
|
||||
</Callout>
|
||||
|
||||
## Next Auth
|
||||
|
||||
在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| -------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| `NEXT_PUBLIC_ENABLE_NEXT_AUTH` | 必选 | 用于启用 NextAuth 服务,设置为 `1` 以启用,更改此项需要重新编译应用。使用 `lobehub/lobe-chat-database` 镜像部署的用户已经默认添加了该项配置。 |
|
||||
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
|
||||
| `AUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
|
||||
| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
|
||||
| `NEXT_AUTH_SSO_SESSION_STRATEGY` | 可选 | Auth.js 的会话策略。选项为 `jwt` 或 `database`。默认值为 `jwt`。 |
|
||||
|
||||
目前支持的身份验证服务有:
|
||||
|
||||
<Cards>
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/auth0'} title={'Auth0'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/microsoft-entra-id'} title={'Microsoft Entra ID'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authentik'} title={'Authentik'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/github'} title={'Github'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/zitadel'} title={'ZITADEL'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust'} title={'Cloudflare Zero Trust'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/authelia'} title={'Authelia'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/logto'} title={'Logto'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/keycloak'} title={'Keycloak'} />
|
||||
|
||||
<Card href={'/zh/docs/self-hosting/advanced/auth/next-auth/okta'} title={'Okta'} />
|
||||
</Cards>
|
||||
|
||||
点击即可查看对应平台的配置文档。
|
||||
|
||||
## 进阶配置
|
||||
|
||||
同时启用多个身份验证源请设置 `NEXT_AUTH_SSO_PROVIDERS` 环境变量,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。
|
||||
|
||||
顺序为 SSO 提供商的显示顺序。
|
||||
|
||||
| SSO 提供商 | 值 | 额外功能 |
|
||||
| --------------------- | ----------------------- | --------- |
|
||||
| Auth0 | `auth0` | |
|
||||
| Authenlia | `authenlia` | |
|
||||
| Authentik | `authentik` | |
|
||||
| Casdoor | `casdoor` | `Webhook` |
|
||||
| Cloudflare Zero Trust | `cloudflare-zero-trust` | |
|
||||
| Github | `github` | |
|
||||
| Logto | `logto` | `Webhook` |
|
||||
| Microsoft Entra ID | `microsoft-entra-id` | |
|
||||
| ZITADEL | `zitadel` | |
|
||||
| Keycloak | `keycloak` | |
|
||||
| Okta | `okta` | |
|
||||
|
||||
## 额外功能
|
||||
|
||||
### Webhook 支持
|
||||
|
||||
允许 LobeChat 在身份提供商中用户信息更新时接收通知。支持的提供商包括 Casdoor 和 Logto。请参考具体提供商文档进行配置。
|
||||
|
||||
### 数据库会话
|
||||
|
||||
允许会话存储在数据库中,详情请参阅 [Auth.js 会话文档](https://authjs.dev/concepts/session-strategies#database-session)。
|
||||
|
||||
## 其他 SSO 提供商
|
||||
|
||||
请参考 [NextAuth.js](https://next-auth.js.org/providers) 文档,欢迎提交 Pull Request。
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configure Auth0 Identity Verification Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Auth0 Identity Verification Service for LobeChat for your organization, including creating applications, adding users, and configuring environment variables.
|
||||
|
||||
Learn how to configure Auth0 Identity Verification Service for LobeChat for
|
||||
your organization, including creating applications, adding users, and
|
||||
configuring environment variables.
|
||||
tags:
|
||||
- Auth0
|
||||
- Identity Verification
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Authelia Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Authelia authentication service in LobeChat, including creating a provider, configuring environment variables, and deploying LobeChat. Detailed steps and necessary environment variable settings.
|
||||
|
||||
Learn how to configure Authelia authentication service in LobeChat, including
|
||||
creating a provider, configuring environment variables, and deploying
|
||||
LobeChat. Detailed steps and necessary environment variable settings.
|
||||
tags:
|
||||
- Authelia Configuration
|
||||
- Single Sign-On (SSO)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Authentik Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Authentik for Single Sign-On (SSO) for LobeChat, including creating an application provider, setting environment variables, and deployment instructions.
|
||||
|
||||
Learn how to configure Authentik for Single Sign-On (SSO) for LobeChat,
|
||||
including creating an application provider, setting environment variables, and
|
||||
deployment instructions.
|
||||
tags:
|
||||
- Authentik Configuration
|
||||
- Single Sign-On (SSO)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Casdoor Authentication Service in LobeChat
|
||||
description: >-
|
||||
Learn how to configure the Casdoor authentication service in LobeChat, including deployment, creation, permission settings, and environment variables.
|
||||
|
||||
Learn how to configure the Casdoor authentication service in LobeChat,
|
||||
including deployment, creation, permission settings, and environment
|
||||
variables.
|
||||
tags:
|
||||
- Casdoor Authentication
|
||||
- Environment Variable Configuration
|
||||
@@ -87,6 +88,8 @@ If you are deploying using a public network, the following assumptions apply:
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
```
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ tags:
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
```
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Cloudflare Zero Trust Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Cloudflare Zero Trust for Single Sign-On (SSO) for LobeChat, including creating an application provider, setting environment variables, and deployment instructions.
|
||||
|
||||
Learn how to configure Cloudflare Zero Trust for Single Sign-On (SSO) for
|
||||
LobeChat, including creating an application provider, setting environment
|
||||
variables, and deployment instructions.
|
||||
tags:
|
||||
- Cloudflare Zero Trust
|
||||
- Single Sign-On (SSO)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: 在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务
|
||||
description: >-
|
||||
学习如何在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务,包括创建提供程序、配置环境变量和部署 LobeChat。详细步骤和必要环境变量设置。
|
||||
|
||||
学习如何在 LobeChat 中配置 Cloudflare Zero Trust 身份验证服务,包括创建提供程序、配置环境变量和部署
|
||||
LobeChat。详细步骤和必要环境变量设置。
|
||||
tags:
|
||||
- Cloudflare Zero Trust
|
||||
- 身份验证
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Github Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Github authentication service for LobeChat, including creating a Github provider, setting up environment variables, and deploying LobeChat.
|
||||
|
||||
Learn how to configure Github authentication service for LobeChat, including
|
||||
creating a Github provider, setting up environment variables, and deploying
|
||||
LobeChat.
|
||||
tags:
|
||||
- Github authentication
|
||||
- LobeChat
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
---
|
||||
|
||||
title: Configuration of Google SSO Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Google SSO Authentication Service for LobeChat,
|
||||
create OAuth applications, add users, and set up environment variables for seamless integration.
|
||||
Learn how to configure Google SSO Authentication Service for LobeChat, create
|
||||
OAuth applications, add users, and set up environment variables for seamless
|
||||
integration.
|
||||
tags:
|
||||
|
||||
* Google SSO
|
||||
* Authentication Service
|
||||
* Google Cloud
|
||||
* OAuth
|
||||
* SSO
|
||||
* Environment Variables
|
||||
* LobeChat
|
||||
|
||||
- Google SSO
|
||||
- Authentication Service
|
||||
- Google Cloud
|
||||
- OAuth
|
||||
- SSO
|
||||
- Environment Variables
|
||||
- LobeChat
|
||||
---
|
||||
|
||||
# Configuration of Google SSO Authentication Service
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuring Keycloak Authentication Service in LobeChat
|
||||
description: >-
|
||||
Learn how to configure the Keycloak authentication service in LobeChat, including deployment, creation, permission settings, and environment variables.
|
||||
|
||||
Learn how to configure the Keycloak authentication service in LobeChat,
|
||||
including deployment, creation, permission settings, and environment
|
||||
variables.
|
||||
tags:
|
||||
- Keycloak Authentication
|
||||
- Environment Variable Configuration
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Configuring Logto Authentication Service in LobeChat
|
||||
description: >-
|
||||
Learn how to configure Logto authentication service in LobeChat, including deployment, creation, setting permissions, and environment variables.
|
||||
|
||||
Learn how to configure Logto authentication service in LobeChat, including
|
||||
deployment, creation, setting permissions, and environment variables.
|
||||
tags:
|
||||
- Logto Authentication
|
||||
- Environment Variable Configuration
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configuration of Microsoft Entra ID Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Microsoft Entra ID Authentication Service for LobeChat, create applications, add users, and set up environment variables for seamless integration.
|
||||
|
||||
Learn how to configure Microsoft Entra ID Authentication Service for LobeChat,
|
||||
create applications, add users, and set up environment variables for seamless
|
||||
integration.
|
||||
tags:
|
||||
- Microsoft Entra ID
|
||||
- Authentication Service
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configure Okta Identity Verification Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Okta Identity Verification Service for LobeChat for your organization, including creating applications, adding users, and configuring environment variables.
|
||||
|
||||
Learn how to configure Okta Identity Verification Service for LobeChat for
|
||||
your organization, including creating applications, adding users, and
|
||||
configuring environment variables.
|
||||
tags:
|
||||
- Okta
|
||||
- Identity Verification
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
title: 在 LobeChat 中配置 Okta 身份验证服务 - 详细步骤和环境变量设置
|
||||
description: >-
|
||||
学习如何在 LobeChat 中为您的组织配置 Okta 身份验证服务,包括创建应用程序、添加用户和配置环境变量等。
|
||||
|
||||
description: 学习如何在 LobeChat 中为您的组织配置 Okta 身份验证服务,包括创建应用程序、添加用户和配置环境变量等。
|
||||
tags:
|
||||
- Okta
|
||||
- 身份验证
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
---
|
||||
title: Configure Wechat Authentication Service in LobeChat
|
||||
description: >-
|
||||
Learn how to configure Wechat authentication service in LobeChat, including creating a new Wechat App, setting permissions, and environment variables.
|
||||
|
||||
Learn how to configure Wechat authentication service in LobeChat, including
|
||||
creating a new Wechat App, setting permissions, and environment variables.
|
||||
tags:
|
||||
- Wechat Authentication
|
||||
- Wechat App
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
---
|
||||
title: Configure ZITADEL Authentication Service for LobeChat
|
||||
description: >-
|
||||
Learn how to configure ZITADEL Authentication Service for LobeChat deployment, including creating ZITADEL applications, setting up environment variables, and enabling single sign-on (SSO).
|
||||
|
||||
Learn how to configure ZITADEL Authentication Service for LobeChat deployment,
|
||||
including creating ZITADEL applications, setting up environment variables, and
|
||||
enabling single sign-on (SSO).
|
||||
tags:
|
||||
- ZITADEL Authentication
|
||||
- LobeChat Deployment
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
---
|
||||
title: Configuring Apple Authentication for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Apple Sign In for LobeChat, including creating
|
||||
credentials in Apple Developer Portal and setting up environment variables.
|
||||
tags:
|
||||
- Apple
|
||||
- Authentication
|
||||
- LobeChat
|
||||
- Single Sign-On
|
||||
---
|
||||
|
||||
# Configuring Apple Authentication
|
||||
|
||||
<Callout type={'warning'}>
|
||||
Apple Sign In requires a paid Apple Developer account ($99/year) and does not
|
||||
support localhost. You must use a domain with HTTPS for both development and
|
||||
production.
|
||||
</Callout>
|
||||
|
||||
<Steps>
|
||||
### Create an App ID
|
||||
|
||||
1. Go to [Apple Developer Portal](https://developer.apple.com/account/resources/identifiers/list)
|
||||
2. Navigate to **Certificates, Identifiers & Profiles** > **Identifiers**
|
||||
3. Click **+** to register a new identifier
|
||||
4. Select **App IDs** > **App** type > **Continue**
|
||||
5. Fill in:
|
||||
- **Description**: e.g., `LobeChat`
|
||||
- **Bundle ID**: e.g., `com.yourcompany.lobechat`
|
||||
6. Enable **Sign In with Apple** capability
|
||||
7. Click **Continue** > **Register**
|
||||
|
||||
### Create a Services ID
|
||||
|
||||
1. Go back to **Identifiers**, click **+**
|
||||
2. Select **Services IDs** > **Continue**
|
||||
3. Fill in:
|
||||
- **Description**: e.g., `LobeChat Web`
|
||||
- **Identifier**: e.g., `com.yourcompany.lobechat.web` (this is your Client ID)
|
||||
4. Click **Continue** > **Register**
|
||||
|
||||
### Configure Services ID
|
||||
|
||||
1. Click on the created Services ID
|
||||
2. Enable **Sign In with Apple**
|
||||
3. Click **Configure**
|
||||
4. Select your Primary App ID
|
||||
5. Add domains and callback URLs:
|
||||
- **Domains**: `your-domain.com`
|
||||
- **Return URLs**: `https://your-domain.com/api/auth/callback/apple`
|
||||
6. Click **Save** > **Continue** > **Save**
|
||||
|
||||
<Callout type={'info'}>
|
||||
Callback URL format:
|
||||
|
||||
- Production: `https://your-domain.com/api/auth/callback/apple`
|
||||
- Apple does **not** support localhost or HTTP URLs
|
||||
</Callout>
|
||||
|
||||
### Create a Sign In Key
|
||||
|
||||
1. Navigate to **Keys**, click **+**
|
||||
2. Fill in key name
|
||||
3. Enable **Sign In with Apple**, click **Configure**
|
||||
4. Select your Primary App ID
|
||||
5. Click **Save** > **Continue** > **Register**
|
||||
6. **Download the key file** (`.p8`) - you can only download it once
|
||||
7. Note down:
|
||||
- **Key ID**: shown on the key page
|
||||
- **Team ID**: shown in top right corner of developer portal
|
||||
|
||||
### Generate Client Secret
|
||||
|
||||
Apple requires a JWT as the client secret. Generate it using your `.p8` key file:
|
||||
|
||||
```js
|
||||
// Example using Node.js
|
||||
const jwt = require('jsonwebtoken');
|
||||
const fs = require('fs');
|
||||
|
||||
const privateKey = fs.readFileSync('AuthKey_XXXXX.p8');
|
||||
const token = jwt.sign({}, privateKey, {
|
||||
algorithm: 'ES256',
|
||||
expiresIn: '180d', // Max 6 months
|
||||
issuer: 'YOUR_TEAM_ID',
|
||||
audience: 'https://appleid.apple.com',
|
||||
subject: 'YOUR_SERVICES_ID', // Client ID
|
||||
keyid: 'YOUR_KEY_ID',
|
||||
});
|
||||
```
|
||||
|
||||
<Callout type={'warning'}>
|
||||
The JWT expires after maximum 180 days. You need to regenerate and update it
|
||||
before expiration.
|
||||
</Callout>
|
||||
|
||||
### Configure Environment Variables
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| ---------------------------------- | -------- | --------------------------------------------------------------- |
|
||||
| `AUTH_SECRET` | Required | Session encryption key, generate with `openssl rand -base64 32` |
|
||||
| `AUTH_SSO_PROVIDERS` | Required | Set to `apple` |
|
||||
| `AUTH_APPLE_CLIENT_ID` | Required | Your Services ID |
|
||||
| `AUTH_APPLE_CLIENT_SECRET` | Required | The generated JWT |
|
||||
| `AUTH_APPLE_APP_BUNDLE_IDENTIFIER` | Optional | App Bundle ID (for native app integration) |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#apple)
|
||||
for detailed information.
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout type={'info'}>
|
||||
After successful deployment, users will be able to authenticate with Apple and
|
||||
use LobeChat.
|
||||
</Callout>
|
||||
|
||||
## Common Issues
|
||||
|
||||
### localhost Not Supported
|
||||
|
||||
Apple Sign In does not support localhost or non-HTTPS URLs. For local development, use a tunneling service like ngrok or deploy to a staging environment with HTTPS.
|
||||
|
||||
### Secret Expiration
|
||||
|
||||
The JWT client secret expires after 180 days maximum. Set a reminder to regenerate it before expiration.
|
||||
|
||||
## Related Resources
|
||||
|
||||
- [Apple Developer Portal](https://developer.apple.com/account)
|
||||
- [Sign In with Apple Documentation](https://developer.apple.com/sign-in-with-apple/)
|
||||
@@ -0,0 +1,127 @@
|
||||
---
|
||||
title: 在 LobeChat 中配置 Apple 身份验证
|
||||
description: 学习如何在 LobeChat 中配置 Apple 登录,包括在 Apple Developer Portal 创建凭证和设置环境变量。
|
||||
tags:
|
||||
- Apple
|
||||
- 身份验证
|
||||
- LobeChat
|
||||
- 单点登录
|
||||
---
|
||||
|
||||
# 配置 Apple 身份验证
|
||||
|
||||
<Callout type={'warning'}>
|
||||
Apple 登录需要付费的 Apple Developer 账户($99 / 年),且不支持
|
||||
localhost。开发和生产环境都必须使用 HTTPS 域名。
|
||||
</Callout>
|
||||
|
||||
<Steps>
|
||||
### 创建 App ID
|
||||
|
||||
1. 前往 [Apple Developer Portal](https://developer.apple.com/account/resources/identifiers/list)
|
||||
2. 导航到 **Certificates, Identifiers & Profiles** > **Identifiers**
|
||||
3. 点击 **+** 注册新标识符
|
||||
4. 选择 **App IDs** > **App** 类型 > **Continue**
|
||||
5. 填写:
|
||||
- **Description**: 如 `LobeChat`
|
||||
- **Bundle ID**: 如 `com.yourcompany.lobechat`
|
||||
6. 启用 **Sign In with Apple** 功能
|
||||
7. 点击 **Continue** > **Register**
|
||||
|
||||
### 创建 Services ID
|
||||
|
||||
1. 返回 **Identifiers**,点击 **+**
|
||||
2. 选择 **Services IDs** > **Continue**
|
||||
3. 填写:
|
||||
- **Description**: 如 `LobeChat Web`
|
||||
- **Identifier**: 如 `com.yourcompany.lobechat.web`(这是你的 Client ID)
|
||||
4. 点击 **Continue** > **Register**
|
||||
|
||||
### 配置 Services ID
|
||||
|
||||
1. 点击已创建的 Services ID
|
||||
2. 启用 **Sign In with Apple**
|
||||
3. 点击 **Configure**
|
||||
4. 选择 Primary App ID
|
||||
5. 添加域名和回调 URL:
|
||||
- **Domains**: `your-domain.com`
|
||||
- **Return URLs**: `https://your-domain.com/api/auth/callback/apple`
|
||||
6. 点击 **Save** > **Continue** > **Save**
|
||||
|
||||
<Callout type={'info'}>
|
||||
回调 URL 格式:
|
||||
|
||||
- 生产环境: `https://your-domain.com/api/auth/callback/apple`
|
||||
- Apple **不支持** localhost 或 HTTP URL
|
||||
</Callout>
|
||||
|
||||
### 创建登录密钥
|
||||
|
||||
1. 导航到 **Keys**,点击 **+**
|
||||
2. 填写密钥名称
|
||||
3. 启用 **Sign In with Apple**,点击 **Configure**
|
||||
4. 选择 Primary App ID
|
||||
5. 点击 **Save** > **Continue** > **Register**
|
||||
6. **下载密钥文件**(`.p8`)- 只能下载一次
|
||||
7. 记录:
|
||||
- **Key ID**: 密钥页面显示
|
||||
- **Team ID**: 开发者门户右上角显示
|
||||
|
||||
### 生成 Client Secret
|
||||
|
||||
Apple 要求使用 JWT 作为 client secret。使用 `.p8` 密钥文件生成:
|
||||
|
||||
```js
|
||||
// Node.js 示例
|
||||
const jwt = require('jsonwebtoken');
|
||||
const fs = require('fs');
|
||||
|
||||
const privateKey = fs.readFileSync('AuthKey_XXXXX.p8');
|
||||
const token = jwt.sign({}, privateKey, {
|
||||
algorithm: 'ES256',
|
||||
expiresIn: '180d', // 最长 6 个月
|
||||
issuer: 'YOUR_TEAM_ID',
|
||||
audience: 'https://appleid.apple.com',
|
||||
subject: 'YOUR_SERVICES_ID', // Client ID
|
||||
keyid: 'YOUR_KEY_ID',
|
||||
});
|
||||
```
|
||||
|
||||
<Callout type={'warning'}>
|
||||
JWT 最长有效期为 180 天。需要在过期前重新生成并更新。
|
||||
</Callout>
|
||||
|
||||
### 配置环境变量
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| ---------------------------------- | -- | -------------------------------------- |
|
||||
| `AUTH_SECRET` | 必选 | 会话加密密钥,使用 `openssl rand -base64 32` 生成 |
|
||||
| `AUTH_SSO_PROVIDERS` | 必选 | 填写 `apple` |
|
||||
| `AUTH_APPLE_CLIENT_ID` | 必选 | 你的 Services ID |
|
||||
| `AUTH_APPLE_CLIENT_SECRET` | 必选 | 生成的 JWT |
|
||||
| `AUTH_APPLE_APP_BUNDLE_IDENTIFIER` | 可选 | App Bundle ID(用于原生应用集成) |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#apple)
|
||||
可查阅相关变量详情。
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout type={'info'}>
|
||||
部署成功后,用户将可以通过 Apple 身份认证并使用 LobeChat。
|
||||
</Callout>
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 不支持 localhost
|
||||
|
||||
Apple 登录不支持 localhost 或非 HTTPS URL。本地开发请使用 ngrok 等隧道服务或部署到带有 HTTPS 的测试环境。
|
||||
|
||||
### 密钥过期
|
||||
|
||||
JWT client secret 最长有效期为 180 天。请设置提醒在过期前重新生成。
|
||||
|
||||
## 相关资源
|
||||
|
||||
- [Apple Developer Portal](https://developer.apple.com/account)
|
||||
- [Sign In with Apple 文档](https://developer.apple.com/sign-in-with-apple/)
|
||||
@@ -0,0 +1,111 @@
|
||||
---
|
||||
title: Configuring Auth0 Authentication for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Auth0 SSO for LobeChat, including creating
|
||||
applications, adding users, and setting up environment variables.
|
||||
tags:
|
||||
- Auth0
|
||||
- Authentication
|
||||
- LobeChat
|
||||
- Single Sign-On
|
||||
---
|
||||
|
||||
# Configuring Auth0 Authentication
|
||||
|
||||
<Steps>
|
||||
### Create Auth0 Application
|
||||
|
||||
1. Go to [Auth0 Dashboard](https://manage.auth0.com/dashboard)
|
||||
2. Click **Applications** > **Create Application**
|
||||
|
||||
<Image alt="Create Auth0 Application S1" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86" />
|
||||
|
||||
3. Fill in the application name
|
||||
4. Select **Regular Web Applications** as the application type
|
||||
5. Click **Create**
|
||||
|
||||
<Image alt="Create Auth0 Application S2" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc" />
|
||||
|
||||
### Configure Application Settings
|
||||
|
||||
After creation, go to the **Settings** tab:
|
||||
|
||||
<Image alt="Create Auth0 Application S3" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6" />
|
||||
|
||||
Note down:
|
||||
|
||||
- **Domain** (e.g., `your-tenant.auth0.com`)
|
||||
- **Client ID**
|
||||
- **Client Secret**
|
||||
|
||||
### Configure Callback URL
|
||||
|
||||
In **Allowed Callback URLs**, add:
|
||||
|
||||
<Callout type={'info'}>
|
||||
Callback URL format:
|
||||
|
||||
- Local development: `http://localhost:3210/api/auth/callback/auth0`
|
||||
- Production: `https://your-domain.com/api/auth/callback/auth0`
|
||||
</Callout>
|
||||
|
||||
<Image alt="Create Auth0 Application S4" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9" />
|
||||
|
||||
### Add Users (Optional)
|
||||
|
||||
Click **User Management** to create users for your organization.
|
||||
|
||||
<Image alt="Add Users" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96" />
|
||||
|
||||
### Configure Environment Variables
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------------------- | -------- | --------------------------------------------------------------- |
|
||||
| `AUTH_SECRET` | Required | Session encryption key, generate with `openssl rand -base64 32` |
|
||||
| `AUTH_SSO_PROVIDERS` | Required | Set to `auth0` |
|
||||
| `AUTH_AUTH0_ID` | Required | Client ID |
|
||||
| `AUTH_AUTH0_SECRET` | Required | Client Secret |
|
||||
| `AUTH_AUTH0_ISSUER` | Required | `https://your-tenant.auth0.com` |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#auth0)
|
||||
for detailed information.
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout type={'info'}>
|
||||
After successful deployment, users will be able to authenticate with Auth0 and
|
||||
use LobeChat.
|
||||
</Callout>
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
### Connect Existing SSO Services
|
||||
|
||||
If your organization has existing identity infrastructure, connect to SSO services in **Applications** > **SSO Integrations**.
|
||||
|
||||
Auth0 supports Azure AD, Slack, Google Workspace, Office 365, Zoom, and more. See [Auth0 SSO Integrations](https://marketplace.auth0.com/features/sso-integrations).
|
||||
|
||||
<Image alt="Connecting to Existing SSO Service" src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec" />
|
||||
|
||||
### Configure Social Login
|
||||
|
||||
Configure social login in **Authentication** > **Social**.
|
||||
|
||||
<Image alt="Configuring Social Login" src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa" />
|
||||
|
||||
<Callout type={'warning'}>
|
||||
Social login by default allows anyone to authenticate. Configure blocking
|
||||
policies to restrict access.
|
||||
</Callout>
|
||||
|
||||
<Callout type={'warning'}>
|
||||
When creating a GitHub connection, make sure to enable the **Email Address** permission in the **Attributes** section. LobeChat requires user email for authentication.
|
||||
|
||||
<Image alt="GitHub Connection Email Permission" src="https://hub-apac-1.lobeobjects.space/docs/afdf22891dda3e5e44c690db184c548e.png" />
|
||||
</Callout>
|
||||
|
||||
## Related Resources
|
||||
|
||||
- [Auth0 Dashboard](https://manage.auth0.com/dashboard)
|
||||
- [Auth0 Documentation](https://auth0.com/docs)
|
||||
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title: 在 LobeChat 中配置 Auth0 身份验证
|
||||
description: 学习如何在 LobeChat 中配置 Auth0 SSO,包括创建应用、添加用户和设置环境变量。
|
||||
tags:
|
||||
- Auth0
|
||||
- 身份验证
|
||||
- LobeChat
|
||||
- 单点登录
|
||||
---
|
||||
|
||||
# 配置 Auth0 身份验证
|
||||
|
||||
<Steps>
|
||||
### 创建 Auth0 应用
|
||||
|
||||
1. 前往 [Auth0 Dashboard](https://manage.auth0.com/dashboard)
|
||||
2. 点击 **Applications** > **Create Application**
|
||||
|
||||
<Image alt="创建 Auth0 应用 S1" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86" />
|
||||
|
||||
3. 填写应用名称
|
||||
4. 选择 **Regular Web Applications** 作为应用类型
|
||||
5. 点击 **Create**
|
||||
|
||||
<Image alt="创建 Auth0 应用 S2" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc" />
|
||||
|
||||
### 配置应用设置
|
||||
|
||||
创建后,进入 **Settings** 标签页:
|
||||
|
||||
<Image alt="创建 Auth0 应用 S3" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6" />
|
||||
|
||||
记录:
|
||||
|
||||
- **Domain**(如 `your-tenant.auth0.com`)
|
||||
- **Client ID**
|
||||
- **Client Secret**
|
||||
|
||||
### 配置回调 URL
|
||||
|
||||
在 **Allowed Callback URLs** 中添加:
|
||||
|
||||
<Callout type={'info'}>
|
||||
回调 URL 格式:
|
||||
|
||||
- 本地开发: `http://localhost:3210/api/auth/callback/auth0`
|
||||
- 生产环境: `https://your-domain.com/api/auth/callback/auth0`
|
||||
</Callout>
|
||||
|
||||
<Image alt="创建 Auth0 应用 S4" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9" />
|
||||
|
||||
### 添加用户(可选)
|
||||
|
||||
点击 **User Management** 为组织创建用户。
|
||||
|
||||
<Image alt="添加用户" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96" />
|
||||
|
||||
### 配置环境变量
|
||||
|
||||
| 环境变量 | 类型 | 描述 |
|
||||
| -------------------------------- | -- | -------------------------------------- |
|
||||
| `AUTH_SECRET` | 必选 | 会话加密密钥,使用 `openssl rand -base64 32` 生成 |
|
||||
| `AUTH_SSO_PROVIDERS` | 必选 | 填写 `auth0` |
|
||||
| `AUTH_AUTH0_ID` | 必选 | Client ID |
|
||||
| `AUTH_AUTH0_SECRET` | 必选 | Client Secret |
|
||||
| `AUTH_AUTH0_ISSUER` | 必选 | `https://your-tenant.auth0.com` |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#auth0)
|
||||
可查阅相关变量详情。
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout type={'info'}>
|
||||
部署成功后,用户将可以通过 Auth0 身份认证并使用 LobeChat。
|
||||
</Callout>
|
||||
|
||||
## 高级配置
|
||||
|
||||
### 连接现有 SSO 服务
|
||||
|
||||
如果组织已有身份认证基础设施,在 **Applications** > **SSO Integrations** 中连接 SSO 服务。
|
||||
|
||||
Auth0 支持 Azure AD、Slack、Google Workspace、Office 365、Zoom 等。详见 [Auth0 SSO Integrations](https://marketplace.auth0.com/features/sso-integrations)。
|
||||
|
||||
<Image alt="连接现有 SSO 服务" src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec" />
|
||||
|
||||
### 配置社交登录
|
||||
|
||||
在 **Authentication** > **Social** 中配置社交登录。
|
||||
|
||||
<Image alt="配置社交登录" src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa" />
|
||||
|
||||
<Callout type={'warning'}>
|
||||
默认社交登录允许任何人认证。请配置阻止策略以限制访问。
|
||||
</Callout>
|
||||
|
||||
<Callout type={'warning'}>
|
||||
创建 GitHub 连接时,务必在 **Attributes** 部分勾选 **Email Address** 权限。LobeChat 需要用户邮箱进行身份认证。
|
||||
|
||||
<Image alt="GitHub 连接邮箱权限" src="https://hub-apac-1.lobeobjects.space/docs/afdf22891dda3e5e44c690db184c548e.png" />
|
||||
</Callout>
|
||||
|
||||
## 相关资源
|
||||
|
||||
- [Auth0 Dashboard](https://manage.auth0.com/dashboard)
|
||||
- [Auth0 文档](https://auth0.com/docs)
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
title: Configuring Authelia Authentication for LobeChat
|
||||
description: >-
|
||||
Learn how to configure Authelia SSO for LobeChat, including setting up OIDC
|
||||
client and environment variables.
|
||||
tags:
|
||||
- Authelia
|
||||
- Authentication
|
||||
- LobeChat
|
||||
- Single Sign-On
|
||||
- OIDC
|
||||
---
|
||||
|
||||
# Configuring Authelia Authentication
|
||||
|
||||
[Authelia](https://www.authelia.com/) is an open-source authentication and authorization server providing two-factor authentication and single sign-on.
|
||||
|
||||
<Steps>
|
||||
### Configure OIDC Client in Authelia
|
||||
|
||||
Add a new OIDC client in your Authelia configuration file:
|
||||
|
||||
```yaml
|
||||
identity_providers:
|
||||
oidc:
|
||||
clients:
|
||||
- client_id: 'lobechat'
|
||||
client_name: 'LobeChat'
|
||||
client_secret: 'your-client-secret'
|
||||
redirect_uris:
|
||||
- 'https://your-domain.com/api/auth/callback/authelia'
|
||||
scopes:
|
||||
- 'openid'
|
||||
- 'profile'
|
||||
- 'email'
|
||||
```
|
||||
|
||||
<Callout type={'info'}>
|
||||
**Callback URL Format**: `https://your-domain.com/api/auth/callback/authelia`
|
||||
</Callout>
|
||||
|
||||
### Configure Environment Variables
|
||||
|
||||
When deploying LobeChat, you need to configure the following environment variables:
|
||||
|
||||
| Environment Variable | Type | Description |
|
||||
| -------------------------------- | -------- | ----------------------------------------------------------------------------- |
|
||||
| `AUTH_SECRET` | Required | Key used to encrypt session tokens. Generate using: `openssl rand -base64 32` |
|
||||
| `AUTH_SSO_PROVIDERS` | Required | SSO provider for LobeChat. Use `authelia` for Authelia |
|
||||
| `AUTH_AUTHELIA_ID` | Required | Client ID configured in Authelia |
|
||||
| `AUTH_AUTHELIA_SECRET` | Required | Client Secret configured in Authelia |
|
||||
| `AUTH_AUTHELIA_ISSUER` | Required | Authelia issuer URL (e.g., `https://auth.your-domain.com`) |
|
||||
|
||||
<Callout type={'tip'}>
|
||||
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#authelia) for detailed information on these variables.
|
||||
</Callout>
|
||||
</Steps>
|
||||
|
||||
<Callout type={'info'}>
|
||||
After successful deployment, users will be able to authenticate with Authelia and use LobeChat.
|
||||
</Callout>
|
||||
|
||||
## Related Resources
|
||||
|
||||
- [Authelia Documentation](https://www.authelia.com/docs/)
|
||||
- [Authelia OIDC Configuration](https://www.authelia.com/configuration/identity-providers/openid-connect/)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user