✨ feat: Update Remark (#5340)

* ✨ feat: Update Remark

* 📝 docs: Update seo

* 🔧 chore: Fix deps

* 🔧 chore: Update ui version

* 📝 docs: Update docs

* ✨ feat: Update @lobehub/ui to 1.163.0
This commit is contained in:
CanisMinor
2025-01-08 21:32:57 +08:00
committed by GitHub
parent 45aac54df6
commit 2c3331a591
317 changed files with 5244 additions and 8105 deletions
+6
View File
@@ -0,0 +1,6 @@
const config = require('@lobehub/lint').remarklint;
module.exports = {
...config,
plugins: ['remark-mdx', ...config.plugins],
};
@@ -4,6 +4,11 @@ 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.
tags:
- LobeChat
- Plugins
- Real-time Information
- Voice Options
---
# Supported Plugin System
@@ -1,6 +1,11 @@
---
title: LobeChat 插件生态系统 - 功能扩展与开发资源
description: 了解 LobeChat 插件生态系统如何增强 LobeChat 助手的实用性和灵活性,以及提供的开发资源和插件开发指南。
tags:
- LobeChat
- 插件系统
- 实时信息
- 第三方服务
---
# 支持插件系统
@@ -7,6 +7,12 @@ description: >-
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
- GPT-4 Vision
- Google Gemini Pro
- Multimodal Interaction
---
# Supported Models for Visual Recognition
@@ -1,6 +1,12 @@
---
title: LobeChat 支持多模态交互:视觉识别助力智能对话
description: LobeChat 支持多种具有视觉识别能力的大语言模型,用户可上传或拖拽图片,助手将识别内容并展开智能对话,打造更智能、多元化的聊天场景。
tags:
- 视觉识别
- 多模态交互
- LobeChat
- GPT-4
- Google Gemini Pro
---
# 支持模型视觉识别
+6
View File
@@ -4,6 +4,12 @@ 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.
tags:
- TTS
- STT
- Voice Conversations
- LobeChat
- Audio Technology
---
# Supporting TTS & STT Voice Conversations
@@ -1,6 +1,13 @@
---
title: LobeChat 文生图:文本转图片生成技术
description: LobeChat 支持文字转语音(TTS)和语音转文字(STT)技术,提供高品质声音选项,个性化交流体验。了解更多关于 Lobe TTS 工具包。
tags:
- TTS
- STT
- 语音会话
- LobeChat
- 文字转语音
- 语音转文字
---
# 支持 TTS & STT 语音会话
+6
View File
@@ -6,6 +6,12 @@ description: >-
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
- AI Tools
- DALL-E 3
- MidJourney
---
# Support for Text-to-Image Generation
@@ -3,6 +3,10 @@ title: LobeChat 文生图:文本转图片生成技术
description: >-
LobeChat 现在支持最新的文本到图片生成技术,让用户可以在与助手对话中直接调用文生图工具进行创作。利用 DALL-E 3、MidJourney 和
Pollinations 等 AI 工具,助手们可以将你的想法转化为图像,让创作过程更私密和沉浸式。
tags:
- Text to Image
- 文生图
- AI 创作
---
# 支持 Text to Image 文生图
+6
View File
@@ -3,6 +3,12 @@ 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.
tags:
- User Management
- Next-Auth
- Clerk
- Authentication
- Multi-Factor Authentication
---
# Support for Multi-User Management with Clerk and Next-Auth
@@ -1,6 +1,12 @@
---
title: LobeChat 支持 Clerk 与 Next-Auth 多用户管理支持
description: LobeChat 提供 Clerk 和 Next-Auth 等多种用户认证和管理方案,以满足不同用户的需求。
tags:
- 用户管理
- 身份验证
- next-auth
- Clerk
- 多因素认证
---
# 支持 Clerk 与 Next-Auth 多用户管理支持
+6
View File
@@ -1,6 +1,12 @@
---
title: LobeChat Supports Ollama for Local Large Language Model (LLM) Calls
description: LobeChat v0.127.0 supports using Ollama to call local large language models.
tags:
- Ollama AI
- LobeChat
- Local LLMs
- AI Conversations
- GPT-4
---
# Support for Ollama Calls to Local Large Language Models 🦙
@@ -1,6 +1,11 @@
---
title: LobeChat 支持 Ollama 调用本地大语言模型(LLM)
description: LobeChat vLobeChat v0.127.0 支持 Ollama 调用本地大语言模型。
tags:
- Ollama AI
- LobeChat
- 大语言模型
- AI 对话
---
# 支持 Ollama 调用本地大语言模型 🦙
@@ -4,6 +4,12 @@ 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.
tags:
- LobeChat
- Version 1.0
- Server-Side Database
- User Authentication
- Cloud Beta Testing
---
# LobeChat 1.0: New Architecture and New Possibilities
@@ -3,6 +3,11 @@ title: LobeChat 1.0:新的架构与新的可能
description: >-
LobeChat 1.0 带来了服务端数据库、用户鉴权管理的全新架构与特性,开启了新的可能 。在此基础上, LobeChat Cloud 开启 Beta
版测试。
tags:
- LobeChat
- 服务端数据库
- 用户鉴权
- Beta 测试
---
# LobeChat 1.0:新的架构与新的可能
@@ -4,6 +4,11 @@ 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.
tags:
- LobeChat
- GPT-4o Mini
- AI Conversation
- Cloud Service
---
# GPT-4o Mini Makes a Stunning Debut, Ushering in a New GPT-4 Era 🚀
@@ -3,6 +3,10 @@ title: LobeChat 全面进入 GPT-4 时代:GPT-4o mini 正式上线
description: >-
LobeChat v1.6 重磅发布 GPT-4o mini 支持,同时 LobeChat Cloud 服务全面升级默认模型,为用户带来更强大的 AI
对话体验。
tags:
- LobeChat
- GPT-4o mini
- AI 对话服务
---
# GPT-4o mini 震撼登场,开启全新 GPT-4 时代 🚀
@@ -4,6 +4,12 @@ description: >-
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
- Cloud Deployment
- Database
- Postgres
---
# LobeChat Database Docker Image: The Final Piece of the Cloud Deployment Puzzle
@@ -1,6 +1,11 @@
---
title: LobeChat Database Docker 镜像正式发布
description: LobeChat v1.8.0 推出官方数据库 Docker 镜像,支持云端数据同步与用户管理,并提供完整的自部署文档指南。
tags:
- LobeChat
- Docker 镜像
- 云端部署
- 数据库
---
# LobeChat Database Docker 镜像:云端部署的最后一块拼图
@@ -6,6 +6,12 @@ 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.
tags:
- LobeChat
- Knowledge Base
- File Management
- Open Source
- Cloud Version
---
# Major Release of Knowledge Base Feature: A Revolution in Intelligent File Management and Dialogue
@@ -1,6 +1,11 @@
---
title: LobeChat 重磅发布知识库功能:打造智能文件管理与对话新体验
description: LobeChat 推出全新知识库功能,支持全类型文件管理、智能向量化和文件对话,让知识管理和信息检索更轻松、更智能。
tags:
- LobeChat
- 知识库
- 文件管理
- 智能处理
---
# 知识库功能重磅发布:智能文件管理与对话的革新
@@ -3,6 +3,12 @@ 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.
tags:
- OpenAI O1
- LobeChat
- AI Models
- Code Writing
- Mathematical Problem Solving
---
# OpenAI O1 Series Models Now Available on LobeChat
@@ -1,6 +1,12 @@
---
title: LobeChat 完美适配 OpenAI O1 系列模型
description: LobeChat v1.17.0 现已支持 OpenAI 最新发布的 o1-preview 和 o1-mini 模型,为用户带来更强大的代码和数学能力。
tags:
- OpenAI O1
- LobeChat
- AI 模型
- 代码编写
- 数学问题
---
# OpenAI O1 系列模型现已登陆 LobeChat
+6
View File
@@ -4,6 +4,12 @@ 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.
tags:
- LobeChat
- AI Assistant
- Artifacts
- GitHub Models
- Interactive Experience
---
# Major Update: LobeChat Enters the Era of Artifacts
@@ -3,6 +3,12 @@ title: 重磅更新:LobeChat 迎来 Artifacts 时代
description: >-
LobeChat v1.19 带来了重大更新,包括 Claude Artifacts 完整特性支持、全新的发现页面设计,以及 GitHub Models
服务商支持,让 AI 助手的能力得到显著提升。
tags:
- LobeChat
- Artifacts
- AI 助手
- 更新
- GitHub Models
---
# 重磅更新:LobeChat 迎来 Artifacts 时代
@@ -4,6 +4,11 @@ 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.
tags:
- Persistent Assistant
- Sidebar Feature
- User Experience
- Workflow Optimization
---
# Persistent Assistant Sidebar: Creating a More Convenient Conversation Experience
@@ -1,6 +1,10 @@
---
title: LobeChat 新增助手常驻侧边栏功能
description: LobeChat v1.26.0 推出助手常驻侧边栏功能,支持快捷键切换,让高频使用的助手触手可及,大幅提升使用效率。
tags:
- 助手常驻侧边栏
- 对话体验
- 工作效率
---
# 助手常驻侧边栏:打造更便捷的对话体验
@@ -5,6 +5,10 @@ description: >-
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
- OpenAI JSON
---
# Upgraded Conversation Sharing: Support for Text Format Export
@@ -3,6 +3,10 @@ title: LobeChat 支持分享对话为文本格式(Markdown/JSON)
description: >-
LobeChat v1.28.0 新增 Markdown 和 OpenAI 格式 JSON
导出支持,让对话内容能轻松转化为笔记素材、开发调试数据和训练语料,显著提升对话内容的复用价值。
tags:
- 对话内容
- Markdown导出
- OpenAI JSON
---
# 对话内容分享升级:支持文本格式导出
@@ -3,6 +3,13 @@ title: New Model Providers Added to LobeChat in November
description: >-
LobeChat model providers now support Gitee AI, InternLM (ShuSheng PuYu), xAI,
and Cloudflare WorkersAI
tags:
- LobeChat
- AI Model Providers
- Gitee AI
- InternLM
- xAI
- Cloudflare Workers AI
---
# New Model Providers Added to LobeChat in November 🎉
@@ -1,6 +1,13 @@
---
title: LobeChat 11 月新增模型服务
description: 'LobeChat 模型服务新增支持 Gitee AI, InternLM (书生浦语), xAI, Cloudflare WorkersAI'
tags:
- LobeChat
- AI模型服务
- Gitee AI
- InternLM
- xAI
- Cloudflare Workers AI
---
# LobeChat 11 月新增模型服务支持 🎉
@@ -3,6 +3,10 @@ title: LobeChat Supports Branching Conversations
description: >-
LobeChat now allows you to create new conversation branches from any message,
freeing your thoughts.
tags:
- Branching Conversations
- LobeChat
- Chat Features
---
# Exciting Launch of Branching Conversations Feature 🎉
@@ -1,6 +1,11 @@
---
title: LobeChat 支持分支对话
description: LobeChat 现已支持从任意消息创建新的对话分支,让您的思维不再受限
tags:
- LobeChat
- 分支对话
- 对话功能
- 用户体验
---
# 重磅推出分支对话功能 🎉
@@ -3,6 +3,11 @@ title: LobeChat Supports User Data Statistics and Activity Sharing
description: >-
LobeChat now supports multi-dimensional user data statistics and activity
sharing
tags:
- LobeChat
- User Statistics
- Activity Sharing
- AI Data
---
# User Data Statistics and Activity Sharing 💯
@@ -1,6 +1,10 @@
---
title: LobeChat 支持用户数据统计与活跃度分享
description: LobeChat 现已支持多维度用户数据统计与活跃度分享
tags:
- 用户数据统计
- 活跃度分享
- LobeChat
---
# 用户数据统计与活跃度分享 💯
@@ -23,4 +27,3 @@ description: LobeChat 现已支持多维度用户数据统计与活跃度分享
1. 需要使用 `PgLite` 或 `数据库` 模式
2. 点击个人头像进入「账户管理」-「数据统计」页面
+14 -13
View File
@@ -27,28 +27,29 @@ By setting the environment variables `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CL
Before using NextAuth, please set the following variables in LobeChat's environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_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. |
| `NEXTAUTH_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`. |
| Environment Variable | Type | Description |
| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_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. |
| `NEXTAUTH_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`. |
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/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/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'} />
</Cards>
+15 -14
View File
@@ -24,28 +24,29 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
在使用 NextAuth 之前,请先在 LobeChat 的环境变量中设置以下变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令: `openssl rand -base64 32`,或者访问 `https://generate-secret.vercel.app/32` 生成秘钥。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| `NEXT_AUTH_SSO_PROVIDERS` | 可选 | 该环境变量用于同时启用多个身份验证源,以逗号 `,` 分割,例如 `auth0,microsoft-entra-id,authentik`。 |
目前支持的身份验证服务有:
<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/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/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'} />
</Cards>
@@ -57,7 +58,7 @@ LobeChat 与 Clerk 做了深度集成,能够为用户提供一个更加安全
顺序为 SSO 提供商的显示顺序。
| SSO 提供商 | 值 |
| SSO 提供商 | 值 |
| --------------------- | ----------------------- |
| Auth0 | `auth0` |
| Authenlia | `authenlia` |
+25 -41
View File
@@ -11,67 +11,51 @@ tags:
# Configure Clerk Authentication Service
Go to [Clerk](https://clerk.com?utm_source=lobehub&utm_medium=docs) to register and create an application to obtain the corresponding Public Key and Secret Key.
Go to [Clerk](https://clerk.com?utm_source=lobehub\&utm_medium=docs) to register and create an application to obtain the corresponding Public Key and Secret Key.
## Get Environment Variables
<Steps>
### Add Public and Private Key Environment Variables
### Add Public and Private Key Environment Variables
Add `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` environment variables. You can click on the "API Keys" in the menu and copy the corresponding values to get these environment variables.
Add `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` environment variables. You can click on the "API Keys" in the menu and copy the corresponding values to get these environment variables.
<Image alt={'Find the corresponding public and private key environment variables in Clerk'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'} />
<Image
alt={'Find the corresponding public and private key environment variables in Clerk'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'}
/>
The environment variables required for this step are as follows:
The environment variables required for this step are as follows:
```shell
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
```
```shell
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
```
### Create and Configure Webhook in Clerk
### Create and Configure Webhook in Clerk
Since we let Clerk fully handle user authentication and management, we need Clerk to notify our application and store the changes in the user lifecycle (create, update, delete). We achieve this by using the Webhook provided by Clerk.
Since we let Clerk fully handle user authentication and management, we need Clerk to notify our application and store the changes in the user lifecycle (create, update, delete). We achieve this by using the Webhook provided by Clerk.
We need to add an endpoint in Clerk's Webhooks to inform Clerk to send notifications to this endpoint when a user's information changes.
We need to add an endpoint in Clerk's Webhooks to inform Clerk to send notifications to this endpoint when a user's information changes.
<Image alt={'Add Webhooks endpoint in Clerk'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'} />
<Image
alt={'Add Webhooks endpoint in Clerk'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'}
/>
Fill in your project URL in the endpoint, such as `https://your-project.com/api/webhooks/clerk`. Then, subscribe to events by checking the three user events (`user.created`, `user.deleted`, `user.updated`), and click create.
Fill in your project URL in the endpoint, such as `https://your-project.com/api/webhooks/clerk`. Then, subscribe to events by checking the three user events (`user.created`, `user.deleted`, `user.updated`), and click create.
<Callout type={'warning'}>
The `https://` in the URL is essential to maintain the integrity of the URL.
</Callout>
<Callout type={'warning'}>
<Image alt={'Configure URL and user events when adding Clerk Webhooks'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'} />
The `https://` in the URL is essential to maintain the integrity of the URL.
### Add Webhook Secret to Environment Variables
</Callout>
After creating, you can find the secret of this Webhook in the bottom right corner:
<Image
alt={'Configure URL and user events when adding Clerk Webhooks'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'}
/>
<Image alt={'View Clerk Webhooks secret'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'} />
### Add Webhook Secret to Environment Variables
After creating, you can find the secret of this Webhook in the bottom right corner:
<Image
alt={'View Clerk Webhooks secret'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'}
/>
The environment variable corresponding to this secret is `CLERK_WEBHOOK_SECRET`:
```shell
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
```
The environment variable corresponding to this secret is `CLERK_WEBHOOK_SECRET`:
```shell
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
```
</Steps>
By following these steps, you have successfully configured the Clerk authentication service.
+23 -37
View File
@@ -10,63 +10,49 @@ tags:
# 配置 Clerk 身份验证服务
前往 [Clerk](https://clerk.com?utm_source=lobehub&utm_medium=docs) 注册并创建应用,获取相应的 Public Key 和 Secret Key。
前往 [Clerk](https://clerk.com?utm_source=lobehub\&utm_medium=docs) 注册并创建应用,获取相应的 Public Key 和 Secret Key。
## 获取环境变量
<Steps>
### 添加公、私钥环境变量
### 添加公、私钥环境变量
添加 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY` 环境变量。你可以在菜单中点击「API Keys」,然后复制对应的值获取该环境变量。
添加 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY` 环境变量。你可以在菜单中点击「API Keys」,然后复制对应的值获取该环境变量。
<Image alt={'在 Clerk 中找到对应的公私钥环境变量'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'} />
<Image
alt={'在 Clerk 中找到对应的公私钥环境变量'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/89883703-7a1a-4a11-b944-5d804544e57c'}
/>
此步骤所需的环境变量如下:
此步骤所需的环境变量如下:
```shell
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
```
```shell
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
```
### 在 Clerk 中创建并配置 Webhook
### 在 Clerk 中创建并配置 Webhook
由于我们让 Clerk 完全接管用户鉴权与管理,因此我们需要在 Clerk 用户生命周期变更时(创建、更新、删除)中通知我们的应用并存储落库。我们通过 Clerk 提供的 Webhook 来实现这一诉求。
由于我们让 Clerk 完全接管用户鉴权与管理,因此我们需要在 Clerk 用户生命周期变更时(创建、更新、删除)中通知我们的应用并存储落库。我们通过 Clerk 提供的 Webhook 来实现这一诉求。
我们需要在 Clerk 的 Webhooks 中添加一个端点(Endpoint),告诉 Clerk 当用户发生变更时,向这个端点发送通知。
我们需要在 Clerk 的 Webhooks 中添加一个端点(Endpoint),告诉 Clerk 当用户发生变更时,向这个端点发送通知。
<Image alt={'Clerk 添加 Webhooks 端点'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'} />
<Image
alt={'Clerk 添加 Webhooks 端点'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9'}
/>
在 endppint 中填写你的项目 URL,如 `https://your-project.com/api/webhooks/clerk`。然后在订阅事件(Subscribe to events)中,勾选 user 的三个事件(`user.created` 、`user.deleted`、`user.updated`),然后点击创建。
在 endppint 中填写你的项目 URL,如 `https://your-project.com/api/webhooks/clerk`。然后在订阅事件(Subscribe to events)中,勾选 user 的三个事件(`user.created` 、`user.deleted`、`user.updated`),然后点击创建。
<Callout type={'warning'}>URL 的`https://`不可缺失,须保持 URL 的完整性</Callout>
<Callout type={'warning'}>URL的`https://`不可缺失,须保持URL的完整性</Callout>
<Image alt={'添加 Clerk Webhooks 时,配置 URL 和用户事件'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'} />
<Image
alt={'添加 Clerk Webhooks 时,配置 URL 和用户事件'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645'}
/>
### 将 Webhook 秘钥添加到环境变量
### 将 Webhook 秘钥添加到环境变量
创建完毕后,可以在右下角找到该 Webhook 的秘钥:
创建完毕后,可以在右下角找到该 Webhook 的秘钥:
<Image alt={'查看 Clerk Webhooks 秘钥'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'} />
<Image
alt={'查看 Clerk Webhooks 秘钥'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/fab4abb2-584b-49de-9340-813382951635'}
/>
这个秘钥所对应的环境变量名为 `CLERK_WEBHOOK_SECRET`:
```shell
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
```
这个秘钥所对应的环境变量名为 `CLERK_WEBHOOK_SECRET`:
```shell
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
```
</Steps>
这样,你已经成功配置了 Clerk 身份验证服务。
@@ -19,74 +19,53 @@ tags:
<Steps>
### Create Auth0 Application
Register and log in to [Auth0][auth0-client-page], click on the "Applications" in the left navigation bar to switch to the application management interface, and click "Create Application" in the upper right corner to create an application.
Register and log in to [Auth0][auth0-client-page], click on the "Applications" in the left navigation bar to switch to the application management interface, and click "Create Application" in the upper right corner to create an application.
<Image
alt="Create Auth0 Application S1"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86"
/>
<Image alt="Create Auth0 Application S1" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86" />
Fill in the application name you want to display to the organization users, choose any application type, and click "Create".
Fill in the application name you want to display to the organization users, choose any application type, and click "Create".
<Image
alt="Create Auth0 Application S2"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc"
/>
<Image alt="Create Auth0 Application S2" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc" />
After successful creation, click on the corresponding application to enter the application details page, switch to the "Settings" tab, and you can see the corresponding configuration information.
After successful creation, click on the corresponding application to enter the application details page, switch to the "Settings" tab, and you can see the corresponding configuration information.
<Image
alt="Create Auth0 Application S3"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6"
/>
<Image alt="Create Auth0 Application S3" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6" />
In the application configuration page, you also need to configure Allowed Callback URLs, where you should fill in:
In the application configuration page, you also need to configure Allowed Callback URLs, where you should fill in:
```bash
http(s)://your-domain/api/auth/callback/auth0
```
```bash
http(s)://your-domain/api/auth/callback/auth0
```
<Image
alt="Create Auth0 Application S4"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9"
/>
<Image alt="Create Auth0 Application S4" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9" />
<Callout type={'important'}>
You can fill in or modify Allowed Callback URLs after deployment, but make sure the filled URL is
consistent with the deployed URL.
</Callout>
<Callout type={'important'}>
You can fill in or modify Allowed Callback URLs after deployment, but make sure the filled URL is
consistent with the deployed URL.
</Callout>
### Add Users
### Add Users
Click on the "Users Management" in the left navigation bar to enter the user management interface, where you can create users for your organization to log in to LobeChat.
Click on the "Users Management" in the left navigation bar to enter the user management interface, where you can create users for your organization to log in to LobeChat.
<Image
alt="Add Users"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96"
/>
<Image alt="Add Users" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96" />
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. |
| `AUTH_AUTH0_ID` | Required | Client ID of the Auth0 application |
| `AUTH_AUTH0_SECRET` | Required | Client Secret of the Auth0 application |
| `AUTH_AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |
| `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
| Environment Variable | Type | Description |
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. |
| `AUTH_AUTH0_ID` | Required | Client ID of the Auth0 application |
| `AUTH_AUTH0_SECRET` | Required | Client Secret of the Auth0 application |
| `AUTH_AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |
| `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variable#auth0).
</Callout>
</Callout>
</Steps>
<Callout>
@@ -102,19 +81,13 @@ If your enterprise or organization already has a unified identity authentication
Auth0 supports single sign-on services such as Azure Active Directory, Slack, Google Workspace, Office 365, Zoom, and more. For a detailed list of supported services, please refer to [this link][auth0-sso-integrations].
<Image
alt="Connecting to an Existing Single Sign-On Service"
src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec"
/>
<Image alt="Connecting to an Existing Single Sign-On Service" src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec" />
### Configuring Social Login
If your enterprise or organization needs to support external user logins, you can configure social login services in Authentication -> Social.
<Image
alt="Configuring Social Login"
src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa"
/>
<Image alt="Configuring Social Login" src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa" />
<Callout type={'warning'}>
Configuring social login services by default allows anyone to authenticate, which may lead to
@@ -15,73 +15,52 @@ tags:
<Steps>
### 创建 Auth0 应用
注册并登录 [Auth0](https://manage.auth0.com/dashboard),点击左侧导航栏的「Applications」,切换到应用管理界面,点击右上角「Create Application」以创建应用。
注册并登录 [Auth0](https://manage.auth0.com/dashboard),点击左侧导航栏的「Applications」,切换到应用管理界面,点击右上角「Create Application」以创建应用。
<Image
alt="创建 Auth0 应用 S1"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86"
/>
<Image alt="创建 Auth0 应用 S1" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/f068190f-0027-4d3b-8667-d632e43d5a86" />
填写你想向组织用户显示的应用名称,可选择任意应用类型,点击「Create」。
填写你想向组织用户显示的应用名称,可选择任意应用类型,点击「Create」。
<Image
alt="创建 Auth0 应用 S2"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc"
/>
<Image alt="创建 Auth0 应用 S2" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/3e0082df-9b6f-46f3-b67f-bdc79e1eb2cc" />
创建成功后,点击相应的应用,进入应用详情页,切换到「Settings」标签页,就可以看到相应的配置信息
创建成功后,点击相应的应用,进入应用详情页,切换到「Settings」标签页,就可以看到相应的配置信息
<Image
alt="创建 Auth0 应用 S3"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6"
/>
<Image alt="创建 Auth0 应用 S3" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/df4cea85-616a-46f5-b2de-42725d9b82a6" />
在应用配置页面中,还需要配置 Allowed Callback URLs,在此处填写:
在应用配置页面中,还需要配置 Allowed Callback URLs,在此处填写:
```bash
http(s)://your-domain/api/auth/callback/auth0
```
```bash
http(s)://your-domain/api/auth/callback/auth0
```
<Image
alt="创建 Auth0 应用 S4"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9"
/>
<Image alt="创建 Auth0 应用 S4" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/62fbd09f-a69a-4460-949b-0f6285fa65b9" />
<Callout type={'important'}>
可以在部署后再填写或修改 Allowed Callback URLs,但是务必保证填写的 URL 与部署的 URL 一致
</Callout>
<Callout type={'important'}>
可以在部署后再填写或修改 Allowed Callback URLs,但是务必保证填写的 URL 与部署的 URL 一致
</Callout>
### 新增用户
### 新增用户
点击左侧导航栏的「Users Management」,进入用户管理界面,可以为你的组织新建用户,用以登录 LobeChat
点击左侧导航栏的「Users Management」,进入用户管理界面,可以为你的组织新建用户,用以登录 LobeChat
<Image
alt="新增用户"
inStep
src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96"
/>
<Image alt="新增用户" inStep src="https://github.com/lobehub/lobe-chat/assets/30863298/0beda150-d0b6-43cf-a9f1-fce928b83a96" />
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Auth0 请填写 `auth0`。 |
| `AUTH_AUTH0_ID` | 必选 | Auth0 应用程序的 Client ID |
| `AUTH_AUTH0_SECRET` | 必选 | Auth0 应用程序的 Client Secret |
| `AUTH_AUTH0_ISSUER` | 必选 | Auth0 应用程序的 Domain,`https://example.auth0.com` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Auth0 请填写 `auth0`。 |
| `AUTH_AUTH0_ID` | 必选 | Auth0 应用程序的 Client ID |
| `AUTH_AUTH0_SECRET` | 必选 | Auth0 应用程序的 Client Secret |
| `AUTH_AUTH0_ISSUER` | 必选 | Auth0 应用程序的 Domain,`https://example.auth0.com` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#auth-0) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -96,19 +75,13 @@ http(s)://your-domain/api/auth/callback/auth0
Auth0 支持 Azure Active Directory / Slack / Google Workspace / Office 365 / Zoom 等单点登录服务,详细支持列表可参考 [这里](https://marketplace.auth0.com/features/sso-integrations)
<Image
alt="Connecting to an Existing Single Sign-On Service"
src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec"
/>
<Image alt="Connecting to an Existing Single Sign-On Service" src="https://github.com/lobehub/lobe-chat/assets/30863298/9891347e-a338-4aa9-8714-f16c8dbcfcec" />
### 配置社交登录
如果你的企业或组织需要支持外部人员登录,可以在 Authentication -> Social 中,配置社交登录服务。
<Image
alt="Configuring Social Login"
src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa"
/>
<Image alt="Configuring Social Login" src="https://github.com/lobehub/lobe-chat/assets/30863298/880749a6-5ba4-4e20-a968-b583a54de7fa" />
<Callout type={'warning'}>
配置社交登录服务默认会允许所有人通过认证,这可能会导致 LobeChat 被外部人员滥用。
@@ -17,54 +17,54 @@ tags:
## Authelia Configuration Flow
<Steps>
### Create an Authelia Identity Provider
### Create an Authelia Identity Provider
We assume you are already familiar with using Authelia. Let's say your LobeChat instance is deployed at https://lobe.example.com/. Note that currently only localhost supports HTTP access; other domains need to enable TLS, otherwise Authelia will actively interrupt authentication by default.
We assume you are already familiar with using Authelia. Let's say your LobeChat instance is deployed at [https://lobe.example.com/](https://lobe.example.com/). Note that currently only localhost supports HTTP access; other domains need to enable TLS, otherwise Authelia will actively interrupt authentication by default.
Now, let's open and edit the configuration file of your Authelia instance:
Now, let's open and edit the configuration file of your Authelia instance:
Add a new lobe-chat item under identity_providers -> oidc:
Add a new lobe-chat item under `identity_providers` -> `oidc`:
```yaml
identity_providers:
oidc:
...
## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
## See: https://www.authelia.com/c/oidc
- id: lobe-chat
description: LobeChat
secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
public: false
authorization_policy: two_factor
redirect_uris:
- https://chat.example.com/api/auth/callback/authelia
scopes:
- openid
- profile
- email
userinfo_signing_algorithm: none
```
```yaml
identity_providers:
oidc:
...
## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
## See: https://www.authelia.com/c/oidc
- id: lobe-chat
description: LobeChat
secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
public: false
authorization_policy: two_factor
redirect_uris:
- https://chat.example.com/api/auth/callback/authelia
scopes:
- openid
- profile
- email
userinfo_signing_algorithm: none
```
Make sure to replace secret and redirect_urls with your own values. Note! The secret configured in Authelia is ciphertext, i.e., a salted hash value. Its corresponding plaintext needs to be filled in LobeChat later.
Make sure to replace secret and `redirect_urls` with your own values. Note! The secret configured in Authelia is ciphertext, i.e., a salted hash value. Its corresponding plaintext needs to be filled in LobeChat later.
Save the configuration file and restart the Authelia service. Now we have completed the Authelia configuration.
Save the configuration file and restart the Authelia service. Now we have completed the Authelia configuration.
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
| `AUTH_AUTHELIA_ID` | Required | The id just configured in Authelia, example value is lobe-chat |
| `AUTH_AUTHELIA_SECRET` | Required | The plaintext corresponding to the secret just configured in Authelia, example value is insecure_secret |
| `AUTH_AUTHELIA_ISSUER` | Required | Your Authelia URL, for example https://sso.example.com |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth verification. It only needs to be set when the default generated redirect address is incorrect. https://chat.example.com/api/auth |
| Environment Variable | Type | Description |
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
| `AUTH_AUTHELIA_ID` | Required | The id just configured in Authelia, example value is lobe-chat |
| `AUTH_AUTHELIA_SECRET` | Required | The plaintext corresponding to the secret just configured in Authelia, example value is `insecure_secret` |
| `AUTH_AUTHELIA_ISSUER` | Required | Your Authelia URL, for example [https://sso.example.com](https://sso.example.com) |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth verification. It only needs to be set when the default generated redirect address is incorrect. [https://chat.example.com/api/auth](https://chat.example.com/api/auth) |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authelia) for details about the variables.
</Callout>
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authelia) for details about the variables.
</Callout>
</Steps>
<Callout type={'info'}>
@@ -14,56 +14,55 @@ tags:
## Authelia 配置流程
<Steps>
### 创建 Authelia 提供应用
### 创建 Authelia 提供应用
我们现在默认您已经了解了如何使用 Authelia。假设您的 LobeChat 实例部署在 `https://lobe.example.com/` 中。注意,目前只有 `localhost` 支持 HTTP 访问,其他域名需要启用 TLS,否则 Authelia 默认将主动中断身份认证。
我们现在默认您已经了解了如何使用 Authelia。假设您的 LobeChat 实例部署在 `https://lobe.example.com/` 中。注意,目前只有 `localhost` 支持 HTTP 访问,其他域名需要启用 TLS,否则 Authelia 默认将主动中断身份认证。
现在,我们打开 Authelia 实例的配置文件进行编辑:
现在,我们打开 Authelia 实例的配置文件进行编辑:
在 `identity_providers`-> `oidc` 下新增一个 `lobe-chat` 的项目:
在 `identity_providers`-> `oidc` 下新增一个 `lobe-chat` 的项目:
```yaml
...
identity_providers:
oidc:
...
## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
## See: https://www.authelia.com/c/oidc
- id: lobe-chat
description: LobeChat
secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
public: false
authorization_policy: two_factor
redirect_uris:
- https://chat.example.com/api/auth/callback/authelia
scopes:
- openid
- profile
- email
userinfo_signing_algorithm: none
```
```yaml
...
identity_providers:
oidc:
...
## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
## See: https://www.authelia.com/c/oidc
- id: lobe-chat
description: LobeChat
secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng' # The digest of 'insecure_secret'.
public: false
authorization_policy: two_factor
redirect_uris:
- https://chat.example.com/api/auth/callback/authelia
scopes:
- openid
- profile
- email
userinfo_signing_algorithm: none
```
请您确保 `secret` 和 `redirect_urls` 替换成您自己的值。注意!Authelia 中配置 `secret` 是密文,即加盐哈希值。其对应的明文稍后需要填写在 lobeChat 中。
请您确保 `secret` 和 `redirect_urls` 替换成您自己的值。注意!Authelia 中配置 `secret` 是密文,即加盐哈希值。其对应的明文稍后需要填写在 lobeChat 中。
保存配置文件,然后重启 Authelia 服务。现在我们完成了 Authelia 的配置工作。
保存配置文件,然后重启 Authelia 服务。现在我们完成了 Authelia 的配置工作。
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authelia 请填写 `authelia`。 |
| `AUTH_AUTHELIA_ID` | 必选 | 刚刚在 Authelia 配置的 `id`,示例值是 `lobe-chat` |
| `AUTH_AUTHELIA_SECRET` | 必选 | 刚刚在 Authelia 配置的 `secret` 对应的明文,示例值是 `insecure_secret` |
| `AUTH_AUTHELIA_ISSUER` | 必选 | 您的 Authelia 的网址,例如 `https://sso.example.com` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authelia 请填写 `authelia`。 |
| `AUTH_AUTHELIA_ID` | 必选 | 刚刚在 Authelia 配置的 `id`,示例值是 `lobe-chat` |
| `AUTH_AUTHELIA_SECRET` | 必选 | 刚刚在 Authelia 配置的 `secret` 对应的明文,示例值是 `insecure_secret` |
| `AUTH_AUTHELIA_ISSUER` | 必选 | 您的 Authelia 的网址,例如 `https://sso.example.com` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Authelia) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -19,52 +19,47 @@ tags:
<Steps>
### Create an Authentik Application Provider
In your Authentik instance, use the administrator account to go to **Admin Interface** -> **Applications** -> **Providers** and create a new provider.
In your Authentik instance, use the administrator account to go to **Admin Interface** -> **Applications** -> **Providers** and create a new provider.
Select **OAuth2/OpenID Provider** as the provider type. Fill in the provider name, select the authentication flow and authorization flow.
Select **OAuth2/OpenID Provider** as the provider type. Fill in the provider name, select the authentication flow and authorization flow.
In the `Redirect URL/Origin (regex)` field, fill in:
In the `Redirect URL/Origin (regex)` field, fill in:
```bash
https://your-domain/api/auth/callback/authentik
```
```bash
https://your-domain/api/auth/callback/authentik
```
<Callout type={'info'}>
- You can fill in or modify the `Redirect URL/Origin (regex)` later, but make sure the filled in
URL matches the deployed URL. - Replace `your-domain` with your own domain name
</Callout>
<Callout type={'info'}>
- You can fill in or modify the `Redirect URL/Origin (regex)` later, but make sure the filled in
URL matches the deployed URL. - Replace `your-domain` with your own domain name
</Callout>
<Image
alt="Create Authentik Provider"
inStep
src="https://github.com/lobehub/lobe-chat/assets/67304509/4244634e-5f68-48d5-aac0-e5f4b06d1c4b"
/>
<Image alt="Create Authentik Provider" inStep src="https://github.com/lobehub/lobe-chat/assets/67304509/4244634e-5f68-48d5-aac0-e5f4b06d1c4b" />
Click **Done**
Click **Done**
After the creation is successful, click **Applications** on the left -> **Create**, fill in the name and Slug, select the provider created in the previous step, and click **Create**.
After the creation is successful, click **Applications** on the left -> **Create**, fill in the name and Slug, select the provider created in the previous step, and click **Create**.
After the application provider is created, click the corresponding provider to enter the details page, click **Edit**, and save the `Client ID` and `Client Secret`.
After the application provider is created, click the corresponding provider to enter the details page, click **Edit**, and save the `Client ID` and `Client Secret`.
Copy the URL of `OpenID Configuration Issuer` and save it.
Copy the URL of `OpenID Configuration Issuer` and save it.
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
| `AUTH_AUTHENTIK_ID` | Required | The Client ID from the Authentik application provider details page |
| `AUTH_AUTHENTIK_SECRET` | Required | The Client Secret from the Authentik application provider details page |
| `AUTH_AUTHENTIK_ISSUER` | Required | The OpenID Configuration Issuer from the Authentik application provider details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |
| Environment Variable | Type | Description |
| ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
| `AUTH_AUTHENTIK_ID` | Required | The Client ID from the Authentik application provider details page |
| `AUTH_AUTHENTIK_SECRET` | Required | The Client Secret from the Authentik application provider details page |
| `AUTH_AUTHENTIK_ISSUER` | Required | The OpenID Configuration Issuer from the Authentik application provider details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Authentik) for details about the variables.
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -16,50 +16,45 @@ tags:
<Steps>
### 创建 Authentik 提供应用
在你的 Authentik 实例中使用管理员账号进入 管理员界面 -> 应用程序 -> 提供程序 创建一个新的提供程序。
在你的 Authentik 实例中使用管理员账号进入 管理员界面 -> 应用程序 -> 提供程序 创建一个新的提供程序。
选择 OAuth2/OpenID Provider 作为提供程序类型。填写提供程序的名称,选择身份流程和授权流程。
选择 OAuth2/OpenID Provider 作为提供程序类型。填写提供程序的名称,选择身份流程和授权流程。
在 `重定向 URL/Origin(正则)` 处填写:
在 `重定向 URL/Origin(正则)` 处填写:
```bash
https://your-domain/api/auth/callback/authentik
```
```bash
https://your-domain/api/auth/callback/authentik
```
<Callout type={'info'}>
- 可以之后再填写或修改 `重定向 URL/Origin(正则)`,但是务必保证填写的 URL 与部署的 URL 一致。 -
your-domain 请替换为自己的域名
</Callout>
<Callout type={'info'}>
- 可以之后再填写或修改 `重定向 URL/Origin(正则)`,但是务必保证填写的 URL 与部署的 URL 一致。 -
your-domain 请替换为自己的域名
</Callout>
<Image
alt="创建 Authentik 提供程序"
inStep
src="https://github.com/lobehub/lobe-chat/assets/67304509/4244634e-5f68-48d5-aac0-e5f4b06d1c4b"
/>
<Image alt="创建 Authentik 提供程序" inStep src="https://github.com/lobehub/lobe-chat/assets/67304509/4244634e-5f68-48d5-aac0-e5f4b06d1c4b" />
点击「完成」
点击「完成」
创建成功后,点击左侧的「应用程序」-> 创建,填写名称和 Slug ,提供程序选择上一步创建的提供程序,点击「创建」。
创建成功后,点击左侧的「应用程序」-> 创建,填写名称和 Slug ,提供程序选择上一步创建的提供程序,点击「创建」。
提供程序创建成功后,点击相应的提供程序,进入详情页,点击「编辑」,将 `客户端 ID` 和 `客户端 Secret` 保存下来。复制 `OpenID 配置颁发者` 的 URL,保存下来。
提供程序创建成功后,点击相应的提供程序,进入详情页,点击「编辑」,将 `客户端 ID` 和 `客户端 Secret` 保存下来。复制 `OpenID 配置颁发者` 的 URL,保存下来。
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authentik 请填写 `authentik`。 |
| `AUTH_AUTHENTIK_ID` | 必选 | Authentik 提供程序详情页的 客户端 ID |
| `AUTH_AUTHENTIK_SECRET` | 必选 | Authentik 提供程序详情页的 客户端 Secret |
| `AUTH_AUTHENTIK_ISSUER` | 必选 | Authentik 提供程序详情页的 OpenID 配置颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Authentik 请填写 `authentik`。 |
| `AUTH_AUTHENTIK_ID` | 必选 | Authentik 提供程序详情页的 客户端 ID |
| `AUTH_AUTHENTIK_SECRET` | 必选 | Authentik 提供程序详情页的 客户端 Secret |
| `AUTH_AUTHENTIK_ISSUER` | 必选 | Authentik 提供程序详情页的 OpenID 配置颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Authentik) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -33,93 +33,92 @@ If you are deploying using a public network, the following assumptions apply:
- You privately deploy Casdoor, and its domain is `https://lobe-auth-api.example.com`.
<Steps>
### Create a Casdoor Application
### Create a Casdoor Application
Access your privately deployed Casdoor WebUI (default is `http://localhost:8000/`) to enter the console. The default account is `admin`, and the password is `123`.
Access your privately deployed Casdoor WebUI (default is `http://localhost:8000/`) to enter the console. The default account is `admin`, and the password is `123`.
Go to `Authentication` -> `Applications`, create a `LobeChat` application or directly modify the built-in `built-in` application. You can explore other fields, but you must configure at least the following fields:
Go to `Authentication` -> `Applications`, create a `LobeChat` application or directly modify the built-in `built-in` application. You can explore other fields, but you must configure at least the following fields:
- Name, Display Name: `LobeChat`
- Redirect URLs:
- Local Development Environment: `http://localhost:3210/api/auth/callback/casdoor`
- Local Network IP Deployment: `http://LOBECHAT_IP:3210/api/auth/callback/casdoor`
- Public Network Environment: `https://lobe.example.com/api/auth/callback/casdoor`
- Name, Display Name: `LobeChat`
- Redirect URLs:
- Local Development Environment: `http://localhost:3210/api/auth/callback/casdoor`
- Local Network IP Deployment: `http://LOBECHAT_IP:3210/api/auth/callback/casdoor`
- Public Network Environment: `https://lobe.example.com/api/auth/callback/casdoor`
There are also some optional fields that can enhance user experience:
There are also some optional fields that can enhance user experience:
- Logo: `https://lobehub.com/icon-192x192.png`
- Form CSS, Form CSS (Mobile):
- Logo: `https://lobehub.com/icon-192x192.png`
- Form CSS, Form CSS (Mobile):
```html
<style>
.login-panel {
padding: 40px 70px 0 70px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
}
.panel-logo {
width: 64px;
}
.login-logo-box {
margin-top: 20px;
}
#parent-area
> main
> div
> div.login-content
> div.login-panel
> div.login-form
> div
> div
> button {
box-shadow: none !important;
border-radius: 10px !important;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
border: 1px solid #eee !important;
}
@media (max-width: 640px) {
```html
<style>
.login-panel {
padding: 40px 0 0 0;
box-shadow: none;
padding: 40px 70px 0 70px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
}
.panel-logo {
width: 64px;
}
.login-logo-box {
margin-top: 20px;
}
}
</style>
```
Then, copy the `Client ID` and `Client Secret` and save them.
#parent-area
> main
> div
> div.login-content
> div.login-panel
> div.login-form
> div
> div
> button {
box-shadow: none !important;
border-radius: 10px !important;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
border: 1px solid #eee !important;
}
### Configure Environment Variables
@media (max-width: 640px) {
.login-panel {
padding: 40px 0 0 0;
box-shadow: none;
}
}
Set the obtained `Client ID` and `Client Secret` as `AUTH_CASDOOR_ID` and `AUTH_CASDOOR_SECRET` in the LobeChat environment variables.
</style>
```
Configure `AUTH_CASDOOR_ISSUER` in the LobeChat environment variables as follows:
Then, copy the `Client ID` and `Client Secret` and save them.
- `http://localhost:8000/` if you are in a local development environment.
- `http://CASDOOR_IP:8000/` if you are privately deploying Casdoor in a local network.
- `https://lobe-auth-api.example.com/` if you are deploying Casdoor in a public network environment.
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
Set the obtained `Client ID` and `Client Secret` as `AUTH_CASDOOR_ID` and `AUTH_CASDOOR_SECRET` in the LobeChat environment variables.
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | A key for encrypting Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32`. |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Fill in `casdoor` for using Casdoor. |
| `AUTH_CASDOOR_ID` | Required | The client ID from the Casdoor application details page. |
| `AUTH_CASDOOR_SECRET` | Required | The client secret from the Casdoor application details page. |
| `AUTH_CASDOOR_ISSUER` | Required | The OpenID Connect issuer for the Casdoor provider. |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
Configure `AUTH_CASDOOR_ISSUER` in the LobeChat environment variables as follows:
<Callout type={'tip'}>
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#casdoor) for
details on related variables.
</Callout>
- `http://localhost:8000/` if you are in a local development environment.
- `http://CASDOOR_IP:8000/` if you are privately deploying Casdoor in a local network.
- `https://lobe-auth-api.example.com/` if you are deploying Casdoor in a public network environment.
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | A key for encrypting Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32`. |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. Fill in `casdoor` for using Casdoor. |
| `AUTH_CASDOOR_ID` | Required | The client ID from the Casdoor application details page. |
| `AUTH_CASDOOR_SECRET` | Required | The client secret from the Casdoor application details page. |
| `AUTH_CASDOOR_ISSUER` | Required | The OpenID Connect issuer for the Casdoor provider. |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification and needs to be set only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
<Callout type={'tip'}>
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#casdoor) for
details on related variables.
</Callout>
</Steps>
<Callout type={'info'}>
@@ -30,92 +30,91 @@ tags:
- 你私有部署 Casdoor,其域名为 `https://lobe-auth-api.example.com`。
<Steps>
### 创建 Casdoor 应用
### 创建 Casdoor 应用
访问你私有部署的 Casdoor WebUI(默认为 `http://localhost:8000/`) 进入控制台,默认账号为 `admin`,密码为 `123`。
访问你私有部署的 Casdoor WebUI(默认为 `http://localhost:8000/`) 进入控制台,默认账号为 `admin`,密码为 `123`。
前往 `身份认证` -> `应用`,创建一个 `LobeChat` 应用或直接修改内置的 `built-in` 应用,其他字段可以自行探索,但你至少需要配置以下字段:
前往 `身份认证` -> `应用`,创建一个 `LobeChat` 应用或直接修改内置的 `built-in` 应用,其他字段可以自行探索,但你至少需要配置以下字段:
- 名称、显示名称:`LobeChat`
- 重定向 URLs:
- 本地开发环境:`http://localhost:3210/api/auth/callback/casdoor`
- 局域网 IP 部署:`http://LOBECHAT_IP:3210/api/auth/callback/casdoor`
- 公网环境:`https://lobe.example.com/api/auth/callback/casdoor`
- 名称、显示名称:`LobeChat`
- 重定向 URLs:
- 本地开发环境:`http://localhost:3210/api/auth/callback/casdoor`
- 局域网 IP 部署:`http://LOBECHAT_IP:3210/api/auth/callback/casdoor`
- 公网环境:`https://lobe.example.com/api/auth/callback/casdoor`
还有一些不必需但是可以提高用户体验的字段:
还有一些不必需但是可以提高用户体验的字段:
- Logo:`https://lobehub.com/icon-192x192.png`
- 表单 CSS、表单 CSS(移动端):
- Logo:`https://lobehub.com/icon-192x192.png`
- 表单 CSS、表单 CSS(移动端):
```html
<style>
.login-panel {
padding: 40px 70px 0 70px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
}
.panel-logo {
width: 64px;
}
.login-logo-box {
margin-top: 20px;
}
#parent-area
> main
> div
> div.login-content
> div.login-panel
> div.login-form
> div
> div
> button {
box-shadow: none !important;
border-radius: 10px !important;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
border: 1px solid #eee !important;
}
@media (max-width: 640px) {
```html
<style>
.login-panel {
padding: 40px 0 0 0;
box-shadow: none;
padding: 40px 70px 0 70px;
border-radius: 10px;
background-color: #ffffff;
box-shadow: rgba(17, 12, 46, 0.15) 0px 48px 100px 0px;
}
.panel-logo {
width: 64px;
}
.login-logo-box {
margin-top: 20px;
}
}
</style>
```
随后,复制 `客户端 ID` 和 `客户端密钥`,并保存。
#parent-area
> main
> div
> div.login-content
> div.login-panel
> div.login-form
> div
> div
> button {
box-shadow: none !important;
border-radius: 10px !important;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
border: 1px solid #eee !important;
}
### 配置环境变量
@media (max-width: 640px) {
.login-panel {
padding: 40px 0 0 0;
box-shadow: none;
}
}
将获取到的 `客户端 ID` 和 `客户端`,设为 LobeChat 环境变量中的 `AUTH_CASDOOR_ID` 和 `AUTH_CASDOOR_SECRET`。
</style>
```
配置 LobeChat 环境变量中 `AUTH_CASDOOR_ISSUER` 为:
随后,复制 `客户端 ID` 和 `客户端密钥`,并保存。
- `http://localhost:8000/`,若你是本地开发环境
- `http://CASDOOR_IP:8000/`,若你是局域网私有部署的 Casdoor
- `https://lobe-auth-api.example.com/`,若你是公网环境部署的 Casdoor
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
将获取到的 `客户端 ID` 和 `客户端`,设为 LobeChat 环境变量中的 `AUTH_CASDOOR_ID` 和 `AUTH_CASDOOR_SECRET`。
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Casdoor 请填写 `casdoor`。 |
| `AUTH_CASDOOR_ID` | 必选 | Casdoor 应用详情页的客户端 ID |
| `AUTH_CASDOOR_SECRET` | 必选 | Casdoor 应用详情页的客户端密钥 |
| `AUTH_CASDOOR_ISSUER` | 必选 | Casdoor 提供程序的 OpenID Connect 颁发者。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
配置 LobeChat 环境变量中 `AUTH_CASDOOR_ISSUER` 为:
- `http://localhost:8000/`,若你是本地开发环境
- `http://CASDOOR_IP:8000/`,若你是局域网私有部署的 Casdoor
- `https://lobe-auth-api.example.com/`,若你是公网环境部署的 Casdoor
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Casdoor 请填写 `casdoor`。 |
| `AUTH_CASDOOR_ID` | 必选 | Casdoor 应用详情页的客户端 ID |
| `AUTH_CASDOOR_SECRET` | 必选 | Casdoor 应用详情页的客户端密钥 |
| `AUTH_CASDOOR_ISSUER` | 必选 | Casdoor 提供程序的 OpenID Connect 颁发者。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#casdoor) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>部署成功后,用户将可以通过 Casdoor 身份认证并使用 LobeChat。</Callout>
@@ -17,49 +17,48 @@ tags:
## Cloudflare Zero Trust Configuration Flow
<Steps>
### Creating an Application in Cloudflare Zero Trust
### Creating an Application in Cloudflare Zero Trust
We assume you are already familiar with using the Cloudflare Zero Trust platform and that your LobeChat instance is deployed at `https://chat.example.com`.
We assume you are already familiar with using the Cloudflare Zero Trust platform and that your LobeChat instance is deployed at `https://chat.example.com`.
First, we need to visit `https://one.dash.cloudflare.com/` and navigate to `Access - Applications`.
First, we need to visit `https://one.dash.cloudflare.com/` and navigate to `Access - Applications`.
![image](https://github.com/user-attachments/assets/4d671a7c-5d94-4c4b-b4fd-71a5a0e9d227)
![image](https://github.com/user-attachments/assets/4d671a7c-5d94-4c4b-b4fd-71a5a0e9d227)
Now, on the current page, click `Add an application` and select `SaaS`.
Now, on the current page, click `Add an application` and select `SaaS`.
![image](https://github.com/user-attachments/assets/3da4c8c4-88c6-40a9-8005-6a0a44aa3b1f)
![image](https://github.com/user-attachments/assets/3da4c8c4-88c6-40a9-8005-6a0a44aa3b1f)
In the `Application` text box, enter the application name, such as `LobeChat SSO`. Then click `Select OIDC`, followed by clicking `Add application`.
In the `Application` text box, enter the application name, such as `LobeChat SSO`. Then click `Select OIDC`, followed by clicking `Add application`.
![image](https://github.com/user-attachments/assets/16cd9aef-c87b-48a4-95c0-b666082e7515)
![image](https://github.com/user-attachments/assets/16cd9aef-c87b-48a4-95c0-b666082e7515)
At this point, you have successfully created a SaaS application named `LobeChat SSO` in Cloudflare Zero Trust.
At this point, you have successfully created a SaaS application named `LobeChat SSO` in Cloudflare Zero Trust.
Next, we need to enter `https://chat.example.com/api/auth/callback/cloudflare-zero-trust` in the `Redirect URLs` field (note that `chat.example.com` should be replaced with your instance's address).
Next, we need to enter `https://chat.example.com/api/auth/callback/cloudflare-zero-trust` in the `Redirect URLs` field (note that `chat.example.com` should be replaced with your instance's address).
![image](https://github.com/user-attachments/assets/433fdce4-0af5-417f-b80d-163c2d4f02f6)
![image](https://github.com/user-attachments/assets/433fdce4-0af5-417f-b80d-163c2d4f02f6)
Finally, scroll down the page and record the following three values: `Client secret`, `Client ID`, and `Issuer`. You will need these for setting the environment variables when deploying LobeChat.
Finally, scroll down the page and record the following three values: `Client secret`, `Client ID`, and `Issuer`. You will need these for setting the environment variables when deploying LobeChat.
![image](https://github.com/user-attachments/assets/2dd3cde5-fa0d-4f52-b82b-28d9e89379a0)
![image](https://github.com/user-attachments/assets/2dd3cde5-fa0d-4f52-b82b-28d9e89379a0)
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `cloudflare-zero-trust` for Cloudflare Zero Trust. |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | Required | The Client ID from the Cloudflare Zero Trust application provider details page |
| `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | Required | The Client Secret from the Cloudflare Zero Trust application provider details page |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | Required | The OpenID Configuration Issuer from the Cloudflare Zero Trust application provider details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |
| Environment Variable | Type | Description |
| ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `cloudflare-zero-trust` for Cloudflare Zero Trust. |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | Required | The Client ID from the Cloudflare Zero Trust application provider details page |
| `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | Required | The Client Secret from the Cloudflare Zero Trust application provider details page |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | Required | The OpenID Configuration Issuer from the Cloudflare Zero Trust application provider details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It only needs to be set when the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variable#Cloudflare%20Zero%20Trust) for details about the variables.
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -16,47 +16,46 @@ tags:
## Cloudflare Zero Trust 配置流程
<Steps>
### 在 Cloudflare Zero Trust 中创建应用
### 在 Cloudflare Zero Trust 中创建应用
我们现在默认您已经了解了如何使用 Cloudflare Zero Trust 平台且假设您的 LobeChat 实例部署在 `https://chat.example.com` 中。
我们现在默认您已经了解了如何使用 Cloudflare Zero Trust 平台且假设您的 LobeChat 实例部署在 `https://chat.example.com` 中。
首先我们需要访问 `https://one.dash.cloudflare.com/` 并前往 `Access - Applications` 中。
首先我们需要访问 `https://one.dash.cloudflare.com/` 并前往 `Access - Applications` 中。
![image](https://github.com/user-attachments/assets/4d671a7c-5d94-4c4b-b4fd-71a5a0e9d227)
![image](https://github.com/user-attachments/assets/4d671a7c-5d94-4c4b-b4fd-71a5a0e9d227)
现在,在所在页面点击 `Add an application` 并选择 `SaaS`。
现在,在所在页面点击 `Add an application` 并选择 `SaaS`。
![image](https://github.com/user-attachments/assets/3da4c8c4-88c6-40a9-8005-6a0a44aa3b1f)
![image](https://github.com/user-attachments/assets/3da4c8c4-88c6-40a9-8005-6a0a44aa3b1f)
在 `Application` 文本框内填入应用名称,如:`LobeChat SSO`,然后点击 `Select OIDC` 后点击 `Add applicaiton`
在 `Application` 文本框内填入应用名称,如:`LobeChat SSO`,然后点击 `Select OIDC` 后点击 `Add applicaiton`
![image](https://github.com/user-attachments/assets/16cd9aef-c87b-48a4-95c0-b666082e7515)
![image](https://github.com/user-attachments/assets/16cd9aef-c87b-48a4-95c0-b666082e7515)
至此您已成功在 Clouflare Zero Trust 中创建了一个名为 `LobeChat SSO` 的 SaaS 应用。
至此您已成功在 Clouflare Zero Trust 中创建了一个名为 `LobeChat SSO` 的 SaaS 应用。
接下来我们需要在 `Redirect URLs` 中填入 `https://chat.example.com/api/auth/callback/cloudflare-zero-trust`(注意此处的 `chat.example.com` 需要替换为您的实例地址) ![image](https://github.com/user-attachments/assets/433fdce4-0af5-417f-b80d-163c2d4f02f6)
接下来我们需要在 `Redirect URLs` 中填入 `https://chat.example.com/api/auth/callback/cloudflare-zero-trust`(注意此处的 `chat.example.com` 需要替换为您的实例地址) ![image](https://github.com/user-attachments/assets/433fdce4-0af5-417f-b80d-163c2d4f02f6)
最后我们将页面往下滚动,您将需要记录以下三个值 `Client secret`, `Client ID` 及 `Issuer` 以备后续部署 LobeChat 环境变量使用。
最后我们将页面往下滚动,您将需要记录以下三个值 `Client secret`, `Client ID` 及 `Issuer` 以备后续部署 LobeChat 环境变量使用。
![image](https://github.com/user-attachments/assets/2dd3cde5-fa0d-4f52-b82b-28d9e89379a0)
![image](https://github.com/user-attachments/assets/2dd3cde5-fa0d-4f52-b82b-28d9e89379a0)
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Cloudflare Zero Trust 请填写 `cloudflare-zero-trust`。 |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client ID`,示例值是 `lobe-chat` |
| `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client secret`,示例值是 `insecure_secret` |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | 必选 | 在 Cloudflare Zero Trust 生成的 `Issuer`,例如 `https://example.cloudflareaccess.com/cdn-cgi/access/sso/oidc/7db0f` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ----------------------------------- | -- | ------------------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Cloudflare Zero Trust 请填写 `cloudflare-zero-trust`。 |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ID` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client ID`,示例值是 `lobe-chat` |
| `AUTH_CLOUDFLARE_ZERO_TRUST_SECRET` | 必选 | 在 Cloudflare Zero Trust 生成的 `Client secret`,示例值是 `insecure_secret` |
| `AUTH_CLOUDFLARE_ZERO_TRUST_ISSUER` | 必选 | 在 Cloudflare Zero Trust 生成的 `Issuer`,例如 `https://example.cloudflareaccess.com/cdn-cgi/access/sso/oidc/7db0f` |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://chat.example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#Cloudflare%20Zero%20Trust) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -19,79 +19,52 @@ tags:
<Steps>
### Create a Github Provider
Click [here][github-create-app] to create a new Github App.
Click [here][github-create-app] to create a new Github App.
Fill in the Github App name, Homepage URL, and Callback URL.
Fill in the Github App name, Homepage URL, and Callback URL.
<Image
alt="Create a Github Provider"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7"
/>
<Image alt="Create a Github Provider" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7" />
Set the webhook callback URL according to your needs.
Set the webhook callback URL according to your needs.
<Image
alt="Fill in other fields"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd"
/>
<Image alt="Fill in other fields" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd" />
Set the permission to read email addresses.
Set the permission to read email addresses.
<Image
alt="Set required permissions"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251"
/>
<Image
alt="Set permission to read email addresses"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde"
/>
<Image alt="Set required permissions" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251" />
Set whether it is accessible publicly or only accessible to yourself.
<Image alt="Set permission to read email addresses" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde" />
<Image
alt="Set whether it is accessible publicly or only accessible to yourself"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/995780cb-9096-4a36-ab17-d422703ab970"
/>
Set whether it is accessible publicly or only accessible to yourself.
Click "Create Github App".
<Image alt="Set whether it is accessible publicly or only accessible to yourself" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/995780cb-9096-4a36-ab17-d422703ab970" />
After successful creation, click "Generate a new client secret" to create a client secret.
Click "Create Github App".
<Image
alt="Create a new client secret"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29"
/>
After successful creation, click "Generate a new client secret" to create a client secret.
After successful creation, save the `Client ID` and `Client Secret`.
<Image alt="Create a new client secret" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29" />
<Image
alt="Create a new client secret"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/c6108133-a918-48b0-ab1a-e3fa607572a4"
/>
After successful creation, save the `Client ID` and `Client Secret`.
### Configure Environment Variables
<Image alt="Create a new client secret" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/c6108133-a918-48b0-ab1a-e3fa607572a4" />
When deploying LobeChat, you need to configure the following environment variables:
### Configure Environment Variables
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. |
| `AUTH_GITHUB_ID` | Required | Client ID in the Github App details page. |
| `AUTH_GITHUB_SECRET` | Required | Client Secret in the Github App details page. |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
When deploying LobeChat, you need to configure the following environment variables:
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detailed
information on these variables.
</Callout>
| Environment Variable | Type | Description |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. |
| `AUTH_GITHUB_ID` | Required | Client ID in the Github App details page. |
| `AUTH_GITHUB_SECRET` | Required | Client Secret in the Github App details page. |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#github) for detailed
information on these variables.
</Callout>
</Steps>
<Callout type={'info'}>
@@ -16,78 +16,51 @@ tags:
<Steps>
### 创建 Github 提供应用
点击 [这里](https://github.com/settings/apps/new) 创建一个新的 Github App。
点击 [这里](https://github.com/settings/apps/new) 创建一个新的 Github App。
填写 Github App name、Homepage URL、Callbak URL
填写 Github App name、Homepage URL、Callbak URL
<Image
alt="创建 Github 提供程序"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7"
/>
按照自己所需设置Webhook回调地址
<Image alt="创建 Github 提供程序" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/2f919f99-2aaa-4fa7-9938-169d3ed09db7" />
<Image
alt="填写其他字段"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd"
/>
按照自己所需设置 Webhook 回调地址
设置读取邮件地址权限
<Image alt="填写其他字段" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/d7ef5ad1-b1a3-435e-b1bc-4436d2b6fecd" />
<Image
alt="设置所需权限"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251"
/>
<Image
alt="设置读取邮件地址权限"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde"
/>
设置读取邮件地址权限
设置公开访问还是仅自己访问
<Image alt="设置所需权限" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/23131ca1-9e84-4a89-a840-ef79c4bc0251" />
<Image
alt="设置公开访问还是仅自己访问"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/995780cb-9096-4a36-ab17-d422703ab970"
/>
<Image alt="设置读取邮件地址权限" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/358bca8d-3d82-4e76-9a5e-90d16a39efde" />
点击「Create Github App」
设置公开访问还是仅自己访问
创建成功后,点击「Generate a new client secret」创建客户端Secret
<Image alt="设置公开访问还是仅自己访问" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/995780cb-9096-4a36-ab17-d422703ab970" />
<Image
alt="创建新的客户端密钥"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29"
/>
点击「Create Github App」
创建成功后, 将 `客户端 ID` 和 `客户端 Secret` 保存下来。
创建成功后,点击「Generate a new client secret」创建客户端 Secret
<Image
alt="创建新的客户端密钥"
inStep
src="https://github.com/lobehub/lobe-chat/assets/64475363/c6108133-a918-48b0-ab1a-e3fa607572a4"
/>
<Image alt="创建新的客户端密钥" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/6d69bdca-7d18-4cbc-b3e0-220d8815cd29" />
### 配置环境变量
创建成功后, 将 `客户端 ID` 和 `客户端 Secret` 保存下来。
在部署 LobeChat 时,你需要配置以下环境变量:
<Image alt="创建新的客户端密钥" inStep src="https://github.com/lobehub/lobe-chat/assets/64475363/c6108133-a918-48b0-ab1a-e3fa607572a4" />
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 |
| `AUTH_GITHUB_ID` | 必选 | Github App详情页的 客户端 ID |
| `AUTH_GITHUB_SECRET` | 必选 | Github App详情页的 客户端 Secret |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 |
| `AUTH_GITHUB_ID` | 必选 | Github App 详情页的 客户端 ID |
| `AUTH_GITHUB_SECRET` | 必选 | Github App 详情页的 客户端 Secret |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#github) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>部署成功后,用户将可以通过Github身份认证并使用 LobeChat。</Callout>
<Callout type={'info'}>部署成功后,用户将可以通过 Github 身份认证并使用 LobeChat。</Callout>
@@ -31,52 +31,43 @@ If you are using Logto Cloud, assume its endpoint domain is `https://example.log
<Steps>
### Create Logto Application
Access your privately deployed Logto WebUI or [Logto Cloud](http://cloud.logto.io/) to enter the console, and create a `Next.js (App Router)` application under `Applications` with any name.
Access your privately deployed Logto WebUI or [Logto Cloud](http://cloud.logto.io/) to enter the console, and create a `Next.js (App Router)` application under `Applications` with any name.
### Configure Logto
### Configure Logto
Set the `Redirect URI` to `https://lobe.example.com/api/auth/callback/logto` and the `Post sign-out redirect URI` to `https://lobe.example.com/`.
Set the `Redirect URI` to `https://lobe.example.com/api/auth/callback/logto` and the `Post sign-out redirect URI` to `https://lobe.example.com/`.
Set `CORS allowed origins` to `https://lobe.example.com`.
Set `CORS allowed origins` to `https://lobe.example.com`.
<Image
alt="Configure Logto"
inStep
src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523"
/>
<Image alt="Configure Logto" inStep src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523" />
After successful creation, save the `Client ID` and `Client Secret`.
After successful creation, save the `Client ID` and `Client Secret`.
### Configure Environment Variables
### Configure Environment Variables
<Image
alt="Configure Environment Variables"
inStep
src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837"
/>
<Image alt="Configure Environment Variables" inStep src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837" />
Set the obtained `Client ID` and `Client Secret` as `AUTH_LOGTO_ID` and `AUTH_LOGTO_SECRET` in the LobeChat environment variables.
Set the obtained `Client ID` and `Client Secret` as `AUTH_LOGTO_ID` and `AUTH_LOGTO_SECRET` in the LobeChat environment variables.
Configure `AUTH_LOGTO_ISSUER` in the LobeChat environment variables as follows:
Configure `AUTH_LOGTO_ISSUER` in the LobeChat environment variables as follows:
- `https://lobe-auth-api.example.com/oidc` if you are using a privately deployed Logto
- `https://example.logto.app/oidc` if you are using Logto Cloud
- `https://lobe-auth-api.example.com/oidc` if you are using a privately deployed Logto
- `https://example.logto.app/oidc` if you are using Logto Cloud
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. |
| `AUTH_LOGTO_ID` | Required | The Client ID from the Logto App details page |
| `AUTH_LOGTO_SECRET` | Required | The Client Secret from the Logto App details page |
| `AUTH_LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
| Environment Variable | Type | Description |
| ------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | The key used to encrypt Auth.js session tokens. You can generate a key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LobeChat. For Logto, enter `logto`. |
| `AUTH_LOGTO_ID` | Required | The Client ID from the Logto App details page |
| `AUTH_LOGTO_SECRET` | Required | The Client Secret from the Logto App details page |
| `AUTH_LOGTO_ISSUER` | Required | OpenID Connect issuer of the Logto provider |
| `NEXTAUTH_URL` | Required | This URL specifies the callback address for Auth.js during OAuth verification, needed only if the default generated redirect address is incorrect. `https://lobe.example.com/api/auth` |
<Callout type={'tip'}>
Visit [📘 Environment Variables](/docs/self-hosting/environment-variables/auth#logto) for details on related variables.
</Callout>
</Callout>
</Steps>
### Troubleshooting
@@ -84,22 +75,22 @@ When deploying LobeChat, you need to configure the following environment variabl
If you encounter issues during the Logto deployment process, refer to the following common problems:
- `Only roles with the xxx attribute may create roles`:
Check your database user's permissions and ensure that the user in your Logto database has the `admin` role to create roles.
Check your database user's permissions and ensure that the user in your Logto database has the `admin` role to create roles.
- Error executing `logto db seed` on third-party databases like `Neon`:
Try using the `logto db seed --encrypt-base-role` command.
Try using the `logto db seed --encrypt-base-role` command.
- Database seeding failed:
Try skipping the seeding process with the `--skip-seed` parameter.
Try skipping the seeding process with the `--skip-seed` parameter.
- `Error: role xxx already exists`:
Delete the existing role in the database.
Delete the existing role in the database.
- Database migration failed after a version upgrade:
Try using the command `npx @logto/cli db alteration deploy $version` (e.g., `npx @logto/cli db alteration deploy 1.22.0`).
Try using the command `npx @logto/cli db alteration deploy $version` (e.g., `npx @logto/cli db alteration deploy 1.22.0`).
- I am using Docker deployment and want a one-click upgrade:
Execute the custom command in the container: `sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
Execute the custom command in the container: `sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
<Callout type={'info'}>
After successful deployment, users will be able to authenticate via Logto and use LobeChat.
@@ -28,52 +28,43 @@ tags:
<Steps>
### 创建 Logto 应用
访问你私有部署的 Logto WebUI 或者 [Logto Cloud](http://cloud.logto.io/) 进入控制台,在 `Applications` 里创建一个 `Next.js (App Router)` 应用,名称随意
访问你私有部署的 Logto WebUI 或者 [Logto Cloud](http://cloud.logto.io/) 进入控制台,在 `Applications` 里创建一个 `Next.js (App Router)` 应用,名称随意
### 配置 Logto
### 配置 Logto
配置 `Redirect URI` 为 `https://lobe.example.com/api/auth/callback/logto`,`Post sign-out redirect URI` 为 `https://lobe.example.com/`
配置 `Redirect URI` 为 `https://lobe.example.com/api/auth/callback/logto`,`Post sign-out redirect URI` 为 `https://lobe.example.com/`
配置 `CORS allowed origins` 为 `https://lobe.example.com`
配置 `CORS allowed origins` 为 `https://lobe.example.com`
<Image
alt="配置 Logto"
inStep
src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523"
/>
<Image alt="配置 Logto" inStep src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523" />
创建成功后, 将 `Client ID` 和 `Client Secret` 保存下来。
创建成功后, 将 `Client ID` 和 `Client Secret` 保存下来。
### 配置环境变量
### 配置环境变量
<Image
alt="配置环境变量"
inStep
src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837"
/>
<Image alt="配置环境变量" inStep src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837" />
将获取到的 `Client ID` 和 `Client Secret`,设为 LobeChat 环境变量中的 `AUTH_LOGTO_ID` 和 `AUTH_LOGTO_SECRET`。
将获取到的 `Client ID` 和 `Client Secret`,设为 LobeChat 环境变量中的 `AUTH_LOGTO_ID` 和 `AUTH_LOGTO_SECRET`。
配置 LobeChat 环境变量中 `AUTH_LOGTO_ISSUER` 为:
配置 LobeChat 环境变量中 `AUTH_LOGTO_ISSUER` 为:
- `https://lobe-auth-api.example.com/oidc`,若你是私有部署的 Logto
- `https://example.logto.app/oidc`,若你是使用的 Logto Cloud
- `https://lobe-auth-api.example.com/oidc`,若你是私有部署的 Logto
- `https://example.logto.app/oidc`,若你是使用的 Logto Cloud
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`。 |
| `AUTH_LOGTO_ID` | 必选 | Logto App 详情页的 Client ID |
| `AUTH_LOGTO_SECRET` | 必选 | Logto App 详情页的 Client Secret |
| `AUTH_LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------------ |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Logto 请填写 `logto`。 |
| `AUTH_LOGTO_ID` | 必选 | Logto App 详情页的 Client ID |
| `AUTH_LOGTO_SECRET` | 必选 | Logto App 详情页的 Client Secret |
| `AUTH_LOGTO_ISSUER` | 必选 | Logto 提供程序的 OpenID Connect 颁发者 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://lobe.example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#logto) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
### 故障排除
@@ -81,21 +72,21 @@ tags:
若你在部署 Logto 过程中遇到问题,可以参考以下常见问题:
- `Only roles with the xxx attribute may create roles`:
请检查你的数据库用户权限,确保你的 Logto 数据库中的用户具有 `admin` 角色,以便创建角色。
请检查你的数据库用户权限,确保你的 Logto 数据库中的用户具有 `admin` 角色,以便创建角色。
- 在第三方数据库例如 `Neon` 上执行`logto db seed`出错:
尝试使用`logto db seed --encrypt-base-role`命令。
尝试使用`logto db seed --encrypt-base-role`命令。
- 数据库播种失败:
请尝试使用`--skip-seed`参数跳过播种。
请尝试使用`--skip-seed`参数跳过播种。
- `Error: role xxx already exists`:
在数据库中删除已存在的角色即可。
在数据库中删除已存在的角色即可。
- 版本升级后,数据库迁移失败:
请尝试使用` npx @logto/cli db alteration deploy $version`命令(例如`npx @logto/cli db alteration deploy 1.22.0`)
请尝试使用` npx @logto/cli db alteration deploy $version`命令 (例如`npx @logto/cli db alteration deploy 1.22.0`)
- 我使用 docker 部署 希望一键升级:
在容器中执行自定义命令:`sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
在容器中执行自定义命令:`sh -c "npm run cli db seed -- --swe --encrypt-base-role" && npx @logto/cli db alteration deploy $version && npm start`
<Callout type={'info'}>部署成功后,用户将可以通过 Logto 身份认证并使用 LobeChat。</Callout>
@@ -18,72 +18,59 @@ tags:
<Steps>
### Create a Microsoft Entra ID Application
In your [Microsoft Azure Portal][microsoft-azure-portal], go to Microsoft Entra ID -> App registrations -> New registration to create a new application.
In your [Microsoft Azure Portal][microsoft-azure-portal], go to Microsoft Entra ID -> App registrations -> New registration to create a new application.
Fill in the desired application name to be displayed to organizational users, choose the account types you wish to support, and if only internal users are supported, select `Accounts in this organizational directory only (Default Directory only - Single tenant)`.
Fill in the desired application name to be displayed to organizational users, choose the account types you wish to support, and if only internal users are supported, select `Accounts in this organizational directory only (Default Directory only - Single tenant)`.
In the `Redirect URI (optional)` section, for the application type, select `Web`, and in the Callback URL, enter:
In the `Redirect URI (optional)` section, for the application type, select `Web`, and in the Callback URL, enter:
```bash
https://your-domain/api/auth/callback/microsoft-entra-id
```
```bash
https://your-domain/api/auth/callback/microsoft-entra-id
```
<Callout type={'info'}>
- You can fill in or modify the Redirect URIs after registering, but make sure the URL you enter
matches the deployed URL. - Please replace "your-domain" with your own domain.
</Callout>
<Callout type={'info'}>
- You can fill in or modify the Redirect URIs after registering, but make sure the URL you enter
matches the deployed URL. - Please replace "your-domain" with your own domain.
</Callout>
<Image
alt="App Register"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/4f9d83bd-b3fc-4abc-bcf4-ccbad65c219d"
/>
<Image alt="App Register" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/4f9d83bd-b3fc-4abc-bcf4-ccbad65c219d" />
Click on "Register".
Click on "Register".
After successfully creating the application, click on the corresponding application to enter the application details page, and switch to the "Overview" tab to view the corresponding configuration information.
After successfully creating the application, click on the corresponding application to enter the application details page, and switch to the "Overview" tab to view the corresponding configuration information.
<Image
alt="App Overview"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/48a0b702-05bd-4ce4-a007-a8ad00a36e5a"
/>
<Image alt="App Overview" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/48a0b702-05bd-4ce4-a007-a8ad00a36e5a" />
Go to "Certificates & secrets", select the "Client secrets" tab, click on "New client secret", fill in the description, select the expiration time, and click on "Add" to create a new client secret.
Go to "Certificates & secrets", select the "Client secrets" tab, click on "New client secret", fill in the description, select the expiration time, and click on "Add" to create a new client secret.
<Image
alt="Create App Client Secret"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/c9d66fa0-158c-4bd3-a1fa-969e638259d2"
/>
<Image alt="Create App Client Secret" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/c9d66fa0-158c-4bd3-a1fa-969e638259d2" />
<Callout type={'important'}>
Please make sure to save your client secret as this is your only chance to view it.
</Callout>
<Callout type={'important'}>
Please make sure to save your client secret as this is your only chance to view it.
</Callout>
### Add Users
### Add Users
Go back to the "Microsoft Entra ID" interface, enter "Users", click on "New user", fill in the user information, and click on "Create" to create a user for using LobeChat.
Go back to the "Microsoft Entra ID" interface, enter "Users", click on "New user", fill in the user information, and click on "Create" to create a user for using LobeChat.
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `microsoft-entra-id` for Microsoft Entra ID. |
| `AUTH_MICROSOFT_ENTRA_ID_ID` | Required | Client ID of the Microsoft Entra ID application. |
| `AUTH_MICROSOFT_ENTRA_ID_SECRET` | Required | Client Secret of the Microsoft Entra ID application. |
| `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | Required | Tenant ID of the Microsoft Entra ID application. |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It is only necessary to set it when the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
You can refer to [📘 environment
variables](/docs/self-hosting/environment-variable#microsoft-entra-id) for details on related
variables.
</Callout>
| Environment Variable | Type | Description |
| ----------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `microsoft-entra-id` for Microsoft Entra ID. |
| `AUTH_MICROSOFT_ENTRA_ID_ID` | Required | Client ID of the Microsoft Entra ID application. |
| `AUTH_MICROSOFT_ENTRA_ID_SECRET` | Required | Client Secret of the Microsoft Entra ID application. |
| `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | Required | Tenant ID of the Microsoft Entra ID application. |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. It is only necessary to set it when the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
You can refer to [📘 environment
variables](/docs/self-hosting/environment-variable#microsoft-entra-id) for details on related
variables.
</Callout>
</Steps>
<Callout>
@@ -17,68 +17,55 @@ tags:
<Steps>
### 创建 Microsoft Entra ID 应用
在你的 [Microsoft Azure Portal][microsoft-azure-portal] 进入 Microsoft Entra ID -> App registrations -> New registration 创建一个新的应用。
在你的 [Microsoft Azure Portal][microsoft-azure-portal] 进入 Microsoft Entra ID -> App registrations -> New registration 创建一个新的应用。
填写你想向组织用户显示的应用名称,选择你期望支持的账户类型,如果只支持内部用户请选择 `Accounts in this organizational directory only (Default Directory only - Single tenant)`。
填写你想向组织用户显示的应用名称,选择你期望支持的账户类型,如果只支持内部用户请选择 `Accounts in this organizational directory only (Default Directory only - Single tenant)`。
在 `Redirect URI (optional)` 中,应用类型选择 `Web`,Callback URL, 处填写:
在 `Redirect URI (optional)` 中,应用类型选择 `Web`,Callback URL, 处填写:
```bash
https://your-domain/api/auth/callback/microsoft-entra-id
```
```bash
https://your-domain/api/auth/callback/microsoft-entra-id
```
<Callout type={'info'}>
- 可以在 Register 后再填写或修改 Redirect URIs,但是务必保证填写的 URL 与部署的 URL 一致。 -
your-domain 请填写自己的域名
</Callout>
<Callout type={'info'}>
- 可以在 Register 后再填写或修改 Redirect URIs,但是务必保证填写的 URL 与部署的 URL 一致。 -
your-domain 请填写自己的域名
</Callout>
<Image
alt="App Register"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/4f9d83bd-b3fc-4abc-bcf4-ccbad65c219d"
/>
<Image alt="App Register" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/4f9d83bd-b3fc-4abc-bcf4-ccbad65c219d" />
点击「Register」
点击「Register」
创建成功后,点击相应的应用,进入应用详情页,切换到「Overview」标签页,就可以看到相应的配置信息。
创建成功后,点击相应的应用,进入应用详情页,切换到「Overview」标签页,就可以看到相应的配置信息。
<Image
alt="App Overview"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/48a0b702-05bd-4ce4-a007-a8ad00a36e5a"
/>
<Image alt="App Overview" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/48a0b702-05bd-4ce4-a007-a8ad00a36e5a" />
进入「Certificates & secrets」,选择「Client secrets」标签,点击「New client secret」,填写描述,选择过期时间,点击「Add」,创建一个新的客户端密钥。
进入「Certificates & secrets」,选择「Client secrets」标签,点击「New client secret」,填写描述,选择过期时间,点击「Add」,创建一个新的客户端密钥。
<Image
alt="Create App Client Secret"
inStep
src="https://github.com/lobehub/lobe-chat/assets/13883964/c9d66fa0-158c-4bd3-a1fa-969e638259d2"
/>
<Image alt="Create App Client Secret" inStep src="https://github.com/lobehub/lobe-chat/assets/13883964/c9d66fa0-158c-4bd3-a1fa-969e638259d2" />
<Callout type={'important'}>请务必保存好你的客户端密钥,因为这是你唯一的机会查看它。</Callout>
<Callout type={'important'}>请务必保存好你的客户端密钥,因为这是你唯一的机会查看它。</Callout>
### 新增用户
### 新增用户
回到「Microsoft Entra ID」界面,进入「Users」,点击「New user」,填写用户信息,点击「Create」,创建用户以使用 LobeChat。
回到「Microsoft Entra ID」界面,进入「Users」,点击「New user」,填写用户信息,点击「Create」,创建用户以使用 LobeChat。
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Microsoft Entra ID 请填写 `microsoft-entra-id`。 |
| `AUTH_MICROSOFT_ENTRA_ID_ID` | 必选 | Microsoft Entra ID 应用程序的 Client ID |
| `AUTH_MICROSOFT_ENTRA_ID_SECRET` | 必选 | Microsoft Entra ID 应用程序的 Client Secret |
| `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | 必选 | Microsoft Entra ID 应用程序的 Tenant ID |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ----------------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Microsoft Entra ID 请填写 `microsoft-entra-id`。 |
| `AUTH_MICROSOFT_ENTRA_ID_ID` | 必选 | Microsoft Entra ID 应用程序的 Client ID |
| `AUTH_MICROSOFT_ENTRA_ID_SECRET` | 必选 | Microsoft Entra ID 应用程序的 Client Secret |
| `AUTH_MICROSOFT_ENTRA_ID_TENANT_ID` | 必选 | Microsoft Entra ID 应用程序的 Tenant ID |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variable#microsoft-entra-id) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -18,28 +18,27 @@ tags:
<Steps>
### Create a Wechat Application
Click [here](https://open.weixin.qq.com/cgi-bin/index) and then click "Management Center", "Website Application", and "Create Website Application" in sequence.
Click [here](https://open.weixin.qq.com/cgi-bin/index) and then click "Management Center", "Website Application", and "Create Website Application" in sequence.
Fill in the information as required by the official website prompts and submit for review.
Fill in the information as required by the official website prompts and submit for review.
After successful creation, click "Application Details" to obtain the AppID and AppSecret.
After successful creation, click "Application Details" to obtain the AppID and AppSecret.
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. |
| `WECHAT_CLIENT_ID` | Required | Client ID from the Wechat website application details page |
| `WECHAT_CLIENT_SECRET` | Required | Client Secret from the Wechat website application details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
| Environment Variable | Type | Description |
| ------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the Single Sign-On provider for LobeChat. Use `github` for Github. |
| `WECHAT_CLIENT_ID` | Required | Client ID from the Wechat website application details page |
| `WECHAT_CLIENT_SECRET` | Required | Client Secret from the Wechat website application details page |
| `NEXTAUTH_URL` | Required | This URL is used to specify the callback address for Auth.js when performing OAuth authentication. Only set it if the default generated redirect address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
Go to [📘 Environment Variables](/en/docs/self-hosting/environment-variables/auth#wechat) for more details about related variables.
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>
@@ -11,33 +11,32 @@ tags:
# 配置微信身份验证服务
##微信配置流程
\## 微信配置流程
<Steps>
### 创建微信网站应用
点击 [这里](https://open.weixin.qq.com/cgi-bin/index) 依次点击“管理中心”、“网站应用”、“创建网站应用”
点击 [这里](https://open.weixin.qq.com/cgi-bin/index) 依次点击 “管理中心”、“网站应用”、“创建网站应用”
按照管网提示要求填写信息并提交审核。
按照管网提示要求填写信息并提交审核。
创建成功后,点击“应用详情”,可获知AppID和AppSecret。
创建成功后,点击 “应用详情”,可获知 AppID 和 AppSecret。
### 配置环境变量
### 配置环境变量
在部署 LobeChat 时,你需要配置以下环境变量:
在部署 LobeChat 时,你需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 |
| `WECHAT_CLIENT_ID` | 必选 |微信网站应用详情页的 客户端 ID |
| `WECHAT_CLIENT_SECRET` | 必选 |微信网站应用详情页的 客户端 Secret |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成秘钥: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 选择 LoboChat 的单点登录提供商。使用 Github 请填写 `github`。 |
| `WECHAT_CLIENT_ID` | 必选 | 微信网站应用详情页的 客户端 ID |
| `WECHAT_CLIENT_SECRET` | 必选 | 微信网站应用详情页的 客户端 Secret |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 在执行 OAuth 验证时的回调地址,当默认生成的重定向地址发生不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
前往 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#wechat) 可查阅相关变量详情。
</Callout>
</Callout>
</Steps>
<Callout type={'info'}>部署成功后,用户将可以通过微信开放平台身份认证并使用 LobeChat。</Callout>
@@ -17,99 +17,65 @@ tags:
<Steps>
### Create ZITADEL Application
Log in to the console of your ZITADEL instance using an account with at least a [`Project Owner` role](https://zitadel.com/docs/guides/manage/console/managers#roles), navigate to (or [create](https://zitadel.com/docs/guides/manage/console/projects#create-a-project)) the project you'd like to host your application in, and click the **New** button to create an application.
Log in to the console of your ZITADEL instance using an account with at least a [`Project Owner` role](https://zitadel.com/docs/guides/manage/console/managers#roles), navigate to (or [create](https://zitadel.com/docs/guides/manage/console/projects#create-a-project)) the project you'd like to host your application in, and click the **New** button to create an application.
<Image
alt="Create ZITADEL Application S1"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/b05473ad-04a6-4ebc-9810-116c778d4448"
/>
<Image alt="Create ZITADEL Application S1" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/b05473ad-04a6-4ebc-9810-116c778d4448" />
Fill in the name, choose **Web** as the application type, and click **Continue**.
Fill in the name, choose **Web** as the application type, and click **Continue**.
<Image
alt="Create ZITADEL Application S2"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/5a0e6c58-9e6f-4ffb-8af2-32e48cfb45b0"
/>
<Image alt="Create ZITADEL Application S2" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/5a0e6c58-9e6f-4ffb-8af2-32e48cfb45b0" />
Choose **Code** as the authentication method.
Choose **Code** as the authentication method.
<Image
alt="Create ZITADEL Application S3"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/14ecaa12-74a1-4e2f-b171-9d9ac09d3d63"
/>
<Image alt="Create ZITADEL Application S3" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/14ecaa12-74a1-4e2f-b171-9d9ac09d3d63" />
In the **Redirect URIs** field, fill in:
In the **Redirect URIs** field, fill in:
```
http(s)://your-domain/api/auth/callback/zitadel
```
```
http(s)://your-domain/api/auth/callback/zitadel
```
<Image
alt="Create ZITADEL Application S4"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/4ff3c3a0-9ca0-45ff-8f3a-219f4445098b"
/>
<Image alt="Create ZITADEL Application S4" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/4ff3c3a0-9ca0-45ff-8f3a-219f4445098b" />
<Callout type={'important'}>
- You can fill in or modify redirect URIs after creating the application, but make sure the filled
URL is consistent with the deployed URL.
<Callout type={'important'}>
- You can fill in or modify redirect URIs after creating the application, but make sure the filled
URL is consistent with the deployed URL.
- Replace `http(s)://your-domain` with the actual URL that LobeChat is deployed to.
- Replace `http(s)://your-domain` with the actual URL that LobeChat is deployed to.
</Callout>
</Callout>
Confirm the configuration and click **Create**.
Confirm the configuration and click **Create**.
<Image alt="Create ZITADEL Application S5" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/bee24764-aa42-47d9-ad43-bcb8e7b35bc3" />
<Image
alt="Create ZITADEL Application S5"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/bee24764-aa42-47d9-ad43-bcb8e7b35bc3"
/>
Save the **ClientId** and **ClientSecret** for later use.
Save the **ClientId** and **ClientSecret** for later use.
<Image alt="Create ZITADEL Application S6" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/407b4eed-7f21-4aa6-b68f-9bae2faf09d0" />
<Image
alt="Create ZITADEL Application S6"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/407b4eed-7f21-4aa6-b68f-9bae2faf09d0"
/>
In the application settings page, navigate to the **Token Settings** tab, enable **User Info inside ID Token** option, and click **Save**.
In the application settings page, navigate to the **Token Settings** tab, enable **User Info inside ID Token** option, and click **Save**.
<Image alt="Create ZITADEL Application S7" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/d84235b1-45f6-447d-bdd9-58ab9527dc9b" />
<Image
alt="Create ZITADEL Application S7"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/d84235b1-45f6-447d-bdd9-58ab9527dc9b"
/>
Navigate to the **URLs** tab, and save the **issuer** URL.
Navigate to the **URLs** tab, and save the **issuer** URL.
<Image alt="Create ZITADEL Application S8" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/d12a2661-7b98-484f-8f3d-07e84d42ae08" />
<Image
alt="Create ZITADEL Application S8"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/d12a2661-7b98-484f-8f3d-07e84d42ae08"
/>
### Configure Environment Variables
### Configure Environment Variables
When deploying LobeChat, you need to configure the following environment variables:
When deploying LobeChat, you need to configure the following environment variables:
| Environment Variable | Type | Description |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `zitadel` for ZITADEL. |
| `AUTH_ZITADEL_ID` | Required | Client ID (`ClientId` as shown in ZITADEL) of the ZITADEL application |
| `AUTH_ZITADEL_SECRET` | Required | Client Secret (`ClientSecret` as shown in ZITADEL) of the ZITADEL application |
| `AUTH_ZITADEL_ISSUER` | Required | Issuer URL of the ZITADEL application |
| `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
| Environment Variable | Type | Description |
| ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `zitadel` for ZITADEL. |
| `AUTH_ZITADEL_ID` | Required | Client ID (`ClientId` as shown in ZITADEL) of the ZITADEL application |
| `AUTH_ZITADEL_SECRET` | Required | Client Secret (`ClientSecret` as shown in ZITADEL) of the ZITADEL application |
| `AUTH_ZITADEL_ISSUER` | Required | Issuer URL of the ZITADEL application |
| `NEXTAUTH_URL` | Required | The URL is used to specify the callback address for the execution of OAuth authentication in Auth.js. It needs to be set only when the default address is incorrect. `https://example.com/api/auth` |
<Callout type={'tip'}>
You can refer to the related variable details at [📘Environment Variables](/docs/self-hosting/environment-variables/auth#zitadel).
</Callout>
</Callout>
</Steps>
<Callout>
@@ -14,98 +14,64 @@ tags:
<Steps>
### 创建 ZITADEL 应用
使用具有 [`Project Owner` 角色](https://zitadel.com/docs/guides/manage/console/managers#roles)的账户登录到 ZITADEL 实例控制台,进入(或[创建](https://zitadel.com/docs/guides/manage/console/projects#create-a-project))该应用所属的项目,点击「创建」按钮创建应用。
使用具有 [`Project Owner` 角色](https://zitadel.com/docs/guides/manage/console/managers#roles)的账户登录到 ZITADEL 实例控制台,进入(或[创建](https://zitadel.com/docs/guides/manage/console/projects#create-a-project))该应用所属的项目,点击「创建」按钮创建应用。
<Image
alt="创建 ZITADEL 应用 1"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/3564110d-bef9-47f3-b775-e5f28b4275b2"
/>
<Image alt="创建 ZITADEL 应用 1" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/3564110d-bef9-47f3-b775-e5f28b4275b2" />
填写应用名称,应用类型选择「Web」,点击「继续」。
填写应用名称,应用类型选择「Web」,点击「继续」。
<Image
alt="创建 ZITADEL 应用 2"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/12451b47-8dcd-40a9-b18d-2806b07efecc"
/>
<Image alt="创建 ZITADEL 应用 2" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/12451b47-8dcd-40a9-b18d-2806b07efecc" />
选择「Code」作为身份验证方式。
选择「Code」作为身份验证方式。
<Image
alt="创建 ZITADEL 应用 3"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/9d5cb651-ad10-47c7-8c8b-2256163c5521"
/>
<Image alt="创建 ZITADEL 应用 3" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/9d5cb651-ad10-47c7-8c8b-2256163c5521" />
在「重定向 URLs」字段中填写:
在「重定向 URLs」字段中填写:
```
http(s)://your-domain/api/auth/callback/zitadel
```
```
http(s)://your-domain/api/auth/callback/zitadel
```
<Image
alt="创建 ZITADEL 应用 4"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/1699bf46-0c8d-4238-9eb5-34282bfe529a"
/>
<Image alt="创建 ZITADEL 应用 4" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/1699bf46-0c8d-4238-9eb5-34282bfe529a" />
<Callout type={'important'}>
- 可以创建应用后再填写或修改重定向 URL,但请确保填写的 URL 与部署的 URL 一致。
<Callout type={'important'}>
- 可以创建应用后再填写或修改重定向 URL,但请确保填写的 URL 与部署的 URL 一致。
- 请将 `http(s)://your-domain` 替换为 LobeChat 部署的实际 URL。
- 请将 `http(s)://your-domain` 替换为 LobeChat 部署的实际 URL。
</Callout>
</Callout>
确认配置并点击「创建」。
确认配置并点击「创建」。
<Image alt="创建 ZITADEL 应用 5" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/375b3d73-6796-465c-9063-f2762093f763" />
<Image
alt="创建 ZITADEL 应用 5"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/375b3d73-6796-465c-9063-f2762093f763"
/>
记录下「ClientId」和「ClientSecret」备用。
记录下「ClientId」和「ClientSecret」备用。
<Image alt="创建 ZITADEL 应用 6" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/40bb6b4c-18e0-4ae5-abae-ae0cf202cf08" />
<Image
alt="创建 ZITADEL 应用 6"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/40bb6b4c-18e0-4ae5-abae-ae0cf202cf08"
/>
在应用设置页面中,切换到「令牌设置」选项卡,勾选「在 ID Token 中包含用户信息」选项,点击「保存」。
在应用设置页面中,切换到「令牌设置」选项卡,勾选「在 ID Token 中包含用户信息」选项,点击「保存」。
<Image alt="创建 ZITADEL 应用 7" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/20a257b5-d086-46f3-b5c2-f76394b11f55" />
<Image
alt="创建 ZITADEL 应用 7"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/20a257b5-d086-46f3-b5c2-f76394b11f55"
/>
切换到「URLs」选项卡,记录下「issuer」URL。
切换到「URLs」选项卡,记录下「issuer」URL。
<Image alt="创建 ZITADEL 应用 8" inStep src="https://github.com/lobehub/lobe-chat/assets/8692892/79c55d44-8dcb-429c-a072-d3eb014bbceb" />
<Image
alt="创建 ZITADEL 应用 8"
inStep
src="https://github.com/lobehub/lobe-chat/assets/8692892/79c55d44-8dcb-429c-a072-d3eb014bbceb"
/>
### 配置环境变量
### 配置环境变量
部署 LobeChat 时,您需要配置以下环境变量:
部署 LobeChat 时,您需要配置以下环境变量:
| 环境变量 | 类型 | 描述 |
| --- | --- | --- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 为 LobeChat 选择单点登录提供程序。对于 ZITADEL,请填写 `zitadel`。 |
| `AUTH_ZITADEL_ID` | 必选 | ZITADEL 应用的 Client ID(`ClientId`)。 |
| `AUTH_ZITADEL_SECRET` | 必选 | ZITADEL 应用的 Client Secret(`ClientSecret`)。 |
| `AUTH_ZITADEL_ISSUER` | 必选 | ZITADEL 应用的 OpenID Connect 颁发者(issuer)URL。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 中执行 OAuth 认证的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |
| 环境变量 | 类型 | 描述 |
| ------------------------- | -- | ----------------------------------------------------------------------------------- |
| `NEXT_AUTH_SECRET` | 必选 | 用于加密 Auth.js 会话令牌的密钥。您可以使用以下命令生成密钥:`openssl rand -base64 32` |
| `NEXT_AUTH_SSO_PROVIDERS` | 必选 | 为 LobeChat 选择单点登录提供程序。对于 ZITADEL,请填写 `zitadel`。 |
| `AUTH_ZITADEL_ID` | 必选 | ZITADEL 应用的 Client ID(`ClientId`)。 |
| `AUTH_ZITADEL_SECRET` | 必选 | ZITADEL 应用的 Client Secret(`ClientSecret`)。 |
| `AUTH_ZITADEL_ISSUER` | 必选 | ZITADEL 应用的 OpenID Connect 颁发者(issuer)URL。 |
| `NEXTAUTH_URL` | 必选 | 该 URL 用于指定 Auth.js 中执行 OAuth 认证的回调地址。仅当默认地址不正确时才需要设置。`https://example.com/api/auth` |
<Callout type={'tip'}>
您可以在 [📘 环境变量](/zh/docs/self-hosting/environment-variables/auth#zitadel) 中查看相关变量的详细信息。
</Callout>
</Callout>
</Steps>
<Callout>部署成功后,用户将能够通过 ZITADEL 中配置的用户进行身份验证并使用 LobeChat。</Callout>
@@ -28,20 +28,20 @@ tags:
关键字,你需要手动控制所有的功能标志(否则它们会采用对应的默认值)。
</Callout>
| 配置项 | 解释 | 默认值 |
| ------------------------- | -------------------------------- | ------ |
| `webrtc_sync` | 启用 WebRTC 同步功能。 | 关闭 |
| `language_model_settings` | 启用语言模型设置。 | 开启 |
| `openai_api_key` | 允许用户自定义 OpenAI API Key。 | 开启 |
| `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
| `create_session` | 允许用户创建会话。 | 开启 |
| `edit_agent` | 允许用户编辑助手。 | 开启 |
| `dalle` | 启用 DALL-E 功能。 | 开启 |
| `check_updates` | 允许检查更新。 | 开启 |
| `welcome_suggest` | 显示欢迎建议。 | 开启 |
| `market` | 启用助手市场功能。 | 开启 |
| `speech_to_text` | 启用语音转文本功能。 | 开启 |
| `knowledge_base` | 启用知识库功能。 | 开启 |
| `clerk_sign_up` | 启用Clerk注册功能。 | 开启 |
| 配置项 | 解释 | 默认值 |
| ------------------------- | ----------------------- | --- |
| `webrtc_sync` | 启用 WebRTC 同步功能。 | 关闭 |
| `language_model_settings` | 启用语言模型设置。 | 开启 |
| `openai_api_key` | 允许用户自定义 OpenAI API Key。 | 开启 |
| `openai_proxy_url` | 允许用户自定义 OpenAI 代理 URL。 | 开启 |
| `create_session` | 允许用户创建会话。 | 开启 |
| `edit_agent` | 允许用户编辑助手。 | 开启 |
| `dalle` | 启用 DALL-E 功能。 | 开启 |
| `check_updates` | 允许检查更新。 | 开启 |
| `welcome_suggest` | 显示欢迎建议。 | 开启 |
| `market` | 启用助手市场功能。 | 开启 |
| `speech_to_text` | 启用语音转文本功能。 | 开启 |
| `knowledge_base` | 启用知识库功能。 | 开启 |
| `clerk_sign_up` | 启用 Clerk 注册功能。 | 开启 |
你可以随时检查 [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) 以获取最新的特性标志列表。
+14 -3
View File
@@ -1,3 +1,16 @@
---
title: LobeChat Knowledge Base / File Upload
description: >-
Explore LobeChat's file upload and knowledge base management features with
core components.
tags:
- LobeChat
- File Upload
- Knowledge Base
- PostgreSQL
- OpenAI Embedding
---
# Knowledge Base / File Upload
LobeChat supports file upload and knowledge base management. This feature relies on the following core technical components. Understanding these components will help you successfully deploy and maintain the knowledge base system.
@@ -32,9 +45,7 @@ S3 (or S3-compatible storage services) is used for storing uploaded files.
OpenAI's Embedding service is used to convert text into vector representations.
<Callout type={'info'}>
LobeChat currently uses OpenAI's `text-embedding-3-small` model by default. Ensure your API Key has access to this model.
LobeChat currently uses OpenAI's `text-embedding-3-small` model by default. Ensure your API Key has access to this model.
</Callout>
- **Purpose**: Generate vector representations for semantic search
@@ -1,3 +1,14 @@
---
title: LobeChat 知识库 / 文件上传
description: 了解 LobeChat 的文件上传和知识库管理核心组件,助力成功部署。
tags:
- LobeChat
- 文件上传
- 知识库管理
- PostgreSQL
- OpenAI
---
# 知识库 / 文件上传
LobeChat 支持文件上传 / 知识库管理。该功能依赖于以下核心技术组件,了解这些组件将有助于你成功部署和维护知识库系统。
@@ -32,9 +43,7 @@ S3(或兼容 S3 协议的存储服务)用于存储上传的文件。
OpenAI 的嵌入(Embedding)服务用于将文本转化为向量表示。
<Callout type={'info'}>
LobeChat 当前默认使用 OpenAI `text-embedding-3-small` 模型,请确保你的 API Key 可以访问该模型。
LobeChat 当前默认使用 OpenAI `text-embedding-3-small` 模型,请确保你的 API Key 可以访问该模型。
</Callout>
- **用途**:生成文本的向量表示,用于语义搜索
@@ -42,8 +42,8 @@ id=displayName<maxToken:vision:fc:file>
目前支持的扩展能力有:
| --- | 描述 |
| -------- | ------------------------------------ |
| `fc` | 函数调用(function calling) |
| `vision` | 视觉识别 |
| `file` | 文件上传(比较hack,不建议日常使用) |
| --- | 描述 |
| -------- | ---------------------- |
| `fc` | 函数调用(function calling) |
| `vision` | 视觉识别 |
| `file` | 文件上传(比较 hack,不建议日常使用) |
+30 -34
View File
@@ -26,60 +26,55 @@ The best practice in this area is to use a file storage service (S3) to store im
<Steps>
### `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`
These are the two keys required by all S3 compatible storage services to access the S3 storage service, not detailed here.
These are the two keys required by all S3 compatible storage services to access the S3 storage service, not detailed here.
### `S3_ENDPOINT`
### `S3_ENDPOINT`
The request endpoint of the storage bucket. Note that this link should not contain the name of the storage bucket.
The request endpoint of the storage bucket. Note that this link should not contain the name of the storage bucket.
<Callout type={'warning'}>
`S3_ENDPOINT` must remove the suffix path, otherwise the uploaded files will not be accessible
</Callout>
<Callout type={'warning'}>
`S3_ENDPOINT` must remove the suffix path, otherwise the uploaded files will not be accessible
</Callout>
For example, for Cloudflare:
For example, for Cloudflare:
```shell
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
```
```shell
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
```
### `S3_BUCKET` and `S3_REGION`
### `S3_BUCKET` and `S3_REGION`
The name and region of the storage bucket. `S3_BUCKET` is required to specify the name of the storage bucket. `S3_REGION` is optional and is used to specify the region of the storage bucket. Generally, it does not need to be added, but some service providers may require configuration.
The name and region of the storage bucket. `S3_BUCKET` is required to specify the name of the storage bucket. `S3_REGION` is optional and is used to specify the region of the storage bucket. Generally, it does not need to be added, but some service providers may require configuration.
### `S3_SET_ACL`
### `S3_SET_ACL`
Whether to set the ACL to `public-read` when uploading files. This option is enabled by default. If the service provider does not support setting individual ACLs for files (i.e., all files inherit the ACL of the storage bucket), enabling this option may cause request errors. Set `S3_SET_ACL` to `0` to disable it.
Whether to set the ACL to `public-read` when uploading files. This option is enabled by default. If the service provider does not support setting individual ACLs for files (i.e., all files inherit the ACL of the storage bucket), enabling this option may cause request errors. Set `S3_SET_ACL` to `0` to disable it.
### `S3_PUBLIC_DOMAIN`
### `S3_PUBLIC_DOMAIN`
The public access domain of the storage bucket, used to access files in the storage bucket. This address needs to be **publicly readable**. The reason is that when OpenAI's gpt-4o and other vision models recognize images, OpenAI will try to download this image link on their servers. Therefore, this link must be publicly accessible. If it is a private link, OpenAI will not be able to access the image and thus will not be able to recognize the image content properly.
The public access domain of the storage bucket, used to access files in the storage bucket. This address needs to be **publicly readable**. The reason is that when OpenAI's gpt-4o and other vision models recognize images, OpenAI will try to download this image link on their servers. Therefore, this link must be publicly accessible. If it is a private link, OpenAI will not be able to access the image and thus will not be able to recognize the image content properly.
<Callout type={'warning'}>
Additionally, since this access domain is often a separate URL, it needs to be configured to allow
cross-origin access to the site. Otherwise, cross-origin issues will occur in the browser.
</Callout>
<Callout type={'warning'}>
Additionally, since this access domain is often a separate URL, it needs to be configured to allow
cross-origin access to the site. Otherwise, cross-origin issues will occur in the browser.
</Callout>
### `S3_ENABLE_PATH_STYLE`
### `S3_ENABLE_PATH_STYLE`
Whether to enable the `path-style` access mode of S3. This option is disabled by default. If your S3 service provider uses `path-style`, set `S3_ENABLE_PATH_STYLE` to `1` to enable it.
Whether to enable the `path-style` access mode of S3. This option is disabled by default. If your S3 service provider uses `path-style`, set `S3_ENABLE_PATH_STYLE` to `1` to enable it.
<Callout type={'info'}>
`path-style` and `virtual-host` are different ways to access buckets and objects in S3, with different URL structures and domain name resolutions.
`path-style` and `virtual-host` are different ways to access buckets and objects in S3, with different URL structures and domain name resolutions.
Assuming the domain name of the S3 service provider is s3.example.net, the bucket is mybucket, and the object is config.env, the specific differences are as follows:
Assuming the domain name of the S3 service provider is s3.example.net, the bucket is mybucket, and the object is config.env, the specific differences are as follows:
- path-style: `s3.example.net/mybucket/config.env`
- virtual-host: `mybucket.s3.example.net/config.env`
</Callout>
- path-style: `s3.example.net/mybucket/config.env`
- virtual-host: `mybucket.s3.example.net/config.env`
</Callout>
<Callout type={'tip'}>
Common S3 cloud service providers often default to the `virtual-host` mode, while self-deployed services like Minio default to using `path-style`. Therefore, if you use Minio as the S3 service, you need to set `S3_ENABLE_PATH_STYLE=1`.
</Callout>
Common S3 cloud service providers often default to the `virtual-host` mode, while self-deployed services like Minio default to using `path-style`. Therefore, if you use Minio as the S3 service, you need to set `S3_ENABLE_PATH_STYLE=1`.
</Callout>
</Steps>
## S3 Configuration Guide
@@ -88,6 +83,7 @@ Currently, the S3 configuration tutorials included in the documentation are:
<Cards>
<Card href={'/docs/self-hosting/advanced/s3/cloudflare-r2'} title={'Cloudflare R2'} />
<Card href={'/docs/self-hosting/advanced/s3/tencent-cloud'} title={'Tencent Cloud COS'} />
</Cards>
+28 -33
View File
@@ -12,7 +12,7 @@ tags:
LobeChat 在 [很早以前](https://x.com/lobehub/status/1724289575672291782) 就支持了多模态的 AI 会话,其中涉及到图片上传给大模型的功能。在客户端数据库方案中,图片文件直接以二进制数据存储在浏览器 IndexedDB 数据库,但在服务端数据库中这个方案并不可行。因为在 Postgres 中直接存储文件类二进制数据会大大浪费宝贵的数据库存储空间,并拖慢计算性能。
这块最佳实践是使用文件存储服务(S3)来存储图片文件,同时 S3 也是文件上传/知识库功能所依赖的大容量静态文件存储方案。
这块最佳实践是使用文件存储服务(S3)来存储图片文件,同时 S3 也是文件上传 / 知识库功能所依赖的大容量静态文件存储方案。
<Callout type={'info'}>
在本文档库中,S3 所指代的是指兼容 S3 存储方案,即支持 Amazon S3 API 的对象存储系统,常见例如
@@ -24,58 +24,52 @@ LobeChat 在 [很早以前](https://x.com/lobehub/status/1724289575672291782)
<Steps>
### `S3_ACCESS_KEY_ID` 与 `S3_SECRET_ACCESS_KEY`
所有 S3 兼容存储服务都需要的两个密钥,用于访问 S3 存储服务,不详细展开。
所有 S3 兼容存储服务都需要的两个密钥,用于访问 S3 存储服务,不详细展开。
### `S3_ENDPOINT`
### `S3_ENDPOINT`
存储桶的请求端点, 注意此处链接不应该包含存储桶的名称。
存储桶的请求端点, 注意此处链接不应该包含存储桶的名称。
<Callout type={'warning'}>`S3_ENDPOINT`必须删除后缀路径,否则会无法访问所上传文件</Callout>
<Callout type={'warning'}>`S3_ENDPOINT`必须删除后缀路径,否则会无法访问所上传文件</Callout>
例如 Cloudflare 为:
例如 Cloudflare 为:
```shell
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
```
```shell
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
```
### `S3_BUCKET` 和 `S3_REGION`
### `S3_BUCKET` 和 `S3_REGION`
存储桶的名称和区域,`S3_BUCKET` 是必须的,用于指定存储桶的名称。 `S3_REGION` 是可选的,用于指定存储桶的区域,一般来说不需要添加,但某些服务商则需要配置。
存储桶的名称和区域,`S3_BUCKET` 是必须的,用于指定存储桶的名称。 `S3_REGION` 是可选的,用于指定存储桶的区域,一般来说不需要添加,但某些服务商则需要配置。
### `S3_SET_ACL`
### `S3_SET_ACL`
是否在上传文件时设置 ACL 为 `public-read`。该选项默认启用。如果服务商不支持为文件设置单独的 ACL(即所有文件继承存储桶的 ACL),启用此选项可能会导致请求错误,将 `S3_SET_ACL` 设置为 `0` 即可关闭。
是否在上传文件时设置 ACL 为 `public-read`。该选项默认启用。如果服务商不支持为文件设置单独的 ACL(即所有文件继承存储桶的 ACL),启用此选项可能会导致请求错误,将 `S3_SET_ACL` 设置为 `0` 即可关闭。
### `S3_PUBLIC_DOMAIN`
### `S3_PUBLIC_DOMAIN`
存储桶对外的访问域名,用于访问存储桶中的文件,这个地址需要**允许互联网可读**。 原因是 OpenAI 的 gpt-4o 等视觉模型识别图片时,OpenAI 会尝试在他们的服务器中下载这个图片链接,因此这个链接必须是公开可访问的,如果是私有的链接,OpenAI 将无法访问到这个图片,进而无法正常识别到图片内容。
存储桶对外的访问域名,用于访问存储桶中的文件,这个地址需要**允许互联网可读**。 原因是 OpenAI 的 gpt-4o 等视觉模型识别图片时,OpenAI 会尝试在他们的服务器中下载这个图片链接,因此这个链接必须是公开可访问的,如果是私有的链接,OpenAI 将无法访问到这个图片,进而无法正常识别到图片内容。
<Callout type={'warning'}>
此外,由于该访问域名往往是一个独立的网址,因此需要配置允许站点的跨域访问,否则会在浏览器中出现跨域问题。
</Callout>
</Callout>
### `S3_ENABLE_PATH_STYLE`
### `S3_ENABLE_PATH_STYLE`
是否启用 S3 的 `path-style` 访问模式。此选项默认禁用。如果您的 S3 服务提供商使用 `path-style`,请将 `S3_ENABLE_PATH_STYLE` 设置为 `1` 以启用它。
是否启用 S3 的 `path-style` 访问模式。此选项默认禁用。如果您的 S3 服务提供商使用 `path-style`,请将 `S3_ENABLE_PATH_STYLE` 设置为 `1` 以启用它。
<Callout type={'info'}>
`path-style` 和 `virtual-host` 在 S3 中是访问 bucket 和 object 的不同方式,URL 的结构和域名解析不太一样
<Callout type={'info'}>
假设 S3 服务商的域名是 s3.example.net ,bucket 为 mybucket,object 为 config.env,具体区别如下:
`path-style` 和 `virtual-host` 在 S3 中是访问 bucket 和 object 的不同方式,URL 的结构和域名解析不太一样
假设 S3 服务商的域名是 s3.example.net ,bucket为mybucket,object为config.env,具体区别如下:
- path-style : `s3.example.net/mybucket/config.env`
- virtual-host : `mybucket.s3.example.net/config.env`
</Callout>
<Callout type={'tip'}>
常见的 S3 Cloud 服务商往往默认采用 `virtual-host` 模式,而自部署服务 minio 则默认使用的是 `path-style`。 因此如果你使用了 minio 作为 S3 服务,你需要设置 `S3_ENABLE_PATH_STYLE=1` 。
</Callout>
- path-style : `s3.example.net/mybucket/config.env`
- virtual-host : `mybucket.s3.example.net/config.env`
</Callout>
<Callout type={'tip'}>
常见的 S3 Cloud 服务商往往默认采用 `virtual-host` 模式,而自部署服务 minio 则默认使用的是 `path-style`。 因此如果你使用了 minio 作为 S3 服务,你需要设置 `S3_ENABLE_PATH_STYLE=1` 。
</Callout>
</Steps>
## S3 配置指南
@@ -84,6 +78,7 @@ S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
<Cards>
<Card href={'/zh/docs/self-hosting/advanced/s3/cloudflare-r2'} title={'Cloudflare R2'} />
<Card href={'/zh/docs/self-hosting/advanced/s3/tencent-cloud'} title={'腾讯云 COS'} />
</Cards>
+52 -81
View File
@@ -14,118 +14,89 @@ We need to configure an S3 storage service in the server-side database to store
## Configuration Steps
<Steps>
### Configure and Obtain S3 Bucket
### Configure and Obtain S3 Bucket
You need to go to your S3 service provider (such as AWS S3, Cloudflare R2, etc.) and create a new storage bucket. The following is an example using Cloudflare R2 to guide you through the creation process.
You need to go to your S3 service provider (such as AWS S3, Cloudflare R2, etc.) and create a new storage bucket. The following is an example using Cloudflare R2 to guide you through the creation process.
The interface of Cloudflare R2 is shown below:
The interface of Cloudflare R2 is shown below:
<Image alt={'Cloudflare R2 Storage Interface'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'} />
<Image
alt={'Cloudflare R2 Storage Interface'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'}
/>
When creating the bucket, specify its name and then click create.
When creating the bucket, specify its name and then click create.
<Image alt={'Create Bucket in R2'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'} />
<Image
alt={'Create Bucket in R2'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'}
/>
### Obtain Environment Variables for the Bucket
### Obtain Environment Variables for the Bucket
In the settings of the R2 storage bucket, you can view the bucket configuration information:
In the settings of the R2 storage bucket, you can view the bucket configuration information:
<Image alt={'View relevant information of the bucket'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'} />
<Image
alt={'View relevant information of the bucket'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'}
/>
The corresponding environment variables are:
The corresponding environment variables are:
```shell
# Bucket name
S3_BUCKET=lobechat
# Request endpoint of the bucket (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the page for applying S3 API token)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Access domain of the bucket
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```
```shell
# Bucket name
S3_BUCKET=lobechat
# Request endpoint of the bucket (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the page for applying S3 API token)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# Access domain of the bucket
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```
<Callout type={'warning'}>
`S3_ENDPOINT` must have its path removed, otherwise uploaded files cannot be accessed.
</Callout>
<Callout type={'warning'}>
`S3_ENDPOINT` must have its path removed, otherwise uploaded files cannot be accessed.
</Callout>
### Obtain S3 Key Environment Variables
### Obtain S3 Key Environment Variables
You need to obtain the access key for S3 so that the LobeChat server has permission to access the S3 storage service. In R2, you can configure the access key in the account details:
You need to obtain the access key for S3 so that the LobeChat server has permission to access the S3 storage service. In R2, you can configure the access key in the account details:
<Image alt={'View access key of the bucket'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'} />
<Image
alt={'View access key of the bucket'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'}
/>
Click the button in the upper right corner to create an API token and enter the create API Token page.
Click the button in the upper right corner to create an API token and enter the create API Token page.
<Image alt={'Create corresponding API token'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'} />
<Image
alt={'Create corresponding API token'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'}
/>
Since our server-side database needs to read and write to the S3 storage service, the permission needs to be set to `Object Read and Write`, then click create.
Since our server-side database needs to read and write to the S3 storage service, the permission needs to be set to `Object Read and Write`, then click create.
<Image alt={'Configure API token permissions'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'} />
<Image
alt={'Configure API token permissions'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'}
/>
After creation, you can see the corresponding S3 API token.
After creation, you can see the corresponding S3 API token.
<Image alt={'Copy API token'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'} />
<Image
alt={'Copy API token'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'}
/>
The corresponding environment variables are:
The corresponding environment variables are:
```shell
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
```
```shell
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
```
### Configure Cross-Origin Resource Sharing (CORS)
### Configure Cross-Origin Resource Sharing (CORS)
Since S3 storage services are often on a separate domain, cross-origin access needs to be configured.
Since S3 storage services are often on a separate domain, cross-origin access needs to be configured.
In R2, you can find the CORS configuration in the settings of the storage bucket:
In R2, you can find the CORS configuration in the settings of the storage bucket:
<Image alt={'Cross-Origin Settings in Cloudflare R2'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'} />
<Image
alt={'Cross-Origin Settings in Cloudflare R2'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'}
/>
Add a CORS rule to allow requests from your domain (in the previous section, it is `https://your-project.vercel.app`):
Add a CORS rule to allow requests from your domain (in the previous section, it is `https://your-project.vercel.app`):
<Image alt={'Configure allowed site domain'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'} />
<Image
alt={'Configure allowed site domain'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'}
/>
Example configuration is as follows:
Example configuration is as follows:
```json
[
{
"AllowedOrigins": ["https://your-project.vercel.app"],
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
"AllowedHeaders": ["*"]
}
]
```
After configuration, click save.
```json
[
{
"AllowedOrigins": ["https://your-project.vercel.app"],
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
"AllowedHeaders": ["*"]
}
]
```
After configuration, click save.
</Steps>
## Overview of Environment Variables
@@ -15,121 +15,92 @@ tags:
## 配置步骤
<Steps>
### 配置并获取 S3 存储桶
### 配置并获取 S3 存储桶
你需要前往你的 S3 服务提供商(如 AWS S3、Cloudflare R2 等)并创建一个新的存储桶(Bucket)。接下来以 Cloudflare R2 为例,介绍创建流程。
你需要前往你的 S3 服务提供商(如 AWS S3、Cloudflare R2 等)并创建一个新的存储桶(Bucket)。接下来以 Cloudflare R2 为例,介绍创建流程。
下图是 Cloudflare R2 的界面:
下图是 Cloudflare R2 的界面:
<Image alt={'Cloudflare R2 存储界面'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'} />
<Image
alt={'Cloudflare R2 存储界面'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee'}
/>
创建存储桶时将指定其名称,然后点击创建。
创建存储桶时将指定其名称,然后点击创建。
<Image alt={'R2 创建存储桶'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'} />
<Image
alt={'R2 创建存储桶'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7'}
/>
### 获取存储桶相关环境变量
### 获取存储桶相关环境变量
在 R2 存储桶的设置中,可以看到桶配置的信息:
在 R2 存储桶的设置中,可以看到桶配置的信息:
<Image alt={'查看存储桶的相关信息'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'} />
<Image
alt={'查看存储桶的相关信息'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee'}
/>
其对应的环境变量为:
其对应的环境变量为:
```shell
# 存储桶的名称
S3_BUCKET=lobechat
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```
```shell
# 存储桶的名称
S3_BUCKET=lobechat
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://s3-for-lobechat.your-domain.com
```
<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
### 获取 S3 密钥环境变量
### 获取 S3 密钥环境变量
你需要获取 S3 的访问密钥,以便 LobeChat 的服务端有权限访问 S3 存储服务。在 R2 中,你可以在账户详情中配置访问密钥:
你需要获取 S3 的访问密钥,以便 LobeChat 的服务端有权限访问 S3 存储服务。在 R2 中,你可以在账户详情中配置访问密钥:
<Image alt={'查看存储桶的访问秘钥'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'} />
<Image
alt={'查看存储桶的访问秘钥'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d'}
/>
点击右上角按钮创建 API token,进入创建 API Token 页面
点击右上角按钮创建 API token,进入创建 API Token 页面
<Image alt={'创建对应 API token'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'} />
<Image
alt={'创建对应 API token'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/7b0ea46c-5157-40a8-888f-f47664a4884f'}
/>
鉴于我们的服务端数据库需要读写 S3 存储服务,因此权限需要选择`对象读与写`,然后点击创建。
鉴于我们的服务端数据库需要读写 S3 存储服务,因此权限需要选择`对象读与写`,然后点击创建。
<Image alt={'配置 API token 权限'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'} />
<Image
alt={'配置 API token 权限'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf'}
/>
创建完成后,就可以看到对应的 S3 API token
创建完成后,就可以看到对应的 S3 API token
<Image alt={'复制 API token'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'} />
<Image
alt={'复制 API token'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397'}
/>
其对应的环境变量为:
其对应的环境变量为:
```shell
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
```
```shell
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
```
### 配置跨域
### 配置跨域
由于 S3 存储服务往往是一个独立的网址,因此需要配置跨域访问。
由于 S3 存储服务往往是一个独立的网址,因此需要配置跨域访问。
在 R2 中,你可以在存储桶的设置中找到跨域配置:
在 R2 中,你可以在存储桶的设置中找到跨域配置:
<Image alt={'Cloudflare R2 的跨域设置'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'} />
<Image
alt={'Cloudflare R2 的跨域设置'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23'}
/>
添加跨域规则,允许你的域名(在上文是 `https://your-project.vercel.app`)来源的请求:
添加跨域规则,允许你的域名(在上文是 `https://your-project.vercel.app`)来源的请求:
<Image alt={'配置允许你的站点域名'} src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'} />
<Image
alt={'配置允许你的站点域名'}
src={'https://github.com/lobehub/lobe-chat/assets/28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d'}
/>
示例配置如下:
示例配置如下:
```json
[
{
"AllowedOrigins": ["https://your-project.vercel.app"],
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
"AllowedHeaders": ["*"]
}
]
```
配置后点击保存即可。
```json
[
{
"AllowedOrigins": ["https://your-project.vercel.app"],
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
"AllowedHeaders": ["*"]
}
]
```
配置后点击保存即可。
</Steps>
## 环境变量一览
<Callout type={'warning'}>URL的`https://`不可缺失,须保持URL的完整性</Callout>
<Callout type={'warning'}>URL 的`https://`不可缺失,须保持 URL 的完整性</Callout>
```shell
# S3 秘钥
+20 -34
View File
@@ -19,58 +19,44 @@ We need to configure S3 storage service for file storage in the server-side data
<Steps>
### Configure and Obtain S3 Bucket
Create a new bucket on [Tencent Cloud COS](https://console.cloud.tencent.com/cos/bucket):
Create a new bucket on [Tencent Cloud COS](https://console.cloud.tencent.com/cos/bucket):
<Image
alt={'Tencent Cloud COS Storage Interface'}
src={'https://github.com/user-attachments/assets/d3626294-74ba-4944-9a63-052e6cf719ab'}
/>
<Image alt={'Tencent Cloud COS Storage Interface'} src={'https://github.com/user-attachments/assets/d3626294-74ba-4944-9a63-052e6cf719ab'} />
Name the bucket (e.g., 'lobe'). Choose 'Public Read, Private Write', select any region, and keep other settings default.
Name the bucket (e.g., 'lobe'). Choose 'Public Read, Private Write', select any region, and keep other settings default.
<Image
alt={'COS Create Bucket'}
src={'https://github.com/user-attachments/assets/7257eb0e-4e2c-4db2-981d-354598e2c60f'}
/>
<Image alt={'COS Create Bucket'} src={'https://github.com/user-attachments/assets/7257eb0e-4e2c-4db2-981d-354598e2c60f'} />
### Get Bucket-related Environment Variables
### Get Bucket-related Environment Variables
View bucket information in COS bucket overview:
View bucket information in COS bucket overview:
<Image
alt={'View Bucket Information'}
src={'https://github.com/user-attachments/assets/d7d65e32-679d-4e50-a933-28cf5dde1330'}
/>
<Image alt={'View Bucket Information'} src={'https://github.com/user-attachments/assets/d7d65e32-679d-4e50-a933-28cf5dde1330'} />
Corresponding environment variables:
Corresponding environment variables:
```shell
S3_BUCKET=lobe-130xxxxxx2
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
S3_REGION=ap-chengdu
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
```shell
S3_BUCKET=lobe-130xxxxxx2
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
S3_REGION=ap-chengdu
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
<Callout type={'warning'}>
Note: `S3_ENDPOINT` should be `https://cos.ap-chengdu.myqcloud.com`, not `https://lobe-130xxxxxx2.cos.ap-chengdu.myqcloud.com`
Include `https://` in the URL
</Callout>
</Callout>
### Configure CORS
### Configure CORS
Add the following in 'Security Management - CORS Settings':
Add the following in 'Security Management - CORS Settings':
<Image alt={'Configure CORS'} src={'https://github.com/user-attachments/assets/35164b25-c964-42ce-9cb0-32f6ebe1d07c'} />
<Image
alt={'Configure CORS'}
src={'https://github.com/user-attachments/assets/35164b25-c964-42ce-9cb0-32f6ebe1d07c'}
/>
### Get S3 Keys
Create a new SecretId and SecretKey at [Tencent Cloud API Key Management](https://console.cloud.tencent.com/cam/capi). Use as `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`.
### Get S3 Keys
Create a new SecretId and SecretKey at [Tencent Cloud API Key Management](https://console.cloud.tencent.com/cam/capi). Use as `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`.
</Steps>
### Additional Notes
@@ -15,65 +15,50 @@ tags:
## 配置步骤
<Steps>
### 配置并获取 S3 存储桶
### 配置并获取 S3 存储桶
你需要首先前往 [腾讯云 COS](https://console.cloud.tencent.com/cos/bucket) 并创建一个新的存储桶(Bucket):
你需要首先前往 [腾讯云 COS](https://console.cloud.tencent.com/cos/bucket) 并创建一个新的存储桶(Bucket):
<Image alt={'腾讯云 COS 存储界面'} src={'https://github.com/user-attachments/assets/d3626294-74ba-4944-9a63-052e6cf719ab'} />
<Image
alt={'腾讯云 COS 存储界面'}
src={'https://github.com/user-attachments/assets/d3626294-74ba-4944-9a63-052e6cf719ab'}
/>
创建存储桶时将指定其名称,下文以 `lobe` 为例。选择 `公有读私有写`,地域随意,其余配置一概默认即可,然后点击创建。
创建存储桶时将指定其名称,下文以 `lobe` 为例。选择 `公有读私有写`,地域随意,其余配置一概默认即可,然后点击创建。
<Image alt={'COS 创建存储桶'} src={'https://github.com/user-attachments/assets/7257eb0e-4e2c-4db2-981d-354598e2c60f'} />
<Image
alt={'COS 创建存储桶'}
src={'https://github.com/user-attachments/assets/7257eb0e-4e2c-4db2-981d-354598e2c60f'}
/>
### 获取存储桶相关环境变量
### 获取存储桶相关环境变量
在 COS 存储桶的概览设置中,可以看到桶配置的信息:
在 COS 存储桶的概览设置中,可以看到桶配置的信息:
<Image alt={'查看存储桶的相关信息'} src={'https://github.com/user-attachments/assets/d7d65e32-679d-4e50-a933-28cf5dde1330'} />
<Image
alt={'查看存储桶的相关信息'}
src={'https://github.com/user-attachments/assets/d7d65e32-679d-4e50-a933-28cf5dde1330'}
/>
其对应的环境变量为:
其对应的环境变量为:
```shell
# 存储桶的名称
S3_BUCKET=lobe-130xxxxxx2
# 存储桶的请求端点,注意没有前面的桶名
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
# 桶的区域
S3_REGION=ap-chengdu
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
```shell
# 存储桶的名称
S3_BUCKET=lobe-130xxxxxx2
# 存储桶的请求端点,注意没有前面的桶名
S3_ENDPOINT=https://cos.ap-chengdu.myqcloud.com
# 桶的区域
S3_REGION=ap-chengdu
# 存储桶对外的访问域名
S3_PUBLIC_DOMAIN=https://lobe-1251234567.cos.ap-chengdu.myqcloud.com
```
<Callout type={'warning'}>
请注意,`S3_ENDPOINT` 的值为 `https://cos.ap-chengdu.myqcloud.com`,而不是 `https://lobe-130xxxxxx2.cos.ap-chengdu.myqcloud.com`
<Callout type={'warning'}>
请注意,`S3_ENDPOINT` 的值为 `https://cos.ap-chengdu.myqcloud.com`,而不是 `https://lobe-130xxxxxx2.cos.ap-chengdu.myqcloud.com`
且此处 URL 的 `https://` 不可缺失,须保持 URL 的完整性
</Callout>
且此处 URL 的 `https://` 不可缺失,须保持 URL 的完整性
### 配置跨域
</Callout>
在左侧 `安全管理 - 跨域访问 CORS 设置` 中,添加以下配置并保存:
### 配置跨域
<Image alt={'配置跨域'} src={'https://github.com/user-attachments/assets/35164b25-c964-42ce-9cb0-32f6ebe1d07c'} />
在左侧 `安全管理 - 跨域访问 CORS 设置` 中,添加以下配置并保存:
<Image
alt={'配置跨域'}
src={'https://github.com/user-attachments/assets/35164b25-c964-42ce-9cb0-32f6ebe1d07c'}
/>
### 获取 S3 秘钥
前往 [腾讯云 API 密钥管理](https://console.cloud.tencent.com/cam/capi) 创建一个新的 SecretId 和 SecretKey,填写为 `S3_ACCESS_KEY_ID` 和 `S3_SECRET_ACCESS_KEY` 即可。
### 获取 S3 秘钥
前往 [腾讯云 API 密钥管理](https://console.cloud.tencent.com/cam/capi) 创建一个新的 SecretId 和 SecretKey,填写为 `S3_ACCESS_KEY_ID` 和 `S3_SECRET_ACCESS_KEY` 即可。
</Steps>
### 附加说明
@@ -139,9 +139,9 @@ export type UserModelProviderConfig = Record<string, ProviderConfig>;
- Type `ProviderConfig`
| Property name | Type | Description |
| ------------------- | -------- | ------------------------------------------- | ------------------------------ |
| autoFetchModelLists | boolean | Whether to automatically fetch model lists. |
| enabled | boolean | Whether the model provider is enabled. |
| enabledModels | string[] | null | The IDs of the enabled models. |
| fetchOnClient | boolean | Whether to fetch on the client. |
| Property name | Type | Description | |
| ------------------- | --------- | ------------------------------------------- | ------------------------------ |
| autoFetchModelLists | boolean | Whether to automatically fetch model lists. | |
| enabled | boolean | Whether the model provider is enabled. | |
| enabledModels | string\[] | null | The IDs of the enabled models. |
| fetchOnClient | boolean | Whether to fetch on the client. | |
@@ -30,7 +30,7 @@ https://lobehub.com/?settings=<JSON格式的设置对象>
https://lobehub.com/?settings={"keyVaults":{"openai":{"apiKey":"user-key","baseURL":"https://your-proxy.com/v1"}}}
```
JSON格式的设置示例:
JSON 格式的设置示例:
```json
{
@@ -70,7 +70,7 @@ console.log(url);
- 参数及其类型
| 参数名称 | 类型 |
| 参数名称 | 类型 |
| ---------- | -------------------------- |
| anthropic | `OpenAICompatibleKeyVault` |
| azure | `AzureOpenAIKeyVault` |
@@ -90,25 +90,25 @@ console.log(url);
- Type `OpenAICompatibleKeyVault`
| 参数 | 类型 | 描述 |
| ------- | ------ | ----------------- |
| 参数 | 类型 | 描述 |
| ------- | ------ | ----------- |
| apiKey | string | 模型的 API 密钥。 |
| baseURL | string | 模型API端点。 |
| baseURL | string | 模型 API 端点。 |
- Type `AzureOpenAIKeyVault`
| 参数 | 类型 | 描述 |
| ---------- | ------ | -------------------------- |
| 参数 | 类型 | 描述 |
| ---------- | ------ | ---------------------- |
| apiVersion | string | Azure OpenAI 的 API 版本。 |
| apiKey | string | 模型的 API 密钥。 |
| baseURL | string | 模型API端点。 |
| apiKey | string | 模型的 API 密钥。 |
| baseURL | string | 模型 API 端点。 |
- Type `AWSBedrockKeyVault`
| 参数 | 类型 | 描述 |
| --------------- | ------ | --------------------------- |
| 参数 | 类型 | 描述 |
| --------------- | ------ | --------------------- |
| accessKeyId | string | AWS Bedrock 的访问密钥 ID。 |
| region | string | AWS Bedrock 的区域。 |
| region | string | AWS Bedrock 的区域。 |
| secretAccessKey | string | AWS Bedrock 的访问密钥。 |
### languageModel
@@ -117,7 +117,7 @@ console.log(url);
export type UserModelProviderConfig = Record<string, ProviderConfig>;
```
| 参数名称 | 类型 |
| 参数名称 | 类型 |
| ---------- | ---------------- |
| anthropic | `ProviderConfig` |
| azure | `ProviderConfig` |
@@ -137,9 +137,9 @@ export type UserModelProviderConfig = Record<string, ProviderConfig>;
- 类型 `ProviderConfig`
| 参数 | TS 类型 | 描述 |
| ------------------- | -------- | -------------------------------------------- |
| autoFetchModelLists | boolean | 是否自动获取模型列表。 |
| enabled | boolean | 是否启用该模型。 |
| enabledModels | string[] | 启用的模型的 ID。 |
| fetchOnClient | boolean | 是否在客户端发起请求,默认在服务端发起请求。 |
| 参数 | TS 类型 | 描述 |
| ------------------- | --------- | ---------------------- |
| autoFetchModelLists | boolean | 是否自动获取模型列表。 |
| enabled | boolean | 是否启用该模型。 |
| enabledModels | string\[] | 启用的模型的 ID。 |
| fetchOnClient | boolean | 是否在客户端发起请求,默认在服务端发起请求。 |
+73 -89
View File
@@ -30,27 +30,15 @@ If you deployed your project according to the one-click deployment steps in the
After forking the project, due to Github's limitations, you need to manually enable Workflows on the Actions page of your forked project and start the Upstream Sync Action. Once enabled, you can set up automatic updates to occur every hour.
<Image
alt="Enable Automatic Updates S1"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985117-4d48fe7b-0412-4667-8129-b25ebcf2c9de.png"
/>
<Image alt="Enable Automatic Updates S1" src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985117-4d48fe7b-0412-4667-8129-b25ebcf2c9de.png" />
<Image
alt="Enable Automatic Updates S2"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985177-7677b4ce-c348-4145-9f60-829d448d5be6.png"
/>
<Image alt="Enable Automatic Updates S2" src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985177-7677b4ce-c348-4145-9f60-829d448d5be6.png" />
If you encounter a sync failure, you need to manually click "Update Branch" once.
<Image
alt="GitHub Action Sync Failure"
src="https://github.com/user-attachments/assets/9baacac6-5af4-460b-862d-682b76c18459"
/>
<Image alt="GitHub Action Sync Failure" src="https://github.com/user-attachments/assets/9baacac6-5af4-460b-862d-682b76c18459" />
<Image
alt="Manually Sync 'Update Branch'"
src="https://github.com/user-attachments/assets/d524c20d-306a-45bc-971b-96920b87fab4"
/>
<Image alt="Manually Sync 'Update Branch'" src="https://github.com/user-attachments/assets/d524c20d-306a-45bc-971b-96920b87fab4" />
## `B` Docker Deployment
@@ -59,34 +47,33 @@ Upgrading the Docker deployment version is very simple, you just need to redeplo
<Steps>
### Stop and Remove the Current Running LobeChat Container
Assuming the LobeChat container is named `lobe-chat`, use the following commands to stop and remove the currently running LobeChat container:
Assuming the LobeChat container is named `lobe-chat`, use the following commands to stop and remove the currently running LobeChat container:
```fish
docker stop lobe-chat
docker rm lobe-chat
```
```fish
docker stop lobe-chat
docker rm lobe-chat
```
### Pull the Latest LobeChat Image
### Pull the Latest LobeChat Image
Use the following command to pull the latest Docker image for LobeChat:
Use the following command to pull the latest Docker image for LobeChat:
```fish
docker pull lobehub/lobe-chat
```
```fish
docker pull lobehub/lobe-chat
```
### Restart the Docker Container
### Restart the Docker Container
Redeploy the LobeChat container using the newly pulled image:
```fish
docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
Redeploy the LobeChat container using the newly pulled image:
```fish
docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
</Steps>
Ensure that you have sufficient permissions to stop and remove the container before executing these commands, and that Docker has sufficient permissions to pull the new image.
@@ -94,80 +81,77 @@ Ensure that you have sufficient permissions to stop and remove the container bef
<Callout type={'tip'}>
**If I redeploy, will I lose my local chat records?**
No need to worry, you won't. All of LobeChat's chat records are stored in your local browser. Therefore, when redeploying LobeChat using Docker, your chat records will not be lost.
No need to worry, you won't. All of LobeChat's chat records are stored in your local browser. Therefore, when redeploying LobeChat using Docker, your chat records will not be lost.
</Callout>
If you wish to automate the above steps, you can follow the method below and use Crontab scheduling to complete it. The specific steps are as follows.
<Steps>
### Write automatic update scripts and configuration files
### Write automatic update scripts and configuration files
First, create a `lobe.env` configuration file with various environment variables, for example:
First, create a `lobe.env` configuration file with various environment variables, for example:
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
Then, you can use the following script to automate the update:
Then, you can use the following script to automate the update:
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# Set up proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# Set up proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
echo "Detected lobe-chat update"
echo "Detected lobe-chat update"
# Remove the old container
echo "Removed: $(docker rm -f lobe-chat)"
# Remove the old container
echo "Removed: $(docker rm -f lobe-chat)"
# Run the new container(Please change the path to the env file)
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=lobe-chat --restart=always lobehub/lobe-chat)"
# Run the new container(Please change the path to the env file)
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=lobe-chat --restart=always lobehub/lobe-chat)"
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
<Callout type={'warning'}>
This script can be used in Crontab, but please ensure that your Crontab can find the correct
Docker command. It is recommended to use absolute paths.
</Callout>
<Callout type={'warning'}>
This script can be used in Crontab, but please ensure that your Crontab can find the correct
Docker command. It is recommended to use absolute paths.
</Callout>
Configure Crontab to execute the script every 5 minutes:
Configure Crontab to execute the script every 5 minutes:
### Configure Crontab to automatically execute scripts
### Configure Crontab to automatically execute scripts
The following command configures Crontab to execute scripts every 5 minutes, or as often as you like:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
The following command configures Crontab to execute scripts every 5 minutes, or as often as you like:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
@@ -25,27 +25,15 @@ tags:
当你 Fork 了项目后,由于 Github 的限制,你需要手动在你 Fork 的项目的 Actions 页面启用 Workflows,并启动 Upstream Sync Action。启用后,你可以设置每小时进行一次自动更新。
<Image
alt="启动自动更新 S1"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985117-4d48fe7b-0412-4667-8129-b25ebcf2c9de.png"
/>
<Image alt="启动自动更新 S1" src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985117-4d48fe7b-0412-4667-8129-b25ebcf2c9de.png" />
<Image
alt="启动自动更新 S2"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985177-7677b4ce-c348-4145-9f60-829d448d5be6.png"
/>
<Image alt="启动自动更新 S2" src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/266985177-7677b4ce-c348-4145-9f60-829d448d5be6.png" />
如果你遇到了同步失败的情况,你需要手动重新点一次 「Update Branch」。
<Image
alt="GitHub Action 同步失败"
src="https://github.com/user-attachments/assets/9baacac6-5af4-460b-862d-682b76c18459"
/>
<Image alt="GitHub Action 同步失败" src="https://github.com/user-attachments/assets/9baacac6-5af4-460b-862d-682b76c18459" />
<Image
alt="手动同步 「Update Branch」"
src="https://github.com/user-attachments/assets/d524c20d-306a-45bc-971b-96920b87fab4"
/>
<Image alt="手动同步 「Update Branch」" src="https://github.com/user-attachments/assets/d524c20d-306a-45bc-971b-96920b87fab4" />
## `B` Docker 部署
@@ -54,34 +42,33 @@ Docker 部署版本的升级非常简单,只需要重新部署 LobeChat 的最
<Steps>
### 停止并删除当前运行的 LobeChat 容器
假设 LobeChat 容器的名称是 `lobe-chat`,使用以下指令停止并删除当前运行的 LobeChat 容器:
假设 LobeChat 容器的名称是 `lobe-chat`,使用以下指令停止并删除当前运行的 LobeChat 容器:
```fish
docker stop lobe-chat
docker rm lobe-chat
```
```fish
docker stop lobe-chat
docker rm lobe-chat
```
### 拉取最新的 LobeChat 镜像
### 拉取最新的 LobeChat 镜像
使用以下命令拉取 LobeChat 的最新 Docker 镜像:
使用以下命令拉取 LobeChat 的最新 Docker 镜像:
```fish
docker pull lobehub/lobe-chat
```
```fish
docker pull lobehub/lobe-chat
```
### 重新启动 Docker 容器
### 重新启动 Docker 容器
使用新拉取的镜像重新部署 LobeChat 容器:
```fish
docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
使用新拉取的镜像重新部署 LobeChat 容器:
```fish
docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
</Steps>
确保在执行这些命令之前,您有足够的权限来停止和删除容器,并且 Docker 有足够的权限来拉取新的镜像。
@@ -89,77 +76,74 @@ docker run -d -p 3210:3210 \
<Callout type={'tip'}>
**重新部署的话,我本地的聊天记录会丢失吗?**
放心,不会的。LobeChat 的聊天记录全部都存储在你的本地浏览器中。因此使用 Docker 重新部署 LobeChat 时,你的聊天记录并不会丢失。
放心,不会的。LobeChat 的聊天记录全部都存储在你的本地浏览器中。因此使用 Docker 重新部署 LobeChat 时,你的聊天记录并不会丢失。
</Callout>
如果你希望自动化执行以上步骤,你可以参照下面的方法,利用 Crontab 定时来完成。具体步骤如下。
<Steps>
### 撰写自动更新脚本、配置文件
### 撰写自动更新脚本、配置文件
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
然后,你可以使用以下脚本来自动更新:
然后,你可以使用以下脚本来自动更新:
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# 设置代理(可选)
# export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# 设置代理(可选)
# export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# 拉取最新的镜像并将输出存储在变量中
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# 拉取最新的镜像并将输出存储在变量中
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# 检查拉取命令是否成功执行
if [ $? -ne 0 ]; then
exit 1
fi
# 检查拉取命令是否成功执行
if [ $? -ne 0 ]; then
exit 1
fi
# 检查输出中是否包含特定的字符串
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# 检查输出中是否包含特定的字符串
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# 如果镜像已经是最新的,则不执行任何操作
if [ $? -eq 0 ]; then
exit 0
fi
# 如果镜像已经是最新的,则不执行任何操作
if [ $? -eq 0 ]; then
exit 0
fi
echo "Detected lobe-chat update"
echo "Detected lobe-chat update"
# 删除旧的容器
echo "Removed: $(docker rm -f lobe-chat)"
# 删除旧的容器
echo "Removed: $(docker rm -f lobe-chat)"
# 运行新的容器(请将env配置文件地址改为你的实际地址)
echo "Started: $(docker run -d --network=host --env-file path/to/lobe.env --name=lobe-chat --restart=always lobehub/lobe-chat)"
# 运行新的容器(请将env配置文件地址改为你的实际地址)
echo "Started: $(docker run -d --network=host --env-file path/to/lobe.env --name=lobe-chat --restart=always lobehub/lobe-chat)"
# 打印更新的时间和版本
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# 打印更新的时间和版本
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
<Callout type={'warning'}>
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
</Callout>
<Callout type={'warning'}>
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
</Callout>
### 配置 Crontab 自动执行脚本
### 配置 Crontab 自动执行脚本
以下命令可以配置 Crontab 每 5 分钟执行一次脚本,你也可以根据需要调整执行频率:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
以下命令可以配置 Crontab 每 5 分钟执行一次脚本,你也可以根据需要调整执行频率:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
+14 -21
View File
@@ -22,38 +22,31 @@ WebRTC (Web Real-Time Communication) is a technology that enables peer-to-peer c
To use the WebRTC synchronization feature in LobeChat, you need to complete the following steps:
<Steps>
### Deploy Signaling Server
### Deploy Signaling Server
Deploy a WebRTC signaling server with one click using the Zeabur platform:
Deploy a WebRTC signaling server with one click using the Zeabur platform:
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/MY0JZG?referralCode=arvinxx)
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/MY0JZG?referralCode=arvinxx)
Alternatively, you can view the [source code](https://github.com/lobehub/y-webrtc-signaling) and deploy it on your own.
Alternatively, you can view the [source code](https://github.com/lobehub/y-webrtc-signaling) and deploy it on your own.
After deployment, you will receive a URL, for example: `https://my-signaling-server.zeabur.app`.
After deployment, you will receive a URL, for example: `https://my-signaling-server.zeabur.app`.
### Enable WebRTC Sync in the Deployment Instance
### Enable WebRTC Sync in the Deployment Instance
The WebRTC sync feature in LobeChat is hidden by default and needs to be enabled by adding the environment variable `FEATURE_FLAGS=+webrtc_sync`.
The WebRTC sync feature in LobeChat is hidden by default and needs to be enabled by adding the environment variable `FEATURE_FLAGS=+webrtc_sync`.
### Configure WebRTC Sync Settings in LobeChat
### Configure WebRTC Sync Settings in LobeChat
1. Open LobeChat settings -> Data Sync
2. Enter the signaling server address in the WebRTC sync section;
3. Set the sync channel name and password
1. Open LobeChat settings -> Data Sync
2. Enter the signaling server address in the WebRTC sync section;
3. Set the sync channel name and password
<Image alt={'LobeChat Data Sync Settings Page'} height={356} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/bf86bf1e-87fb-4015-8587-15ff28bb9c24'} />
<Image
alt={'LobeChat Data Sync Settings Page'}
height={356}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/bf86bf1e-87fb-4015-8587-15ff28bb9c24'}
/>
### Repeat the Above Configuration on Devices that Need to Sync
Ensure all devices use the same signaling server, channel name, and password. Once configured, the devices should automatically start syncing data.
### Repeat the Above Configuration on Devices that Need to Sync
Ensure all devices use the same signaling server, channel name, and password. Once configured, the devices should automatically start syncing data.
</Steps>
## Limitations and Known Issues
+19 -26
View File
@@ -10,45 +10,38 @@ tags:
## WebRTC 简介
WebRTC (Web Real-Time Communication) 是一项实现浏览器之间点对点通信的技术。在 LobeChat 中,我们实验性地基于 WebRTC 和 YJS 实现了设备间的实时数据同步,无需依赖传统的服务器数据库。这种方案具有高度隐私性、零冲突性,并能提供实时会话同步体验。
WebRTC (Web Real-Time Communication) 是一项实现浏览器之间点对点通信的技术。在 LobeChat 中,我们实验性地基于 WebRTC 和 YJS 实现了设备间的实时数据同步,无需依赖传统的服务器数据库。这种方案具有高度隐私性、零冲突性,并能提供实时会话同步体验。
## 配置 WebRTC 并实现同步
要使用 LobeChat 的 WebRTC 同步功能,需要完成以下步骤:
要使用 LobeChat 的 WebRTC 同步功能,需要完成以下步骤:
<Steps>
### 部署信令服务器
### 部署信令服务器
使用 Zeabur 平台一键部署 WebRTC 信令服务器:
使用 Zeabur 平台一键部署 WebRTC 信令服务器:
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/MY0JZG?referralCode=arvinxx)
[![Deploy on Zeabur](https://zeabur.com/button.svg)](https://zeabur.com/templates/MY0JZG?referralCode=arvinxx)
或者查看 [源码](https://github.com/lobehub/y-webrtc-signaling) 自行部署。
或者查看 [源码](https://github.com/lobehub/y-webrtc-signaling) 自行部署。
部署完成后,可以得到一个 URL,例如:`https://my-signaling-server.zeabur.app`。
部署完成后,可以得到一个 URL,例如:`https://my-signaling-server.zeabur.app`。
### 在部署实例中开启 WebRTC 同步
### 在部署实例中开启 WebRTC 同步
LobeChat 默认隐藏了 WebRTC 同步功能,需要通过添加环境变量 `FEATURE_FLAGS=+webrtc_sync` 来开启 WebRTC 同步特性。
LobeChat 默认隐藏了 WebRTC 同步功能,需要通过添加环境变量 `FEATURE_FLAGS=+webrtc_sync` 来开启 WebRTC 同步特性。
### 配置 LobeChat 的 WebRTC 同步设置
### 配置 LobeChat 的 WebRTC 同步设置
1. 打开 LobeChat 设置 -> 数据同步
2. 在 WebRTC 同步中填写信令服务器地址;
3. 设置同步频道名称和密码
1. 打开 LobeChat 设置 -> 数据同步
2. 在 WebRTC 同步中填写信令服务器地址;
3. 设置同步频道名称和密码
<Image alt={'LobeChat 数据同步设置页'} height={356} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/bf86bf1e-87fb-4015-8587-15ff28bb9c24'} />
<Image
alt={'LobeChat 数据同步设置页'}
height={356}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/bf86bf1e-87fb-4015-8587-15ff28bb9c24'}
/>
### 在需要同步的设备上重复以上配置
确保所有设备使用相同的信令服务器、频道名称和密码,完成配置后,设备间应该可以开始自动同步数据。
### 在需要同步的设备上重复以上配置
确保所有设备使用相同的信令服务器、频道名称和密码,完成配置后,设备间应该可以开始自动同步数据。
</Steps>
## 使用局限性和已知问题
@@ -67,17 +60,17 @@ WebRTC 要求设备同时在线才能进行同步,这意味着无法在一台
由于 WebRTC 的实现机制,其点对点通信对于网络要求非常苛刻,我们的很多用户反馈:
- 在 PC 上可以互相同步、 手机 sim 卡无法和 PC 同步、但是换成和PC一样的WIFI可以和 PC 同步;
- 在 PC 上可以互相同步、 手机 sim 卡无法和 PC 同步、但是换成和 PC 一样的 WIFI 可以和 PC 同步;
- 任何切换网络都无法同步;
### 稳定性与性能问题
- 部分用户报告在 Firefox 浏览器上遇到 ICE 连接失败的问题:[WebRTC Data Sync Feedback](https://github.com/lobehub/lobe-chat/issues/1683#issuecomment-2094745907)
- 对于超长文本或大量对话记录,同步过程可能变慢或不稳定:[当模型输出超长对话时,对话末尾会出现同步相关的内容标签,导致同步失败](https://github.com/lobehub/lobe-chat/issues/1962)
- 对于超长文本或大量对话记录,同步过程可能变慢或不稳定:[当模型输出超长对话时,对话末尾会出现同步相关的内容标签,导致同步失败](https://github.com/lobehub/lobe-chat/issues/1962)
## 我们的建议
鉴于以上原因,我们建议用户将 WebRTC 同步功能视为实验性功能,并定期备份重要数据。
鉴于以上原因,我们建议用户将 WebRTC 同步功能视为实验性功能,并定期备份重要数据。
目前我们已经发布了更稳定、更用户友好的服务端数据库同步方案([部署指南](/zh/docs/self-hosting/advanced/server-database)),我们建议用户优先考虑使用服务端数据库同步方案。
+8 -4
View File
@@ -16,15 +16,19 @@ LobeChat provides some additional configuration options when deployed, which can
<Cards>
<Card href={'environment-variables/basic'} title={'Basic Environment Variables'} />
<Card href={'environment-variables/model-provider'} title={'Model Service Providers'} />
<Cards href={'environment-variables/auth'} title={'Authentication'} />
<Cards href={'environment-variables/s3'} title={'S3 Storage Service'} />
<Cards href={'environment-variables/analytics'} title={'Data Analytics'} />
</Cards>
## Building a Custom Image with Overridden NEXT_PUBLIC Variables
## Building a Custom Image with Overridden `NEXT_PUBLIC` Variables
If you need to override NEXT_PUBLIC environment variables, you can build a custom Docker image using GitHub Actions without forking the entire LobeChat repository. Here's a guide on how to do this:
If you need to override `NEXT_PUBLIC` environment variables, you can build a custom Docker image using GitHub Actions without forking the entire LobeChat repository. Here's a guide on how to do this:
1. Create a new GitHub repository for your custom build.
@@ -82,10 +86,10 @@ jobs:
NEXT_PUBLIC_SERVICE_MODE=${{ secrets.NEXT_PUBLIC_SERVICE_MODE }}
```
4. In your GitHub Repository settings > Secrets and variables > Actions > Repository secrets, add any NEXT_PUBLIC variables you want to override
4. In your GitHub Repository settings > Secrets and variables > Actions > Repository secrets, add any `NEXT_PUBLIC` variables you want to override
5. Set "Read and write" permissions for workflows in Repository settings > Actions > General > Workflow permissions.
6. To build your custom image, go to the "Actions" tab in your GitHub repository and manually trigger the "Build Custom LobeChat Image" workflow.
This approach allows you to create a custom build with your desired NEXT_PUBLIC variables without maintaining a full fork of the LobeChat repository. You can trigger a new build whenever you need to update your custom image.
This approach allows you to create a custom build with your desired `NEXT_PUBLIC` variables without maintaining a full fork of the LobeChat repository. You can trigger a new build whenever you need to update your custom image.
@@ -14,8 +14,12 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
<Cards>
<Cards href={'environment-variables/basic'} title={'基础环境变量'} />
<Cards href={'environment-variables/model-provider'} title={'模型服务商'} />
<Cards href={'environment-variables/auth'} title={'身份验证'} />
<Cards href={'environment-variables/s3'} title={'S3 存储服务'} />
<Cards href={'environment-variables/analytics'} title={'数据统计'} />
</Cards>
@@ -77,6 +77,3 @@ tags:
- 描述:Umami 脚本的网址,默认为 Umami Cloud 提供的脚本网址
- 默认值:`https://analytics.umami.is/script.js`
- 示例:`https://umami.your-site.com/script.js`
[posthog-analytics-url]: https://posthog.com
[umami-analytics-url]: https://umami.is
@@ -47,7 +47,7 @@ LobeChat 在部署时提供了完善的身份验证服务能力,以下是相
- 默认值: `-`
- 示例: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
#### \`AUTH_AUTH_SECRET
#### `AUTH_AUTH_SECRET`
- 类型:必选
- 描述: Auth0 应用程序的 Client Secret
@@ -54,22 +54,22 @@ When using the `turn` mode, the API Keys will be retrieved in a polling manner a
The `DEFAULT_AGENT_CONFIG` is used to configure the default settings for the LobeChat default agent. It supports various data types and structures, including key-value pairs, nested fields, array values, and more. The table below provides detailed information on the configuration options, examples, and corresponding explanations for the `DEFAULT_AGENT_CONFIG` environment variable:
| Configuration Type | Example | Explanation |
| --- | --- | --- |
| Basic Key-Value Pair | `model=gpt-4` | Set the model to `gpt-4`. |
| Nested Field | `tts.sttLocale=en-US` | Set the language locale for the text-to-speech service to `en-US`. |
| Array | `plugins=search-engine,lobe-image-designer` | Enable the `search-engine` and `lobe-image-designer` plugins. |
| Chinese Comma | `plugins=search-engine,lobe-image-designer` | Same as above, demonstrating support for Chinese comma separation. |
| Multiple Configurations | `model=glm-4;provider=zhipu` | Set the model to `glm-4` and the model provider to `zhipu`. |
| Numeric Value | `params.max_tokens=300`, `chatConfig.historyCount=5` | Set the maximum tokens to `300`, Set the number of historical messages to 5. |
| Boolean Value | `chatConfig.enableAutoCreateTopic=true`, `chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | Enable automatic topic creation, History length compression threshold, number of historical records. |
| Special Characters | `inputTemplate="Hello; I am a bot;"` | Set the input template to `Hello; I am a bot;`. |
| Error Handling | `model=gpt-4;maxToken` | Ignore invalid entry `maxToken` and only parse `model=gpt-4`. |
| Value Override | `model=gpt-4;model=gpt-4-1106-preview` | If a key is repeated, use the value that appears last; in this case, the value of `model` is `gpt-4-1106-preview`. |
| Configuration Type | Example | Explanation |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| Basic Key-Value Pair | `model=gpt-4` | Set the model to `gpt-4`. |
| Nested Field | `tts.sttLocale=en-US` | Set the language locale for the text-to-speech service to `en-US`. |
| Array | `plugins=search-engine,lobe-image-designer` | Enable the `search-engine` and `lobe-image-designer` plugins. |
| Chinese Comma | `plugins=search-engine,lobe-image-designer` | Same as above, demonstrating support for Chinese comma separation. |
| Multiple Configurations | `model=glm-4;provider=zhipu` | Set the model to `glm-4` and the model provider to `zhipu`. |
| Numeric Value | `params.max_tokens=300`, `chatConfig.historyCount=5` | Set the maximum tokens to `300`, Set the number of historical messages to 5. |
| Boolean Value | `chatConfig.enableAutoCreateTopic=true`, `chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | Enable automatic topic creation, History length compression threshold, number of historical records. |
| Special Characters | `inputTemplate="Hello; I am a bot;"` | Set the input template to `Hello; I am a bot;`. |
| Error Handling | `model=gpt-4;maxToken` | Ignore invalid entry `maxToken` and only parse `model=gpt-4`. |
| Value Override | `model=gpt-4;model=gpt-4-1106-preview` | If a key is repeated, use the value that appears last; in this case, the value of `model` is `gpt-4-1106-preview`. |
Further reading:
- [[RFC] 022 - Default Assistant Parameters Configuration via Environment Variables](https://github.com/lobehub/lobe-chat/discussions/913)
- [\[RFC\] 022 - Default Assistant Parameters Configuration via Environment Variables](https://github.com/lobehub/lobe-chat/discussions/913)
### `FEATURE_FLAGS`
@@ -50,22 +50,22 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
`DEFAULT_AGENT_CONFIG` 用于配置 LobeChat 默认助理的默认配置。它支持多种数据类型和结构,包括键值对、嵌套字段、数组值等。下表详细说明了 `DEFAULT_AGENT_CONFIG` 环境变量的配置项、示例以及相应解释:
| 配置项类型 | 示例 | 解释 |
| --- | --- | --- |
| 基本键值对 | `model=gpt-4` | 设置模型为 `gpt-4`。 |
| 嵌套字段 | `tts.sttLocale=en-US` | 设置文本到语音服务的语言区域为 `en-US`。 |
| 数组 | `plugins=search-engine,lobe-image-designer` | 启用 `search-engine` 和 `lobe-image-designer` 插件。 |
| 中文逗号 | `plugins=search-engine,lobe-image-designer` | 同上,演示支持中文逗号分隔。 |
| 多个配置项 | `model=glm-4;provider=zhipu` | 设置模型为 `glm-4` 且模型服务商为 `zhipu`。 |
| 数字值 | `params.max_tokens=300`, `chatConfig.historyCount=5` | 设置最大令牌数为 `300`,设置历史消息条数为5。 |
| 布尔值 | `chatConfig.enableAutoCreateTopic=true`,`chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | 启用自动创建主题,历史长度压缩阈值,历史记录条数。 |
| 特殊字符 | `inputTemplate="Hello; I am a bot;"` | 设置输入模板为 `Hello; I am a bot;`。 |
| 错误处理 | `model=gpt-4;maxToken` | 忽略无效条目 `maxToken`,仅解析出 `model=gpt-4`。 |
| 值覆盖 | `model=gpt-4;model=gpt-4-1106-preview` | 如果键重复,使用最后一次出现的值,此处 `model` 的值为 `gpt-4-1106-preview`。 |
| 配置项类型 | 示例 | 解释 |
| ----- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| 基本键值对 | `model=gpt-4` | 设置模型为 `gpt-4`。 |
| 嵌套字段 | `tts.sttLocale=en-US` | 设置文本到语音服务的语言区域为 `en-US`。 |
| 数组 | `plugins=search-engine,lobe-image-designer` | 启用 `search-engine` 和 `lobe-image-designer` 插件。 |
| 中文逗号 | `plugins=search-engine,lobe-image-designer` | 同上,演示支持中文逗号分隔。 |
| 多个配置项 | `model=glm-4;provider=zhipu` | 设置模型为 `glm-4` 且模型服务商为 `zhipu`。 |
| 数字值 | `params.max_tokens=300`, `chatConfig.historyCount=5` | 设置最大令牌数为 `300`,设置历史消息条数为 5。 |
| 布尔值 | `chatConfig.enableAutoCreateTopic=true`,`chatConfig.enableCompressThreshold=true`, `chatConfig.enableHistoryCount=true` | 启用自动创建主题,历史长度压缩阈值,历史记录条数。 |
| 特殊字符 | `inputTemplate="Hello; I am a bot;"` | 设置输入模板为 `Hello; I am a bot;`。 |
| 错误处理 | `model=gpt-4;maxToken` | 忽略无效条目 `maxToken`,仅解析出 `model=gpt-4`。 |
| 值覆盖 | `model=gpt-4;model=gpt-4-1106-preview` | 如果键重复,使用最后一次出现的值,此处 `model` 的值为 `gpt-4-1106-preview`。 |
相关阅读:
- [[RFC] 022 - 环境变量配置默认助手参数](https://github.com/lobehub/lobe-chat/discussions/913)
- [\[RFC\] 022 - 环境变量配置默认助手参数](https://github.com/lobehub/lobe-chat/discussions/913)
### `FEATURE_FLAGS`
@@ -91,14 +91,14 @@ LobeChat 在部署时提供了一些额外的配置项,你可以使用环境
### `SSRF_ALLOW_PRIVATE_IP_ADDRESS`
- 类型:可选
- 描述:是否允许连接私有IP地址。在可信环境中可以设置为true来关闭SSRF防护。
- 描述:是否允许连接私有 IP 地址。在可信环境中可以设置为 true 来关闭 SSRF 防护。
- 默认值:`0`
- 示例:`1` or `0`
### `SSRF_ALLOW_IP_ADDRESS_LIST`
- 类型:可选
- 描述:允许连接的私有IP地址列表,多个IP地址时使用逗号分隔。当 `SSRF_ALLOW_PRIVATE_IP_ADDRESS` 为 `0` 时才会生效。
- 描述:允许连接的私有 IP 地址列表,多个 IP 地址时使用逗号分隔。当 `SSRF_ALLOW_PRIVATE_IP_ADDRESS` 为 `0` 时才会生效。
- 默认值:-
- 示例:`198.18.1.62,224.0.0.3`
@@ -482,7 +482,7 @@ If you need to use Azure OpenAI to provide model services, you can refer to the
### `AI21_API_KEY`
- Type: Required
- Description: This is the API key you applied from AI21_API_KEY service
- Description: This is the API key you applied from `AI21_API_KEY` service
- Default: -
- Example: `xxxxxx...xxxxxx`
@@ -430,7 +430,7 @@ LobeChat 在部署时提供了丰富的模型服务商相关的环境变量,
### `AI360_API_KEY`
- 类型:必选
- 描述:这是你在 360智脑 服务平台申请的 API 密钥
- 描述:这是你在 360 智脑 服务平台申请的 API 密钥
- 默认值:-
- 示例:`xxxxxx...xxxxxx`
@@ -75,11 +75,10 @@ LobeChat supports multimodal AI sessions, including the ability to upload unstru
<Callout type={'info'}>
`path-style` and `virtual-host` are different methods of accessing buckets and objects in S3, with differences in URL structure and domain name resolution.
Assuming the S3 service provider's domain is s3.example.net, the bucket is mybucket, and the object is config.env, the specific differences are:
- path-style: `s3.example.net/mybucket/config.env`
- virtual-host: `mybucket.s3.example.net/config.env`
Assuming the S3 service provider's domain is s3.example.net, the bucket is mybucket, and the object is config.env, the specific differences are:
- path-style: `s3.example.net/mybucket/config.env`
- virtual-host: `mybucket.s3.example.net/config.env`
</Callout>
### `LLM_VISION_IMAGE_USE_BASE64`
@@ -10,7 +10,7 @@ tags:
# 配置 S3 存储服务
LobeChat 支持多模态的 AI 会话,包括将图片、文件等非结构化数据上传给大模型的功能。为了优化存储和性能,我们使用 S3 兼容的文件存储服务来存储图片文件和支持文件上传/知识库功能。
LobeChat 支持多模态的 AI 会话,包括将图片、文件等非结构化数据上传给大模型的功能。为了优化存储和性能,我们使用 S3 兼容的文件存储服务来存储图片文件和支持文件上传 / 知识库功能。
## 核心环境变量
@@ -71,14 +71,12 @@ LobeChat 支持多模态的 AI 会话,包括将图片、文件等非结构化
- 示例:`1`
<Callout type={'info'}>
`path-style` 和 `virtual-host` 在 S3 中是访问 bucket 和 object 的不同方式,URL 的结构和域名解析不太一样
`path-style` 和 `virtual-host` 在 S3 中是访问 bucket 和 object 的不同方式,URL 的结构和域名解析不太一样
假设 S3 服务商的域名是 s3.example.net ,bucket为mybucket,object为config.env,具体区别如下:
- path-style : `s3.example.net/mybucket/config.env`
- virtual-host : `mybucket.s3.example.net/config.env`
假设 S3 服务商的域名是 s3.example.net ,bucket 为 mybucket,object 为 config.env,具体区别如下:
- path-style : `s3.example.net/mybucket/config.env`
- virtual-host : `mybucket.s3.example.net/config.env`
</Callout>
### `LLM_VISION_IMAGE_USE_BASE64`
+9 -12
View File
@@ -19,17 +19,14 @@ LobeChat supports using [Azure OpenAI](https://learn.microsoft.com/zh-cn/azure/a
Click in the bottom left corner "Actions" - "Settings", then switch to the "Language Model" tab and enable the "Azure OpenAI" switch to start using Azure OpenAI.
<Image
alt="Configuring in the Interface"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/267083420-422a3714-627e-4bef-9fbc-141a2a8ca916.png"
/>
<Image alt="Configuring in the Interface" src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/267083420-422a3714-627e-4bef-9fbc-141a2a8ca916.png" />
You can fill in the corresponding configuration items as needed:
- **API Key**: The API key you applied for on the Azure OpenAI account page, which can be found in the "Keys and Endpoints" section.
- **API Address**: Azure API address, which can be found in the "Keys and Endpoints" section when checking resources in the Azure portal.
- **Azure API Version**: The API version of Azure, following the format YYYY-MM-DD. Refer to the [latest version](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions).
- ** Model List**: set your model list
- \*\* Model List\*\*: set your model list
After completing the configuration of the above fields, click "Check". If it prompts "Check passed", it means the configuration was successful.
@@ -37,10 +34,10 @@ After completing the configuration of the above fields, click "Check". If it pro
If you want the deployed version to be pre-configured with Azure OpenAI for end users to use directly, you need to configure the following environment variables during deployment:
| Environment Variable | Type | Description | Default Value | Example |
| --- | --- | --- | --- | --- |
| `AZURE_API_KEY` | Required | This is the API key you obtained from the Azure OpenAI account page | - | `c55168be3874490ef0565d9779ecd5a6` |
| `AZURE_ENDPOINT` | Required | Azure API address, can be found in the "Keys and Endpoints" section when checking resources in the Azure portal | - | `https://docs-test-001.openai.azure.com` |
| `AZURE_API_VERSION` | Required | Azure API version, following the format YYYY-MM-DD | 2023-08-01-preview | `-`, see [latest version](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions) |
| `AZURE_MODEL_LIST` | Required | Used to control the model list, use `+` to add a model, use `-` to hide a model, use `id->deplymentName=displayName` to customize the display name of a model, separated by commas. Definition syntax rules see [Model List](/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` or `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
| `ACCESS_CODE` | Optional | Add a password to access LobeChat. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | - | `awCT74` or `e3@09!` or `code1,code2,code3` |
| Environment Variable | Type | Description | Default Value | Example |
| -------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `AZURE_API_KEY` | Required | This is the API key you obtained from the Azure OpenAI account page | - | `c55168be3874490ef0565d9779ecd5a6` |
| `AZURE_ENDPOINT` | Required | Azure API address, can be found in the "Keys and Endpoints" section when checking resources in the Azure portal | - | `https://docs-test-001.openai.azure.com` |
| `AZURE_API_VERSION` | Required | Azure API version, following the format YYYY-MM-DD | 2023-08-01-preview | `-`, see [latest version](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions) |
| `AZURE_MODEL_LIST` | Required | Used to control the model list, use `+` to add a model, use `-` to hide a model, use `id->deplymentName=displayName` to customize the display name of a model, separated by commas. Definition syntax rules see [Model List](/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` or `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
| `ACCESS_CODE` | Optional | Add a password to access LobeChat. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | - | `awCT74` or `e3@09!` or `code1,code2,code3` |
@@ -19,10 +19,7 @@ LobeChat 支持使用 [Azure OpenAI](https://learn.microsoft.com/zh-cn/azure/ai-
点击左下角「操作」 -「设置」,切到 「语言模型」 Tab 后通过开启「Azure OpenAI」开关,即可开启使用 Azure OpenAI。
<Image
alt="在界面中配置"
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/267083420-422a3714-627e-4bef-9fbc-141a2a8ca916.png"
/>
<Image alt="在界面中配置" src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/267083420-422a3714-627e-4bef-9fbc-141a2a8ca916.png" />
你按需填写相应的配置项:
@@ -39,10 +36,10 @@ LobeChat 支持使用 [Azure OpenAI](https://learn.microsoft.com/zh-cn/azure/ai-
如果你希望部署的版本直接配置好 Azure OpenAI,让终端用户直接使用,那么你需要在部署时配置以下环境变量:
| 环境变量 | 类型 | 描述 | 默认值 | 示例 |
| --- | --- | --- | --- | --- |
| `AZURE_API_KEY` | 必选 | 这是你在 Azure OpenAI 账户页面申请的 API 密钥 | - | `c55168be3874490ef0565d9779ecd5a6` |
| `AZURE_ENDPOINT` | 必选 | Azure API 地址,从 Azure 门户检查资源时,可在 “密钥和终结点” 部分中找到此值 | - | `https://docs-test-001.openai.azure.com` |
| `AZURE_API_VERSION` | 必选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式 | 2023-08-01-preview | `-`,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions) |
| `AZURE_MODEL_LIST` | 必选 | 用来控制模型列表,使用 `模型名->部署名=展示名` 来自定义模型的展示名,用英文逗号隔开。支持扩展能力,其余语法规则详见 [模型列表](/zh/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` 或 `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
| `ACCESS_CODE` | 可选 | 添加访问 LobeChat 的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | - | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
| 环境变量 | 类型 | 描述 | 默认值 | 示例 |
| ------------------- | -- | --------------------------------------------------------------------------------------------------------------- | ------------------ | --------------------------------------------------------------------------------------------------- |
| `AZURE_API_KEY` | 必选 | 这是你在 Azure OpenAI 账户页面申请的 API 密钥 | - | `c55168be3874490ef0565d9779ecd5a6` |
| `AZURE_ENDPOINT` | 必选 | Azure API 地址,从 Azure 门户检查资源时,可在 “密钥和终结点” 部分中找到此值 | - | `https://docs-test-001.openai.azure.com` |
| `AZURE_API_VERSION` | 必选 | Azure 的 API 版本,遵循 YYYY-MM-DD 格式 | 2023-08-01-preview | `-`,查阅[最新版本](https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference#chat-completions) |
| `AZURE_MODEL_LIST` | 必选 | 用来控制模型列表,使用 `模型名->部署名=展示名` 来自定义模型的展示名,用英文逗号隔开。支持扩展能力,其余语法规则详见 [模型列表](/zh/docs/self-hosting/advanced/model-list) | - | `gpt-35-turbo->my-deploy=GPT 3.5 Turbo` 或 `gpt-4-turbo->my-gpt4=GPT 4 Turbo<128000:vision:fc>` |
| `ACCESS_CODE` | 可选 | 添加访问 LobeChat 的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | - | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
+8 -7
View File
@@ -40,13 +40,13 @@ When you first initiate Ollama, it is configured to allow access only from the l
### Ollama Environment Variables
| Environment Variable | Description | Default Value | Additional Information |
| --- | --- | --- | --- |
| `OLLAMA_HOST` | Specifies the host and port for binding | "127.0.0.1:11434" | Use "0.0.0.0:port" to make the service accessible from any machine |
| `OLLAMA_ORIGINS` | Comma-separated list of permitted cross-origin sources | Restricted to local access | Set to "\*" to avoid CORS, please set on demand |
| `OLLAMA_MODELS` | Path to the directory where models are located | "~/.ollama/models" or "/usr/share/ollama/.ollama/models" | Can be customized based on requirements |
| `OLLAMA_KEEP_ALIVE` | Duration that the model stays loaded in GPU memory | "5m" | Dynamically loading and unloading models can reduce GPU load but may increase disk I/O |
| `OLLAMA_DEBUG` | Enable additional debugging logs by setting to 1 | Typically disabled | |
| Environment Variable | Description | Default Value | Additional Information |
| -------------------- | ------------------------------------------------------ | --------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `OLLAMA_HOST` | Specifies the host and port for binding | "127.0.0.1:11434" | Use "0.0.0.0:port" to make the service accessible from any machine |
| `OLLAMA_ORIGINS` | Comma-separated list of permitted cross-origin sources | Restricted to local access | Set to "\*" to avoid CORS, please set on demand |
| `OLLAMA_MODELS` | Path to the directory where models are located | "\~/.ollama/models" or "/usr/share/ollama/.ollama/models" | Can be customized based on requirements |
| `OLLAMA_KEEP_ALIVE` | Duration that the model stays loaded in GPU memory | "5m" | Dynamically loading and unloading models can reduce GPU load but may increase disk I/O |
| `OLLAMA_DEBUG` | Enable additional debugging logs by setting to 1 | Typically disabled | |
### Setting environment variables on Windows
@@ -90,6 +90,7 @@ If Ollama is run as a systemd service, environment variables should be set using
```
3. Save and exit.
4. Reload `systemd` and restart Ollama:
```bash
+8 -7
View File
@@ -38,13 +38,13 @@ docker run -d -p 3210:3210 -e OLLAMA_PROXY_URL=http://host.docker.internal:11434
### Ollama 环境变量
| 环境变量 | 描述 | 默认值 | 附加说明 |
| --- | --- | --- | --- |
| `OLLAMA_HOST` | 绑定的主机和端口 | "127.0.0.1:11434" | 设置 0.0.0.0:端口号 可以指定所有人访问特定端口 |
| `OLLAMA_ORIGINS` | 允许的跨域源列表,逗号分隔 | 仅本地访问 | 设置 "\*" 可以避免 CORS 跨域错误,按需设置 |
| `OLLAMA_MODELS` | 模型存放的路径 | "~/.ollama/models" 或 "/usr/share/ollama/.ollama/models" | 按需指定 |
| `OLLAMA_KEEP_ALIVE` | 模型在显存中保持加载的持续时间 | "5m" | 按需加载和释放显存可以有效降低显卡压力,但会增加硬盘读写 |
| `OLLAMA_DEBUG` | 设置为 1 以启用额外的调试日志 | 默认关闭 | |
| 环境变量 | 描述 | 默认值 | 附加说明 |
| ------------------- | ---------------- | -------------------------------------------------------- | ----------------------------- |
| `OLLAMA_HOST` | 绑定的主机和端口 | "127.0.0.1:11434" | 设置 0.0.0.0: 端口号 可以指定所有人访问特定端口 |
| `OLLAMA_ORIGINS` | 允许的跨域源列表,逗号分隔 | 仅本地访问 | 设置 "\*" 可以避免 CORS 跨域错误,按需设置 |
| `OLLAMA_MODELS` | 模型存放的路径 | "\~/.ollama/models" 或 "/usr/share/ollama/.ollama/models" | 按需指定 |
| `OLLAMA_KEEP_ALIVE` | 模型在显存中保持加载的持续时间 | "5m" | 按需加载和释放显存可以有效降低显卡压力,但会增加硬盘读写 |
| `OLLAMA_DEBUG` | 设置为 1 以启用额外的调试日志 | 默认关闭 | |
### 在 Windows 上设置环境变量
@@ -88,6 +88,7 @@ docker run -d -p 3210:3210 -e OLLAMA_PROXY_URL=http://host.docker.internal:11434
```
3. 保存并退出。
4. 重载`systemd`并重启 Ollama:
```bash
+5 -7
View File
@@ -18,17 +18,15 @@ If you want to deploy LobeChat on Alibaba Cloud, you can follow the steps below:
## Alibaba Cloud Deployment Process
<Steps>
### Prepare your API Key
### Prepare your API Key
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key. Or go to [Tongyi Qianwen API Key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) to get your API Key.
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key. Or go to [Tongyi Qianwen API Key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) to get your API Key.
### One-click to deploy
### One-click to deploy
[![][deploy-button-image]][deploy-link]
### Once deployed, you can start using it
[![][deploy-button-image]][deploy-link]
### Once deployed, you can start using it
</Steps>
[deploy-button-image]: https://service-info-public.oss-cn-hangzhou.aliyuncs.com/computenest-en.svg
@@ -15,17 +15,15 @@ tags:
## 阿里云 部署流程
<Steps>
### 准备好你的 API Key
### 准备好你的 API Key
前往 [OpenAI API Key](https://platform.openai.com/account/api-keys) 获取你的 OpenAI API Key 或 前往 [通义千问 API Key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) 获取你的通义千问 API Key
前往 [OpenAI API Key](https://platform.openai.com/account/api-keys) 获取你的 OpenAI API Key 或 前往 [通义千问 API Key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) 获取你的通义千问 API Key
### 点击下方按钮进行部署
### 点击下方按钮进行部署
[![][deploy-button-image]][deploy-link]
### 部署完毕后,即可开始使用
[![][deploy-button-image]][deploy-link]
### 部署完毕后,即可开始使用
</Steps>
[deploy-button-image]: https://service-info-public.oss-cn-hangzhou.aliyuncs.com/computenest-en.svg
+3 -2
View File
@@ -21,10 +21,11 @@ To install aaPanel, go to the [aaPanel](https://www.aapanel.com/new/download.htm
2. The first time you will be prompted to install the `Docker` and `Docker Compose` services, click Install Now. If it is already installed, please ignore it. ![install2](https://github.com/user-attachments/assets/e269bd27-d323-43ba-811b-c0f5e4137903)
3. After the installation is complete, find `LobeChat` in `One-Click Install` and click `install`
3. After the installation is complete, find `LobeChat` in `One-Click Install` and click `install`\
![install-LobeChat](https://github.com/user-attachments/assets/9f989104-bb8e-4acd-9721-6b1db1017d2b)
4. configure basic information such as the domain name, OpenAI API key, and port to complete the installation Note: The domain name is optional, if the domain name is filled, it can be managed through [Website]--> [Proxy Project], and you do not need to check [Allow external access] after filling in the domain name, otherwise you need to check it before you can access it through the port ![addLobeChat](https://github.com/user-attachments/assets/f0b2e72d-9eee-46a8-b094-4834b78764df)
4. configure basic information such as the domain name, OpenAI API key, and port to complete the installation Note: The domain name is optional, if the domain name is filled, it can be managed through \[Website]--> \[Proxy Project], and you do not need to check \[Allow external access] after filling in the domain name, otherwise you need to check it before you can access it through the port ![addLobeChat](https://github.com/user-attachments/assets/f0b2e72d-9eee-46a8-b094-4834b78764df)
5. After installation, enter the domain name or IP+ port set in the previous step in the browser to access.
- Name: application name, default `LobeChat-random characters`
+3 -3
View File
@@ -13,7 +13,7 @@ tags:
## 前提
- 仅适用于宝塔面板9.2.0及以上版本
- 仅适用于宝塔面板 9.2.0 及以上版本
- 安装宝塔面板,前往[宝塔面板](https://www.bt.cn/new/download.html)官网,选择正式版的脚本下载安装
## 部署
@@ -35,8 +35,8 @@ tags:
- OpenAI API 密钥:请输入您的 Open API 密钥
- OpenAI 代理 URL:默认为官方地址
- OpenAI 模型列表:输入使用的模型
- CPU 核心数限制:0为不限制,根据实际需要设置
- 内存限制:0为不限制,根据实际需要设置
- CPU 核心数限制:0 为不限制,根据实际需要设置
- 内存限制:0 为不限制,根据实际需要设置
5. 提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问。
+75 -85
View File
@@ -15,124 +15,114 @@ tags:
# Docker Compose Deployment Guide
<div style={{display:"flex", gap: 4}}>
[![][docker-release-shield]][docker-release-link]
[![][docker-release-shield]][docker-release-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
</div>
We provide a [Docker image][docker-release-link] for deploying the LobeChat service on your private device.
<Steps>
### Install Docker Container Environment
### Install Docker Container Environment
(Skip this step if already installed)
(Skip this step if already installed)
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ apt install docker.io
```
</Tab>
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ yum install docker
```
</Tab>
</Tabs>
<Tab>
### Run Docker Compose Deployment Command
```fish
$ apt install docker.io
```
When using `docker-compose`, the configuration file is as follows:
</Tab>
```yml
version: '3.8'
<Tab>
services:
lobe-chat:
image: lobehub/lobe-chat
container_name: lobe-chat
restart: always
ports:
- '3210:3210'
environment:
OPENAI_API_KEY: sk-xxxx
OPENAI_PROXY_URL: https://api-proxy.com/v1
ACCESS_CODE: lobe66
```
```fish
$ yum install docker
```
Run the following command to start the Lobe Chat service:
</Tab>
```bash
$ docker-compose up -d
```
</Tabs>
### Crontab Automatic Update Script (Optional)
### Run Docker Compose Deployment Command
Similarly, you can use the following script to automatically update Lobe Chat. When using `Docker Compose`, no additional configuration of environment variables is required.
When using `docker-compose`, the configuration file is as follows:
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
```yml
version: '3.8'
# Set proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
services:
lobe-chat:
image: lobehub/lobe-chat
container_name: lobe-chat
restart: always
ports:
- '3210:3210'
environment:
OPENAI_API_KEY: sk-xxxx
OPENAI_PROXY_URL: https://api-proxy.com/v1
ACCESS_CODE: lobe66
```
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
Run the following command to start the Lobe Chat service:
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
```bash
$ docker-compose up -d
```
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
### Crontab Automatic Update Script (Optional)
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
Similarly, you can use the following script to automatically update Lobe Chat. When using `Docker Compose`, no additional configuration of environment variables is required.
echo "Detected Lobe-Chat update"
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
# Set proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# You may need to navigate to the directory where `docker-compose.yml` is located first
# cd /path/to/docker-compose-folder
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Run the new container
echo "Started: $(docker-compose up)"
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
echo "Detected Lobe-Chat update"
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
# You may need to navigate to the directory where `docker-compose.yml` is located first
# cd /path/to/docker-compose-folder
# Run the new container
echo "Started: $(docker-compose up)"
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
@@ -12,122 +12,112 @@ tags:
# Docker Compose 部署指引
<div style={{display:"flex", gap: 4}}>
[![](https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff\&label=docker\&labelColor=black\&logo=docker\&logoColor=white\&style=flat-square)](https://hub.docker.com/r/lobehub/lobe-chat)
[![](https://img.shields.io/docker/v/lobehub/lobe-chat?color=369eff&label=docker&labelColor=black&logo=docker&logoColor=white&style=flat-square)](https://hub.docker.com/r/lobehub/lobe-chat)
[![](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square)](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff&labelColor=black&style=flat-square)
[![](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square)](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11&labelColor=black&style=flat-square)
[![](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff\&labelColor=black\&style=flat-square)](https://img.shields.io/docker/image-size/lobehub/lobe-chat?color=369eff\&labelColor=black\&style=flat-square)
[![](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11\&labelColor=black\&style=flat-square)](https://img.shields.io/docker/pulls/lobehub/lobe-chat?color=45cc11\&labelColor=black\&style=flat-square)
</div>
我们提供了 [Docker 镜像](https://hub.docker.com/r/lobehub/lobe-chat) ,供你在自己的私有设备上部署 LobeChat 服务。
<Steps>
### 安装 Docker 容器环境
### 安装 Docker 容器环境
(如果已安装,请跳过此步)
(如果已安装,请跳过此步)
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ apt install docker.io
```
</Tab>
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ yum install docker
```
</Tab>
</Tabs>
<Tab>
### 运行 Docker Compose 部署指令
```fish
$ apt install docker.io
```
使用 `docker-compose` 时配置文件如下:
</Tab>
```yml
version: '3.8'
<Tab>
services:
lobe-chat:
image: lobehub/lobe-chat
container_name: lobe-chat
restart: always
ports:
- '3210:3210'
environment:
OPENAI_API_KEY: sk-xxxx
OPENAI_PROXY_URL: https://api-proxy.com/v1
ACCESS_CODE: lobe66
```
```fish
$ yum install docker
```
运行以下命令启动 Lobe Chat 服务:
</Tab>
```bash
$ docker-compose up -d
```
</Tabs>
### Crontab 自动更新脚本(可选)
### 运行 Docker Compose 部署指令
类似地,你可以使用以下脚本来自动更新 Lobe Chat,使用 `Docker Compose` 时,环境变量无需额外配置。
使用 `docker-compose` 时配置文件如下:
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
```yml
version: '3.8'
# Set proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
services:
lobe-chat:
image: lobehub/lobe-chat
container_name: lobe-chat
restart: always
ports:
- '3210:3210'
environment:
OPENAI_API_KEY: sk-xxxx
OPENAI_PROXY_URL: https://api-proxy.com/v1
ACCESS_CODE: lobe66
```
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
运行以下命令启动 Lobe Chat 服务:
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
```bash
$ docker-compose up -d
```
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
### Crontab 自动更新脚本(可选)
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
类似地,你可以使用以下脚本来自动更新 Lobe Chat,使用 `Docker Compose` 时,环境变量无需额外配置。
echo "Detected Lobe-Chat update"
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
# Set proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# You may need to navigate to the directory where `docker-compose.yml` is located first
# cd /path/to/docker-compose-folder
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Run the new container
echo "Started: $(docker-compose up)"
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
echo "Detected Lobe-Chat update"
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
# You may need to navigate to the directory where `docker-compose.yml` is located first
# cd /path/to/docker-compose-folder
# Run the new container
echo "Started: $(docker-compose up)"
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
This script can also be used in Crontab, but ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
+87 -92
View File
@@ -16,10 +16,9 @@ tags:
<div style={{display:"flex", gap: 4}}>
[![][docker-release-shield]][docker-release-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
</div>
We provide a [Docker image][docker-release-link] for you to deploy the LobeChat service on your private device.
@@ -27,138 +26,134 @@ We provide a [Docker image][docker-release-link] for you to deploy the LobeChat
<Steps>
### Install Docker Container Environment
(If already installed, skip this step)
(If already installed, skip this step)
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ apt install docker.io
```
</Tab>
</Tab>
<Tab>
```fish
$ yum install docker
```
</Tab>
</Tabs>
</Tab>
### Docker Command Deployment
</Tabs>
Use the following command to start the LobeChat service with one click:
### Docker Command Deployment
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
Use the following command to start the LobeChat service with one click:
Command explanation:
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
- The default port mapping is `3210`, please ensure it is not occupied or manually change the port mapping.
Command explanation:
- Replace `sk-xxxx` in the above command with your OpenAI API Key.
- The default port mapping is `3210`, please ensure it is not occupied or manually change the port mapping.
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-variables) section.
- Replace `sk-xxxx` in the above command with your OpenAI API Key.
<Callout type="tip">
Since the official Docker image build takes about half an hour, if you see the "update available"
prompt after deployment, you can wait for the image to finish building before deploying again.
</Callout>
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-variables) section.
<Callout type="warning">
The official Docker image does not have a password set. It is strongly recommended to add a
password to enhance security, otherwise you may encounter situations like [My API Key was
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123).
</Callout>
<Callout type="tip">
Since the official Docker image build takes about half an hour, if you see the "update available"
prompt after deployment, you can wait for the image to finish building before deploying again.
</Callout>
<Callout type="important">
Note that when the **deployment architecture is inconsistent with the image**, you need to
cross-compile **Sharp**, see [Sharp
Cross-Compilation](https://sharp.pixelplumbing.com/install#cross-platform) for details.
</Callout>
<Callout type="warning">
The official Docker image does not have a password set. It is strongly recommended to add a
password to enhance security, otherwise you may encounter situations like [My API Key was
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123).
</Callout>
#### Using a Proxy Address
<Callout type="important">
Note that when the **deployment architecture is inconsistent with the image**, you need to
cross-compile **Sharp**, see [Sharp
Cross-Compilation](https://sharp.pixelplumbing.com/install#cross-platform) for details.
</Callout>
If you need to use the OpenAI service through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
#### Using a Proxy Address
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
If you need to use the OpenAI service through a proxy, you can configure the proxy address using the `OPENAI_PROXY_URL` environment variable:
### Crontab Automatic Update Script (Optional)
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
If you want to automatically obtain the latest image, you can follow these steps.
### Crontab Automatic Update Script (Optional)
First, create a `lobe.env` configuration file with various environment variables, for example:
If you want to automatically obtain the latest image, you can follow these steps.
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
First, create a `lobe.env` configuration file with various environment variables, for example:
Then, you can use the following script to automate the update:
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
Then, you can use the following script to automate the update:
# Set up proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Set up proxy (optional)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# Pull the latest image and store the output in a variable
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# Check if the pull command was executed successfully
if [ $? -ne 0 ]; then
exit 1
fi
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
# Check if the output contains a specific string
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
echo "Detected Lobe-Chat update"
# If the image is already up to date, do nothing
if [ $? -eq 0 ]; then
exit 0
fi
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
echo "Detected Lobe-Chat update"
# Run the new container
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
# Remove the old container
echo "Removed: $(docker rm -f Lobe-Chat)"
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# Run the new container
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# Print the update time and version
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
This script can be used in Crontab, but please ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
This script can be used in Crontab, but please ensure that your Crontab can find the correct Docker command. It is recommended to use absolute paths.
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
Configure Crontab to execute the script every 5 minutes:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat
+96 -115
View File
@@ -15,10 +15,9 @@ tags:
<div style={{display:"flex", gap: 4}}>
[![][docker-release-shield]][docker-release-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
[![][docker-size-shield]][docker-size-link]
[![][docker-pulls-shield]][docker-pulls-link]
</div>
我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务。
@@ -28,138 +27,134 @@ tags:
<Steps>
### 安装 Docker 容器环境
(如果已安装,请跳过此步)
(如果已安装,请跳过此步)
<Tabs items={['Ubuntu', 'CentOS']}>
<Tab>
```fish
$ apt install docker.io
```
</Tab>
</Tab>
<Tab>
```fish
$ yum install docker
```
</Tab>
</Tabs>
</Tab>
### Docker 指令部署
</Tabs>
使用以下命令即可使用一键启动 LobeChat 服务:
### Docker 指令部署
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
使用以下命令即可使用一键启动 LobeChat 服务:
指令说明:
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
- 默认映射端口为 `3210`, 请确保未被占用或手动更改端口映射
- 使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx` ,获取 API Key 的方式详见最后一节。
指令说明:
<Callout type={'tip'}>
LobeChat 支持的完整环境变量列表请参考 [📘 环境变量](/zh/docs/self-hosting/environment-variables)
部分
</Callout>
- 默认映射端口为 `3210`, 请确保未被占用或手动更改端口映射
- 使用你的 OpenAI API Key 替换上述命令中的 `sk-xxxx` ,获取 API Key 的方式详见最后一节。
<Callout>
由于官方的 Docker
镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
</Callout>
<Callout type={'tip'}>
LobeChat 支持的完整环境变量列表请参考 [📘 环境变量](/zh/docs/self-hosting/environment-variables)
部分
</Callout>
<Callout type="warning">
官方 Docker 镜像中未设定密码,强烈建议添加密码以提升安全性,否则你可能会遇到 [My API Key was
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123) 这样的情况
</Callout>
<Callout>
由于官方的 Docker
镜像构建大约需要半小时左右,如果在更新部署后会出现「存在更新」的提示,可以等待镜像构建完成后再次部署。
</Callout>
<Callout type="important">
注意,当**部署架构与镜像的不一致时**,需要对 **Sharp** 进行交叉编译,详见 [Sharp
交叉编译](https://sharp.pixelplumbing.com/install#cross-platform)
</Callout>
<Callout type="warning">
官方 Docker 镜像中未设定密码,强烈建议添加密码以提升安全性,否则你可能会遇到 [My API Key was
stolen!!!](https://github.com/lobehub/lobe-chat/issues/1123) 这样的情况
</Callout>
#### 使用代理地址
<Callout type="important">
注意,当**部署架构与镜像的不一致时**,需要对 **Sharp** 进行交叉编译,详见 [Sharp
交叉编译](https://sharp.pixelplumbing.com/install#cross-platform)
</Callout>
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
#### 使用代理地址
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
如果你需要通过代理使用 OpenAI 服务,你可以使用 `OPENAI_PROXY_URL` 环境变量来配置代理地址:
### Crontab 自动更新脚本(可选)
```fish
$ docker run -d -p 3210:3210 \
-e OPENAI_API_KEY=sk-xxxx \
-e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
-e ACCESS_CODE=lobe66 \
--name lobe-chat \
lobehub/lobe-chat
```
如果你想自动获得最新的镜像,你可以如下操作。
### Crontab 自动更新脚本(可选)
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
如果你想自动获得最新的镜像,你可以如下操作。
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
首先,新建一个 `lobe.env` 配置文件,内容为各种环境变量,例如:
然后,你可以使用以下脚本来自动更新:
```env
OPENAI_API_KEY=sk-xxxx
OPENAI_PROXY_URL=https://api-proxy.com/v1
ACCESS_CODE=arthals2333
OPENAI_MODEL_LIST=-gpt-4,-gpt-4-32k,-gpt-3.5-turbo-16k,gpt-3.5-turbo-1106=gpt-3.5-turbo-16k,gpt-4-0125-preview=gpt-4-turbo,gpt-4-vision-preview=gpt-4-vision
```
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
然后,你可以使用以下脚本来自动更新:
# 设置代理(可选)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
```bash
#!/bin/bash
# auto-update-lobe-chat.sh
# 拉取最新的镜像并将输出存储在变量中
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# 设置代理(可选)
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
# 检查拉取命令是否成功执行
if [ $? -ne 0 ]; then
exit 1
fi
# 拉取最新的镜像并将输出存储在变量中
output=$(docker pull lobehub/lobe-chat:latest 2>&1)
# 检查输出中是否包含特定的字符串
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
# 检查拉取命令是否成功执行
if [ $? -ne 0 ]; then
exit 1
fi
# 如果镜像已经是最新的,则不执行任何操作
if [ $? -eq 0 ]; then
exit 0
fi
# 检查输出中是否包含特定的字符串
echo "$output" | grep -q "Image is up to date for lobehub/lobe-chat:latest"
echo "Detected Lobe-Chat update"
# 如果镜像已经是最新的,则不执行任何操作
if [ $? -eq 0 ]; then
exit 0
fi
# 删除旧的容器
echo "Removed: $(docker rm -f Lobe-Chat)"
echo "Detected Lobe-Chat update"
# 运行新的容器
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
# 删除旧的容器
echo "Removed: $(docker rm -f Lobe-Chat)"
# 打印更新的时间和版本
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
# 运行新的容器
echo "Started: $(docker run -d --network=host --env-file /path/to/lobe.env --name=Lobe-Chat --restart=always lobehub/lobe-chat)"
# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
# 打印更新的时间和版本
echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
echo "Removed old images."
```
此脚本可以在 Crontab 中使用,但请确认你的 Crontab 可以找到正确的 Docker 命令。建议使用绝对路径。
配置 Crontab,每 5 分钟执行一次脚本:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
配置 Crontab,每 5 分钟执行一次脚本:
```bash
*/5 * * * * /path/to/auto-update-lobe-chat.sh >> /path/to/auto-update-lobe-chat.log 2>&1
```
</Steps>
## 获取 OpenAI API Key
@@ -172,31 +167,17 @@ API Key 是使用 LobeChat 进行大语言模型会话的必要信息,本节
- 注册完毕后,前往 [API Keys](https://platform.openai.com/api-keys) 页面,点击 `Create new secret key` 创建新的 API Key:
<Steps>
#### 步骤 1:打开创建窗口
#### 步骤 1:打开创建窗口
<Image alt={'打开创建窗口'} height={600} src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296253192-ff2193dd-f125-4e58-82e8-91bc376c0d68.png" />
<Image
alt={'打开创建窗口'}
height={600}
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296253192-ff2193dd-f125-4e58-82e8-91bc376c0d68.png"
/>
#### 步骤 2:创建 API Key
#### 步骤 2:创建 API Key
<Image alt={'创建 API Key'} height={600} src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296254170-803bacf0-4471-4171-ae79-0eab08d621d1.png" />
<Image
alt={'创建 API Key'}
height={600}
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296254170-803bacf0-4471-4171-ae79-0eab08d621d1.png"
/>
#### 步骤 3:获取 API Key
<Image
alt={'获取 API Key'}
height={600}
src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296255167-f2745f2b-f083-4ba8-bc78-9b558e0002de.png"
/>
#### 步骤 3:获取 API Key
<Image alt={'获取 API Key'} height={600} src="https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/296255167-f2745f2b-f083-4ba8-bc78-9b558e0002de.png" />
</Steps>
将此 API Key 填写到 LobeChat 的 API Key 配置中,即可开始使用。
@@ -211,8 +192,8 @@ API Key 是使用 LobeChat 进行大语言模型会话的必要信息,本节
如果你发现注册 OpenAI 账户或者绑定外币信用卡比较麻烦,可以考虑借助一些知名的 OpenAI 第三方代理商来获取 API Key,这可以有效降低获取 OpenAI API Key 的门槛。但与此同时,一旦使用三方服务,你可能也需要承担潜在的风险,请根据你自己的实际情况自行决策。以下是常见的第三方模型代理商列表,供你参考:
| Logo | 服务商 | 特性说明 | Proxy 代理地址 | 链接 |
| --- | --- | --- | --- | --- |
| Logo | 服务商 | 特性说明 | Proxy 代理地址 | 链接 |
| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------- | ------------------------- | ----------------------------- |
| <img src="https://github-production-user-asset-6210df.s3.amazonaws.com/17870709/296272721-c3ac0bf3-e433-4496-89c4-ebdc20689c17.jpg" width="40" /> | **AiHubMix** | 使用 OpenAI 企业接口,全站模型价格为官方 **86 折**(含 GPT-4 、Cluade 3.5 等) | `https://aihubmix.com/v1` | [获取](https://lobe.li/CnsM6fH) |
<Callout type={'warning'}>
+42 -92
View File
@@ -22,129 +22,79 @@ If you want to deploy LobeChat on Netlify, you can follow these steps:
<Steps>
### Fork the LobeChat Repository
Click the Fork button to fork the LobeChat repository to your GitHub account.
Click the Fork button to fork the LobeChat repository to your GitHub account.
### Prepare your OpenAI API Key
### Prepare your OpenAI API Key
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to obtain your OpenAI API Key.
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to obtain your OpenAI API Key.
### Import to Netlify Workspace
### Import to Netlify Workspace
<Callout>
After testing, it is currently not supported to have a one-click deployment button similar to
Vercel/Zeabur. The reason is unknown. Therefore, manual import is required.
</Callout>
<Callout>
After testing, it is currently not supported to have a one-click deployment button similar to
Vercel/Zeabur. The reason is unknown. Therefore, manual import is required.
</Callout>
Click "Import from git"
Click "Import from git"
<Image
alt={'Click "Import from git" in the Netlify workspace'}
height={362}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/31b999e5-2a74-45fc-935b-f036e72a684d'}
/>
<Image alt={'Click "Import from git" in the Netlify workspace'} height={362} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/31b999e5-2a74-45fc-935b-f036e72a684d'} />
Then click "Deploy with Github" and authorize Netlify to access your GitHub account.
Then click "Deploy with Github" and authorize Netlify to access your GitHub account.
<Image
alt={'Authorize Netlify to access your GitHub account'}
height={273}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9c58141-5ec6-43f1-8d97-0a84a04dcdba'}
/>
<Image alt={'Authorize Netlify to access your GitHub account'} height={273} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9c58141-5ec6-43f1-8d97-0a84a04dcdba'} />
Next, select the LobeChat project:
Next, select the LobeChat project:
<Image
alt={'Select the LobeChat github project'}
height={228}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/6c3968a8-fbbb-4268-a587-edaced2d96af'}
/>
<Image alt={'Select the LobeChat github project'} height={228} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/6c3968a8-fbbb-4268-a587-edaced2d96af'} />
### Configure Site Name and Environment Variables
### Configure Site Name and Environment Variables
In this step, you need to configure your site, including the site name, build command, and publish directory. Fill in your site name in the "Site Name" field. If there are no special requirements, you do not need to modify the remaining configurations as we have already set the default configurations.
In this step, you need to configure your site, including the site name, build command, and publish directory. Fill in your site name in the "Site Name" field. If there are no special requirements, you do not need to modify the remaining configurations as we have already set the default configurations.
<Image
alt={'Configure LobeChat site name'}
height={712}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/f3885537-6d43-422f-b1b8-e70732401025'}
/>
<Image alt={'Configure LobeChat site name'} height={712} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/f3885537-6d43-422f-b1b8-e70732401025'} />
Click the "Add environment variables" button to add site environment variables:
Click the "Add environment variables" button to add site environment variables:
<Image
alt={'Add LobeChat site environment variables'}
height={537}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/3b607482-4d99-455a-bc10-3090dd4fe3c5'}
/>
<Image alt={'Add LobeChat site environment variables'} height={537} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/3b607482-4d99-455a-bc10-3090dd4fe3c5'} />
Taking OpenAI as an example, the environment variables you need to add are as follows:
Taking OpenAI as an example, the environment variables you need to add are as follows:
| Environment Variable | Type | Description | Example |
| --- | --- | --- | --- |
| `OPENAI_API_KEY` | Required | This is the API key you applied for on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
| `ACCESS_CODE` | Required | Add a password to access this service. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | `awCT74` or `e3@09!` or `code1,code2,code3` |
| `OPENAI_PROXY_URL` | Optional | If you manually configure the OpenAI interface proxy, you can use this configuration to override the default OpenAI API request base URL | `https://aihubmix.com/v1`, default value: `https://api.openai.com/v1` |
| Environment Variable | Type | Description | Example |
| -------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
| `OPENAI_API_KEY` | Required | This is the API key you applied for on the OpenAI account page | `sk-xxxxxx...xxxxxx` |
| `ACCESS_CODE` | Required | Add a password to access this service. You can set a long password to prevent brute force attacks. When this value is separated by commas, it becomes an array of passwords | `awCT74` or `e3@09!` or `code1,code2,code3` |
| `OPENAI_PROXY_URL` | Optional | If you manually configure the OpenAI interface proxy, you can use this configuration to override the default OpenAI API request base URL | `https://aihubmix.com/v1`, default value: `https://api.openai.com/v1` |
<Callout type={'tip'}>
For a complete list of environment variables supported by LobeChat, please refer to the [📘
Environment Variables](/docs/self-hosting/environment-variables)
</Callout>
<Callout type={'tip'}>
For a complete list of environment variables supported by LobeChat, please refer to the [📘
Environment Variables](/docs/self-hosting/environment-variables)
</Callout>
Afteradding the variables, finally click "Deploy lobe-chat" to enter the deployment phase
Afteradding the variables, finally click "Deploy lobe-chat" to enter the deployment phase
<Image
alt={'Environment variables added'}
height={600}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9f74ec4-ce63-4ce9-b9e2-34bda6fda10b'}
/>
<Image alt={'Environment variables added'} height={600} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9f74ec4-ce63-4ce9-b9e2-34bda6fda10b'} />
### Wait for Deployment to Complete
### Wait for Deployment to Complete
After clicking deploy, you will enter the site details page, where you can click the "Deploying your site" in blue or the "Building" in yellow to view the deployment progress.
After clicking deploy, you will enter the site details page, where you can click the "Deploying your site" in blue or the "Building" in yellow to view the deployment progress.
<Image
alt={'Netlify site details page'}
height={396}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/a7fd85d5-fd32-4756-814e-ff7ab7567fe1'}
/>
<Image alt={'Netlify site details page'} height={396} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/a7fd85d5-fd32-4756-814e-ff7ab7567fe1'} />
Upon entering the deployment details, you will see the following interface, indicating that your LobeChat is currently being deployed. Simply wait for the deployment to complete.
Upon entering the deployment details, you will see the following interface, indicating that your LobeChat is currently being deployed. Simply wait for the deployment to complete.
<Image
alt={'LobeChat deployment in progress'}
height={325}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1ed8b13d-046e-47c8-bd61-116ffdf5d01b'}
/>
<Image alt={'LobeChat deployment in progress'} height={325} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/1ed8b13d-046e-47c8-bd61-116ffdf5d01b'} />
During the deployment and build process:
During the deployment and build process:
<Image
alt={'Deployment in progress'}
height={558}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1c82d707-cb6f-4924-b246-a5235a919864'}
/>
<Image alt={'Deployment in progress'} height={558} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/1c82d707-cb6f-4924-b246-a5235a919864'} />
### Deployment Successful, Start Using
### Deployment Successful, Start Using
If your Deploy Log in the interface looks like the following, it means your LobeChat has been successfully deployed.
If your Deploy Log in the interface looks like the following, it means your LobeChat has been successfully deployed.
<Image
alt={'Deployment Successful'}
height={558}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c1f945d1-f3e2-4100-b6bb-24d4cb13c438'}
/>
<Image alt={'Deployment Successful'} height={558} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c1f945d1-f3e2-4100-b6bb-24d4cb13c438'} />
At this point, you can click on "Open production deploy" to access your LobeChat site.
At this point, you can click on "Open production deploy" to access your LobeChat site.
<Image alt={'Access Your LobeChat Site'} height={527} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/b04723eb-64ad-4028-a901-dc4e4ee2d0c1'} />
</Steps>
+39 -89
View File
@@ -20,126 +20,76 @@ tags:
<Steps>
### Fork LobeChat 仓库
点击 Fork 按钮,将 LobeChat 仓库 Fork 到你的 GitHub 账号下。
点击 Fork 按钮,将 LobeChat 仓库 Fork 到你的 GitHub 账号下。
### 准备好你的 OpenAI API Key
### 准备好你的 OpenAI API Key
前往 [OpenAI API Key](https://platform.openai.com/account/api-keys) 获取你的 OpenAI API Key
前往 [OpenAI API Key](https://platform.openai.com/account/api-keys) 获取你的 OpenAI API Key
### 在 Netlify 工作台导入
### 在 Netlify 工作台导入
<Callout>经过测试,暂不支持类似 Vercel/Zeabur 的一键部署按钮,原因未知。因此需要手动导入</Callout>
<Callout>经过测试,暂不支持类似 Vercel/Zeabur 的一键部署按钮,原因未知。因此需要手动导入</Callout>
点击 「Import from git」
点击 「Import from git」
<Image
alt={'在 Netflix 工作台点击 「Import from git」'}
height={362}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/31b999e5-2a74-45fc-935b-f036e72a684d'}
/>
<Image alt={'在 Netflix 工作台点击 「Import from git」'} height={362} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/31b999e5-2a74-45fc-935b-f036e72a684d'} />
然后点击 「Deploy with Github」,并授权 Netlify 访问你的 GitHub 账号
然后点击 「Deploy with Github」,并授权 Netlify 访问你的 GitHub 账号
<Image
alt={'授权 Netlify 访问你的 GitHub 账号'}
height={273}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9c58141-5ec6-43f1-8d97-0a84a04dcdba'}
/>
<Image alt={'授权 Netlify 访问你的 GitHub 账号'} height={273} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9c58141-5ec6-43f1-8d97-0a84a04dcdba'} />
然后选择 LobeChat 项目:
然后选择 LobeChat 项目:
<Image
alt={'选择 LobeChat github 项目'}
height={228}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/6c3968a8-fbbb-4268-a587-edaced2d96af'}
/>
<Image alt={'选择 LobeChat github 项目'} height={228} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/6c3968a8-fbbb-4268-a587-edaced2d96af'} />
### 配置站点名称与环境变量
### 配置站点名称与环境变量
在这一步,你需要配置你的站点,包括站点名称、构建命令、发布目录等。在「Site Name」字段填写上你的站点名称。其余配置如果没有特殊要求,无需修改,我们已经设定好了默认配置。
在这一步,你需要配置你的站点,包括站点名称、构建命令、发布目录等。在「Site Name」字段填写上你的站点名称。其余配置如果没有特殊要求,无需修改,我们已经设定好了默认配置。
<Image
alt={'配置 LobeChat 站点名称'}
height={712}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/f3885537-6d43-422f-b1b8-e70732401025'}
/>
<Image alt={'配置 LobeChat 站点名称'} height={712} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/f3885537-6d43-422f-b1b8-e70732401025'} />
点击 「Add environment variables」按钮,添加站点环境变量:
点击 「Add environment variables」按钮,添加站点环境变量:
<Image
alt={'添加 LobeChat 站点环境变量'}
height={537}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/3b607482-4d99-455a-bc10-3090dd4fe3c5'}
/>
<Image alt={'添加 LobeChat 站点环境变量'} height={537} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/3b607482-4d99-455a-bc10-3090dd4fe3c5'} />
以配置 OpenAI 为例,你需要添加的环境变量如下:
以配置 OpenAI 为例,你需要添加的环境变量如下:
| 环境变量 | 类型 | 描述 | 示例 |
| --- | --- | --- | --- |
| `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
| `ACCESS_CODE` | 必选 | 添加访问此服务的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
| `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://aihubmix.com/v1` ,默认值:`https://api.openai.com/v1` |
| 环境变量 | 类型 | 描述 | 示例 |
| ------------------ | -- | ------------------------------------------------------- | ---------------------------------------------------------- |
| `OPENAI_API_KEY` | 必选 | 这是你在 OpenAI 账户页面申请的 API 密钥 | `sk-xxxxxx...xxxxxx` |
| `ACCESS_CODE` | 必选 | 添加访问此服务的密码,你可以设置一个长密码以防被爆破,该值用逗号分隔时为密码数组 | `awCT74` 或 `e3@09!` or `code1,code2,code3` |
| `OPENAI_PROXY_URL` | 可选 | 如果你手动配置了 OpenAI 接口代理,可以使用此配置项来覆盖默认的 OpenAI API 请求基础 URL | `https://aihubmix.com/v1` ,默认值:`https://api.openai.com/v1` |
<Callout type={'tip'}>
LobeChat 支持的完整环境变量列表请参考 [📘 环境变量](/zh/docs/self-hosting/environment-variables)
部分
</Callout>
<Callout type={'tip'}>
LobeChat 支持的完整环境变量列表请参考 [📘 环境变量](/zh/docs/self-hosting/environment-variables)
部分
</Callout>
添加完成后,最后点击「Deploy lobe-chat」 进入部署阶段。
添加完成后,最后点击「Deploy lobe-chat」 进入部署阶段。
<Image
alt={'环境变量添加完成'}
height={600}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9f74ec4-ce63-4ce9-b9e2-34bda6fda10b'}
/>
<Image alt={'环境变量添加完成'} height={600} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c9f74ec4-ce63-4ce9-b9e2-34bda6fda10b'} />
### 等待部署完成
### 等待部署完成
点击部署后,会进入站点详情页面,你可以点击青色字样的「Deploying your site」或者 「Building」 黄色标签查看部署进度。
点击部署后,会进入站点详情页面,你可以点击青色字样的「Deploying your site」或者 「Building」 黄色标签查看部署进度。
<Image
alt={'Netlify 站点详情页'}
height={396}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/a7fd85d5-fd32-4756-814e-ff7ab7567fe1'}
/>
<Image alt={'Netlify 站点详情页'} height={396} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/a7fd85d5-fd32-4756-814e-ff7ab7567fe1'} />
进入部署详情,你会看到下述界面,这意味着你的 LobeChat 正在部署中,只需等待部署完成即可。
进入部署详情,你会看到下述界面,这意味着你的 LobeChat 正在部署中,只需等待部署完成即可。
<Image
alt={'LobeChat 部署构建中'}
height={325}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1ed8b13d-046e-47c8-bd61-116ffdf5d01b'}
/>
<Image alt={'LobeChat 部署构建中'} height={325} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/1ed8b13d-046e-47c8-bd61-116ffdf5d01b'} />
部署构建过程中:
部署构建过程中:
<Image
alt={'部署构建中'}
height={558}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/1c82d707-cb6f-4924-b246-a5235a919864'}
/>
<Image alt={'部署构建中'} height={558} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/1c82d707-cb6f-4924-b246-a5235a919864'} />
### 部署成功,开始使用
### 部署成功,开始使用
如果你的界面中的 Deploy Log 如下所示,意味着你的 LobeChat 部署成功了。
如果你的界面中的 Deploy Log 如下所示,意味着你的 LobeChat 部署成功了。
<Image
alt={'部署成功'}
height={558}
inStep
src={'https://github.com/lobehub/lobe-chat/assets/28616219/c1f945d1-f3e2-4100-b6bb-24d4cb13c438'}
/>
<Image alt={'部署成功'} height={558} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/c1f945d1-f3e2-4100-b6bb-24d4cb13c438'} />
此时,你可以点击「Open production deploy」,即可访问你的 LobeChat 站点
此时,你可以点击「Open production deploy」,即可访问你的 LobeChat 站点
<Image alt={'访问你的 LobeChat 站点'} height={527} inStep src={'https://github.com/lobehub/lobe-chat/assets/28616219/b04723eb-64ad-4028-a901-dc4e4ee2d0c1'} />
</Steps>
+6 -7
View File
@@ -20,16 +20,15 @@ If you want to deploy LobeChat on Railway, you can follow the steps below:
<Steps>
### Prepare your OpenAI API Key
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key.
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key.
### Click the button below to deploy
### Click the button below to deploy
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/FB6HrV?referralCode=9bD9mT)
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/FB6HrV?referralCode=9bD9mT)
### Once deployed, you can start using it
### Once deployed, you can start using it
### Bind a custom domain (optional)
You can use the subdomain provided by Railway, or choose to bind a custom domain. Currently, the domains provided by Railway have not been contaminated, and most regions can connect directly.
### Bind a custom domain (optional)
You can use the subdomain provided by Railway, or choose to bind a custom domain. Currently, the domains provided by Railway have not been contaminated, and most regions can connect directly.
</Steps>

Some files were not shown because too many files have changed in this diff Show More