* feat: spport qwen-vl and tool call for qwen
* fix: make transformResponseToStream a util for testability
* test: append unit test for non-streaming response
* test: update unit-test against LobeQwenAI models
* 💄 style(ui): Confirm before opening a new topic
* 💄 style(ui): Always display `MoreVertical` on mobile
* 💄 style(ui): Adjust style of some components
* 💄 style(ui): Adjust the popment of `Popconfirm`
* 💄 style(ui): Adjust the popment of `Popconfirm`
* feat: Disable signup when env set
* feat: Disable Clerk sign-up based on feature flag
* fix: change to client
* fix: remove the logic for signup in middleware
* chore: revert the space deletion
* fix: update the url for login and signup
* fix: fix footerAction update logic
* test: update test for enableClerkSignUp
* 💄 style: update coding style
* 🐛 fix: display issue when select default model in System Agent
* 🔨 chore: removed 'form' from trigger
* 🔨 chore: cleanup space
* 🔨 chore: update useSyncSystemAgent function
* 🔨 chore: package system-agent form as component
* 📝 docs(env): configuration type
Signed-off-by: Star <i@ssstttar.com>
* 📝 docs: fix punctuation marks
Signed-off-by: Star <i@ssstttar.com>
* 📝 docs: add chatConfig
Signed-off-by: Star <i@ssstttar.com>
* 📝 docs(bot): Auto sync agents & plugin to readme
---------
Signed-off-by: Star <i@ssstttar.com>
* 💄 style: Modify the display effect of some content
* 💄 style: Modify the display effect of `voice input`
* 💄 style: Modify the display effect of `voice input`
* 🚸 style: improve PWAInstall show timing
* ♻️ refactor: refactor the global preference to system status
* 🐛 fix: fix update status
* 🐛 fix: fix status
* ✅ test: fix test
* 🎨 chore: improve code
* ♻️ refactor: refactor user store
* ♻️ refactor: refactor the user trace
* 🐛 fix: fix parser model
* 🐛 fix: fix parser model
* 🐛 fix: fix parser model
* ♻️ refactor: refactor modal
* 🐛 fix: try to fix modal
* 🐛 fix: fix model list select error
* ✅ test: add test for model list
* 🐛fix: wrong client fetch judgement
* ✅ test: add test for `isProviderFetchOnClient`
* 🔧 fix: make azure request sent from server
* 🔧 refactor: show client fetch for azure
* ♻️ refactor: refactor file by file and upload for upload to s3
* ✨ feat: support upload file to s3
* ✅ test: fix test
* 🛂 feat: add auth for the upload path
* ✅ test: fix circular deps
* ✅ test: add more tests
* ✅ test: add more tests
* ✅ test: add more tests
* ✅ test: add more tests
* ✨ feat: support DeepSeek as provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* ✨ feat: Support DeepSeek as new model provider
* 💄 style: Translate some content
* ✨ feat: Support DeepSeek as new model provider
* 🐛 fix: Clean up the code and resolve a bug
* style:Add an "Assistant and Conversation" icon
* 💄 style : Add an "Assistant and Conversation" icon
* 💄 style: Add an "Assistant and Conversation" icon
* 💄 style : Add an `Assistant and Conversation` icon
* 💄 style : Add an `Assistant and Conversation` icon
# the format is `plugin-identifier:key1=value1;key2=value2`, multiple settings fields are separated by semicolons `;`, multiple plugin settings are separated by commas `,`.
Copyright (c) 2024/06/17 - current LobeHub LLC. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
----------
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
From 1.0, LobeChat is licensed under the Apache License 2.0, with the following additional conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1. The commercial usage of LobeChat:
a. LobeChat may be utilized commercially, including as a frontend and backend service without modifying the source code.
b. a commercial license must be obtained from the producer if you want to develop and distribute a derivative work based on LobeChat.
Please contact hello@lobehub.com by email to inquire about licensing matters.
2. As a contributor, you should agree that:
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary.
b. Your contributed code may be used for commercial purposes, including but not limited to its cloud edition.
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
----------
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
@@ -59,9 +59,11 @@ One-click **FREE** deployment of your private OpenAI ChatGPT/Claude/Gemini/Groq/
- [`5` Text to Image Generation](#5-text-to-image-generation)
- [`6` Plugin System (Function Calling)](#6-plugin-system-function-calling)
- [`7` Agent Market (GPTs)](#7-agent-market-gpts)
- [`8` Progressive Web App (PWA)](#8-progressive-web-app-pwa)
- [`9` Mobile Device Adaptation](#9-mobile-device-adaptation)
- [`10` Custom Themes](#10-custom-themes)
- [`8` Support Local / Remote Database](#8-support-local--remote-database)
- [`9` Support Multi-User Management](#9-support-multi-user-management)
- [`10` Progressive Web App (PWA)](#10-progressive-web-app-pwa)
- [`11` Mobile Device Adaptation](#11-mobile-device-adaptation)
- [`12` Custom Themes](#12-custom-themes)
- [`*` What's more](#-whats-more)
- [⚡️ Performance](#️-performance)
- [🛳 Self Hosting](#-self-hosting)
@@ -130,6 +132,9 @@ We have implemented support for the following model service providers:
- **ChatGLM**: Added the **ChatGLM** series models from Zhipuai (GLM-4/GLM-4-vision/GLM-3-turbo), providing users with another efficient conversation model choice. [Learn more](https://www.zhipuai.cn/)
- **Moonshot AI (Dark Side of the Moon)**: Integrated with the Moonshot series models, an innovative AI startup from China, aiming to provide deeper conversation understanding. [Learn more](https://www.moonshot.cn/)
- **Minimax**: Integrated the Minimax models, including the MoE model **abab6**, offers a broader range of choices. [Learn more](https://www.minimaxi.com/)
- **DeepSeek**: Integrated with the DeepSeek series models, an innovative AI startup from China, The product has been designed to provide a model that balances performance with price. [Learn more](https://www.deepseek.com/)
- **Qwen**: Integrated the Qwen series models, including the latest **qwen-turbo**, **qwen-plus** and **qwen-max**. [Lean more](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
- **Novita AI**: Access **Llama**, **Mistral**, and other leading open-source models at cheapest prices. Engage in uncensored role-play, spark creative discussions, and foster unrestricted innovation. **Pay For What You Use.** [Learn more](https://novita.ai/llm-api?utm_source=lobechat&utm_medium=ch&utm_campaign=api)
At the same time, we are also planning to support more model service providers, such as Replicate and Perplexity, to further enrich our service provider library. If you would like LobeChat to support your favorite service provider, feel free to join our [community discussion](https://github.com/lobehub/lobe-chat/discussions/1284).
@@ -222,14 +227,14 @@ In addition, these plugins are not limited to news aggregation, but can also ext
| [Social Search](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-05-02**</sup> | The Social Search provides access to tweets, users, followers, images, media and more.<br/>`social``twitter``x``search` |
| [Search Google via Serper](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **Barry** on **2024-04-30**</sup> | Google search engine via Serper.dev free API (2500x🆓/month)<br/>`web``search` |
| [NFT Guru](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **swap** on **2024-04-03**</sup> | Discover current prices of NFTs across major platforms and keep track of the rapidly changing marketplace with real-time<br/>`crypto``nft` |
| [Calendar Assistant](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **cc** on **2024-03-13**</sup> | A plugin to manage your calendar events # will auto generate i18n in workflow<br/>`calendar``schedule``will-auto-generate-i-18-n-in-workflow` |
| [Shopping tools](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **shoppingtools** on **2024-07-19**</sup> | Search for products on eBay & AliExpress, find eBay events & coupons. Get prompt examples.<br/>`shopping``e-bay``ali-express``coupons` |
| [Savvy Trader AI](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **savvytrader** on **2024-06-27**</sup> | Realtime stock, crypto and other investment data.<br/>`stock``analyze` |
| [Social Search](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **say-apps** on **2024-06-02**</sup> | The Social Search provides access to tweets, users, followers, images, media and more.<br/>`social``twitter``x``search` |
| [Space](https://chat-preview.lobehub.com/settings/agent)<br/><sup>By **automateyournetwork** on **2024-05-12**</sup> | Space data including NASA.<br/>`space``nasa` |
> 📊 Total plugins: [<kbd>**56**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
> 📊 Total plugins: [<kbd>**52**</kbd>](https://github.com/lobehub/lobe-chat-plugins)
<!-- PLUGIN LIST -->
@@ -261,14 +266,14 @@ Our marketplace is not just a showcase platform but also a collaborative space.
| [Sales Description Specialist](https://chat-preview.lobehub.com/market?agent=verkauf-kleinanzeigen)<br/><sup>By **[highseen](https://github.com/highseen)** on **2024-04-30**</sup> | Assists in the sale of used items through research, pricing, description, and title creation.<br/>`product-sales``research``description` |
| [Jailbreak Assistant DAN](https://chat-preview.lobehub.com/market?agent=gpt-4-dan-assistant)<br/><sup>By **[MapleEve](https://github.com/MapleEve)** on **2024-04-26**</sup> | Bypass OpenAI review mechanism, ChatGPT after jailbreak<br/>`creative``artificial-intelligence``conversation``jailbreak` |
| [TailwindHelper](https://chat-preview.lobehub.com/market?agent=tailwind-helper)<br/><sup>By **[aototo](https://github.com/aototo)** on **2024-04-26**</sup> | TailwindHelper is a professional frontend designer with a solid foundation in design theory and rich practical experience. Created by a leading software development company, it aims to help developers and designers accelerate the development process of web interfaces. TailwindHelper is proficient in the Tailwind CSS framework and can translate complex design requirements into efficient and responsive CSS class names.<br/>`tailwindcss``css``tailwind-helper` |
| [yapi JSON-SCHEMA to Typescript](https://chat-preview.lobehub.com/market?agent=yapi-ts-helper)<br/><sup>By **[zcf0508](https://github.com/zcf0508)** on **2024-04-26**</sup> | Specializes in converting JSON schema to TypeScript types.<br/>`typescript``development` |
| [BIDOSx2](https://chat-preview.lobehub.com/market?agent=bidosx-2-v-2)<br/><sup>By **[SaintFresh](https://github.com/SaintFresh)** on **2024-07-21**</sup> | A highly advanced AI LLM transcending conventional AI. 'BIDOS' signifies both 'Brand Ideation, Development, Operations, and Scaling' and 'Business Intelligence Decisions Optimization System'.<br/>`brand-development``ai-assistant``market-analysis``strategic-planning``business-optimization``business-intelligence` |
| [Growth Coach](https://chat-preview.lobehub.com/market?agent=personal-development-coach)<br/><sup>By **[zer0boss](https://github.com/zer0boss)** on **2024-07-20**</sup> | Specializes in helping users explore themselves through dialogue, find solutions, and paths to growth<br/>`growth-coach``self-exploration``goal-setting``self-awareness` |
| [Convert SQL Table Structure to Dao and Mapper](https://chat-preview.lobehub.com/market?agent=my-batis-generator)<br/><sup>By **[MeYoung](https://github.com/MeYoung)** on **2024-07-17**</sup> | Generate entity class and MyBatis Mapper based on a table structure<br/>`sql``sql``mybatis` |
| [Auto Extraction Data](https://chat-preview.lobehub.com/market?agent=the-20-autoextract)<br/><sup>By **[vkhoilq](https://github.com/vkhoilq)** on **2024-07-17**</sup> | The20 Auto Extraction Data<br/>`the-20``autoextract` |
> 📊 Total agents: [<kbd>**244**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
> 📊 Total agents: [<kbd>**302**</kbd> ](https://github.com/lobehub/lobe-chat-agents)
<!-- AGENT LIST -->
@@ -278,9 +283,44 @@ Our marketplace is not just a showcase platform but also a collaborative space.
</div>
[![][image-feat-database]][docs-feat-database]
### `8` [Support Local / Remote Database][docs-feat-database]
LobeChat supports the use of both server-side and local databases. Depending on your needs, you can choose the appropriate deployment solution:
- **Local database**: suitable for users who want more control over their data and privacy protection. LobeChat uses CRDT (Conflict-Free Replicated Data Type) technology to achieve multi-device synchronization. This is an experimental feature aimed at providing a seamless data synchronization experience.
- **Server-side database**: suitable for users who want a more convenient user experience. LobeChat supports PostgreSQL as a server-side database. For detailed documentation on how to configure the server-side database, please visit [Configure Server-side Database](https://lobehub.com/docs/self-hosting/advanced/server-database).
Regardless of which database you choose, LobeChat can provide you with an excellent user experience.
LobeChat supports multi-user management and provides two main user authentication and management solutions to meet different needs:
- **next-auth**: LobeChat integrates `next-auth`, a flexible and powerful identity verification library that supports multiple authentication methods, including OAuth, email login, credential login, etc. With `next-auth`, you can easily implement user registration, login, session management, social login, and other functions to ensure the security and privacy of user data.
- **Clerk**: For users who need more advanced user management features, LobeChat also supports `Clerk`, a modern user management platform. `Clerk` provides richer functions, such as multi-factor authentication (MFA), user profile management, login activity monitoring, etc. With `Clerk`, you can get higher security and flexibility, and easily cope with complex user management needs.
Regardless of which user management solution you choose, LobeChat can provide you with an excellent user experience and powerful functional support.
<div align="right">
[![][back-to-top]](#readme-top)
</div>
[![][image-feat-pwa]][docs-feat-pwa]
### `8` [Progressive Web App (PWA)][docs-feat-pwa]
### `10` [Progressive Web App (PWA)][docs-feat-pwa]
We deeply understand the importance of providing a seamless experience for users in today's multi-device environment.
Therefore, we have adopted Progressive Web Application ([PWA](https://support.google.com/chrome/answer/9658361)) technology,
@@ -307,7 +347,7 @@ providing smooth animations, responsive layouts, and adapting to different devic
We have carried out a series of optimization designs for mobile devices to enhance the user's mobile experience. Currently, we are iterating on the mobile user experience to achieve smoother and more intuitive interactions. If you have any suggestions or ideas, we welcome you to provide feedback through GitHub Issues or Pull Requests.
@@ -319,7 +359,7 @@ We have carried out a series of optimization designs for mobile devices to enhan
[![][image-feat-theme]][docs-feat-theme]
### `10` [Custom Themes][docs-feat-theme]
### `12` [Custom Themes][docs-feat-theme]
As a design-engineering-oriented application, LobeChat places great emphasis on users' personalized experiences,
hence introducing flexible and diverse theme modes, including a light mode for daytime and a dark mode for nighttime.
@@ -627,11 +667,12 @@ Every bit counts and your one-time donation sparkles in our galaxy of support! Y
@@ -4,14 +4,14 @@ This document aims to guide developers on how to develop a complete feature requ
We will use the implementation of sessionGroup as an example: [✨ feat: add session group manager](https://github.com/lobehub/lobe-chat/pull/1055), and explain the complete implementation process through the following six main sections:
1. Data Model / Database Definition
2. Service Implementation / Model Implementation
3. Frontend Data Flow Store Implementation
4. UI Implementation and Action Binding
5. Data Migration
6. Data Import and Export
1.[Data Model / Database Definition](#1-data-model--database-definition)
2.[Service Implementation / Model Implementation](#2-service-implementation--model-implementation)
3.[Frontend Data Flow Store Implementation](#3-frontend-data-flow-store-implementation)
4.[UI Implementation and Action Binding](#4-ui-implementation-and-action-binding)
5.[Data Migration](#5-data-migration)
6.[Data Import and Export](#6-data-import-and-export)
## 1. Database Section
## 1. Data Model / Database Definition
To implement the Session Group feature, it is necessary to define the relevant data model and indexes at the database level.
@@ -119,7 +119,7 @@ As a result, you can now view the `sessionGroups` table in the `LOBE_CHAT_DB` in
## 2. Service Implementation / Model Implementation
### Define Model
@@ -176,7 +176,7 @@ class SessionService {
}
```
## 3. Store Action Section
## 3. Frontend Data Flow Store Implementation
In the LobeChat application, the Store module is used to manage the frontend state of the application. The Actions within it are functions that trigger state updates, usually by calling methods in the service layer to perform actual data processing operations and then updating the state in the Store. We use `zustand` as the underlying dependency for the Store module. For a detailed practical introduction to state management, you can refer to [📘 Best Practices for State Management](../State-Management/State-Management-Intro.zh-CN.md).
@@ -351,7 +351,7 @@ Since all data retrieval in the UI is implemented using syntax like `useSessionS
>
> If you are not familiar with the concept and functionality of selectors, you can refer to the section [📘 Data Storage and Retrieval Module](./State-Management-Selectors.en-US) for relevant information.
## IV. UI Section
## 4. UI Implementation and Action Binding
Bind Store Action in the UI component to implement interactive logic, for example `CreateGroupModal`:
@@ -570,7 +570,7 @@ export class LocalDB extends Dexie {
This is our data migration strategy. When performing the migration, it is essential to ensure the correctness of the migration script and validate the migration results through thorough testing.
## VI. Data Import and Export
## 6. Data Import and Export
In LobeChat, the data import and export feature is designed to ensure that users can migrate their data between different devices. This includes session, topic, message, and settings data. In the implementation of the Session Group feature, we also need to handle data import and export to ensure that the complete exported data can be restored exactly the same on other devices.
Welcome to the LobeChat technical development getting started guide. LobeChat is an AI conversation application built on the Next.js framework, which integrates a series of technology stacks to achieve diverse functions and features. This guide will provide a detailed introduction to the main technical components of LobeChat and how to configure and use these technologies in your development environment.
Welcome to the LobeChat Technical Development Getting Started Guide. LobeChat is an AI conversation application built on the Next.js framework, incorporating a range of technology stacks to achieve diverse functionalities and features. This guide will detail the main technical components of LobeChat and how to configure and use these technologies in your development environment.
- [Appendix: Resources and References](#appendix-resources-and-references)
## Basic Technology Stack
The core technology stack of LobeChat includes:
The core technology stack of LobeChat is as follows:
- **Framework**: We have chosen [Next.js](https://nextjs.org/), a powerful React framework that provides key features such as server-side rendering, routing framework, and Router Handler for our project.
- **Component Library**: We use [Ant Design (antd)](https://ant.design/) as the basic component library, and also introduce [lobe-ui](https://github.com/lobehub/lobe-ui) as our business component library.
- **State Management**: We have opted for [zustand](https://github.com/pmndrs/zustand), a lightweight and easy-to-use state management library.
- **Framework**: We chose [Next.js](https://nextjs.org/), a powerful React framework that provides key features such as server-side rendering, routing framework, and Router Handler.
- **Component Library**: We use [Ant Design (antd)](https://ant.design/) as the basic component library, along with [lobe-ui](https://github.com/lobehub/lobe-ui) as our business component library.
- **State Management**: We selected [zustand](https://github.com/pmndrs/zustand), a lightweight and easy-to-use state management library.
- **Network Requests**: We use [swr](https://swr.vercel.app/), a React Hooks library for data fetching.
- **Routing**: For routing management, we directly use the solution provided by [Next.js](https://nextjs.org/) itself.
- **Internationalization**: We use [i18next](https://www.i18next.com/) to implement multi-language support for the application.
- **Routing**: For routing management, we directly use the solution provided by [Next.js](https://nextjs.org/).
- **Internationalization**: We use [i18next](https://www.i18next.com/) to support multiple languages in the application.
- **Styling**: We use [antd-style](https://github.com/ant-design/antd-style), a CSS-in-JS library that complements Ant Design.
- **Unit Testing**: We use [vitest](https://github.com/vitest-dev/vitest) for unit testing.
@@ -26,18 +30,82 @@ The folder directory structure of LobeChat is as follows:
```bash
src
├── app # Main logic of the application and code related to state management
├── app # Code related to the main logic and state management of the application
├── components # Reusable UI components
├── config # Application configuration files, including client-side environment variables and server-side environment variables
├── config # Application configuration files, including client and server environment variables
├── const # Used to define constants, such as action types, route names, etc.
├── features # Function modules related to business features, such as Agent settings, plugin development pop-ups, etc.
├── hooks # Custom utility hooks reused throughout the application
├── features # Business-related feature modules, such as Agent settings, plugin development pop-ups, etc.
├── hooks # Custom utility Hooks reusable across the application
├── layout # Application layout components, such as navigation bars, sidebars, etc.
├── locales # Language files for internationalization
├── services # Encapsulated backend service interfaces, such as HTTP requests
├── store # Zustand store for state management
├── types # TypeScript type definition files
└── utils # Common utility functions
└── utils # General utility functions
```
For a detailed introduction to the directory structure, please refer to: [Folder Directory Structure](Folder-Structure.en-US.md)
For a detailed introduction to the directory structure, see: [Folder Directory Structure](Folder-Structure.zh-CN.md)
## Local Development Environment Setup
This section outlines setting up the development environment and local development. Before starting, please ensure that Node.js, Git, and your chosen package manager (Bun or PNPM) are installed in your local environment.
We recommend using WebStorm as your integrated development environment (IDE).
1.**Get the code**: Clone the LobeChat code repository locally:
2.**Install dependencies**: Enter the project directory and install the required dependencies:
```bash
cd lobe-chat
# If you use Bun
bun install
# If you use PNPM
pnpm install
```
3.**Run and debug**: Start the local development server and begin your development journey:
```bash
# Start the development server with Bun
bun run dev
# Visit http://localhost:3010 to view the application
```
> \[!IMPORTANT]\
> If you encounter the error "Could not find 'stylelint-config-recommended'" when installing dependencies with `npm`, please reinstall the dependencies using `pnpm` or `bun`.
Now, you should be able to see the welcome page of LobeChat in your browser. For a detailed environment setup guide, please refer to [Development Environment Setup Guide](Setup-Development.zh-CN.md).
## Code Style and Contribution Guide
In the LobeChat project, we place great emphasis on the quality and consistency of the code. For this reason, we have established a series of code style standards and contribution processes to ensure that every developer can smoothly participate in the project. Here are the code style and contribution guidelines you need to follow as a developer.
- **Code Style**: We use `@lobehub/lint` to unify the code style, including ESLint, Prettier, remarklint, and stylelint configurations. Please adhere to our code standards to maintain code consistency and readability.
- **Contribution Process**: We use gitmoji and semantic release for code submission and release processes. Please use gitmoji to annotate your commit messages and ensure compliance with the semantic release standards so that our automation systems can correctly handle version control and releases.
All contributions will undergo code review. Maintainers may suggest modifications or requirements. Please respond actively to review comments and make timely adjustments. We look forward to your participation and contribution.
For detailed code style and contribution guidelines, please refer to [Code Style and Contribution Guide](Contributing-Guidelines.zh-CN.md).
## Internationalization Implementation Guide
LobeChat uses `i18next` and `lobe-i18n` to implement multilingual support, ensuring a global user experience.
Internationalization files are located in `src/locales`, containing the default language (Chinese). We generate other language JSON files automatically through `lobe-i18n`.
If you want to add a new language, follow specific steps detailed in [New Language Addition Guide](../Internationalization/Add-New-Locale.zh-CN.md). We encourage you to participate in our internationalization efforts to provide better services to global users.
For a detailed guide on internationalization implementation, please refer to [Internationalization Implementation Guide](../Internationalization/Internationalization-Implementation.zh-CN.md).
## Appendix: Resources and References
To support developers in better understanding and using the technology stack of LobeChat, we provide a comprehensive list of resources and references — [LobeChat Resources and References](https://github.com/lobehub/lobe-chat/wiki/Resources.zh-CN) - Visit our maintained list of resources, including tutorials, articles, and other useful links.
We encourage developers to utilize these resources to deepen their learning and enhance their skills, join community discussions through [LobeChat GitHub Discussions](https://github.com/lobehub/lobe-chat/discussions) or [Discord](https://discord.com/invite/AYFPHvv2jT), ask questions, or share your experiences.
If you have any questions or need further assistance, please do not hesitate to contact us through the above channels.
LobeChat Identity Verification Service - Centralized User Authorization
Management
title: LobeChat Authorization Service
description: >-
Learn about LobeChat's support for configuring external identity verification
services for centralized user authorization within enterprises/organizations.
Explore supported services like Auth0, Microsoft Entra ID, Authentik, Github,
and ZITADEL.
tags:
- Identity Verification Service
- Centralized User Authorization
- SSO Providers
- Auth0
- Microsoft Entra ID
- Authentik
- Github
- ZITADEL
- Next Auth
- Clerk
---
# Identity Verification Service
# LobeChat Authorization
LobeChat supports the configuration of external identity verification services for internal use within enterprises/organizations to centrally manage user authorization.
## Clerk
Clerk is a comprehensive identity verification solution that has recently gained popularity. It provides a simple yet powerful API and services to handle user authentication and session management. Clerk's design philosophy is to offer a concise and modern authentication solution that enables developers to easily integrate and use it.
LobeChat has deeply integrated with Clerk to provide users with a more secure and convenient login and registration experience. It also relieves developers from the burden of managing authentication logic. Clerk's concise and modern design philosophy aligns perfectly with LobeChat's goals, making user management on the entire platform more efficient and reliable.
By setting the environment variables NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY in LobeChat's environment, you can enable and use Clerk.
## Next Auth
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. |
| `ACCESS_CODE` | Required | Add a password to access this service. You can set a sufficiently long random password to "disable" access code authorization. |
| `NEXTAUTH_URL` | Optional | 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,azure-ad,authentik`. |
Currently supported identity verification services include:
Click on the links to view the corresponding platform's configuration documentation.
## Advanced Configuration
To simultaneously enable multiple identity verification sources, please set the `SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,azure-ad,authentik`.
To simultaneously enable multiple identity verification sources, please set the `NEXT_AUTH_SSO_PROVIDERS` environment variable, separating them with commas, for example, `auth0,azure-ad,authentik`.
The order corresponds to the display order of the SSO providers.
Learn how to use environment variables to customize LobeChat's feature flags,
including controlling whether a feature is enabled or disabled, or enabling or
disabling features for specific user groups or environments as needed.
tags:
- LobeChat
- Environment Variables
- Configuration Guide
- Feature Flags
---
# Feature Flags
In addition to basic environment variable configuration, LobeChat also offers feature flags to control whether a feature is enabled globally, or to enable or disable features for specific user groups or environments as needed.
- Description: Used to control LobeChat's feature functionalities. Supports multiple feature flags, using `+` to add a feature and `-` to disable a feature. Separate multiple feature flags with a comma `,` and enclose the entire value in quotes `"` to avoid parsing errors.
- Default: `-`
- Example: `"-welcome_suggest"`
All features are controlled by the `FEATURE_FLAGS` variable as the sole configuration variable.
You can achieve various feature combinations using the above configuration syntax. All feature flags are Boolean values, enabled with `+` and disabled with `-`.
<Callout type={'tip'}>
Attention: Unlike the `OPENAI_MODEL_LIST` variable, the `FEATURE_FLAGS` variable does not support
the `all` keyword. You need to manually control all feature flags (otherwise, they will adopt
their default values).
</Callout>
| Configuration Item | Description | Default Value |
You can always check the [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) to get the latest list of feature flags.
LobeChat supports customizing the model list during deployment. You can use `+` to add a model, `-` to hide a model, and use `model name=display name<extension configuration>` to customize the display name of a model, separated by English commas. The basic syntax is as follows:
LobeChat supports customizing the model list during deployment. This configuration is done in the environment for each [model provider](/docs/self-hosting/environment-variables/model-provider). You can use `+` to add a model, `-` to hide a model, and use `model name=display name<extension configuration>` to customize the display name of a model, separated by English commas. The basic syntax is as follows:
For example: `+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-0125-preview=gpt-4-turbo`
@@ -36,7 +36,7 @@ Examples are as follows:
- `chatglm-6b=ChatGLM 6B<4096>`: ChatGLM 6B, maximum context of 4k, no advanced capabilities;
- `spark-v3.5=讯飞星火 v3.5<8192:fc>`: Xunfei Spark 3.5 model, maximum context of 8k, supports Function Call;
- `gemini-pro-vision=Gemini Pro Vision<16000:vision>`: Google Vision model, maximum context of 16k, supports image recognition;
- `gemini-1.5-flash-latest=Gemini 1.5 Flash<16000:vision>`: Google Vision model, maximum context of 16k, supports image recognition;
- `gpt-4-all=ChatGPT Plus<128000:fc:vision:file>`, hacked version of ChatGPT Plus web, context of 128k, supports image recognition, Function Call, file upload.
title: Deploying Server-Side Database - Configuration Guide for LobeChat on Vercel
description: >-
Learn how to deploy the server-side database version of LobeChat on Vercel,
including database configuration, identity authentication service setup, and
S3 storage service configuration.
tags:
- Server-Side Database
- Vercel Deployment
- Postgres Database
- Identity Authentication
- S3 Storage Service
- Configuration Guide
---
# Deploying Server-Side Database
LobeChat defaults to using a client-side database (IndexedDB) but also supports using a server-side database. LobeChat uses Postgres as the backend storage database. PostgreSQL is a powerful open-source relational database management system with high scalability and standard SQL support. It provides rich data types, concurrency control, data integrity, security, and programmability, making it suitable for complex applications and large-scale data management.
This article will detail how to deploy the server-side database version of LobeChat on Vercel, including: 1) database configuration; 2) identity authentication service configuration; 3) steps for setting up the S3 storage service.
<Callout type={'info'}>
Due to workload constraints, currently only deployment on Vercel using the server-side database
version is supported, with Docker version support planned for future iterations.
</Callout>
<Callout type={'warning'}>
Before proceeding, please ensure the following
- **Export all data.** After deploying the server-side database, the original user data cannot be migrated automatically. You must back it up in advance and import it manually!
- **The `ACCESS_CODE` environment variable is set.** It should not be empty or cleared!
- **It is crucial to fill in all the environment variables required for the server-side database configuration before deployment.** Failure to do so may result in database migration issues!
</Callout>
## 1. Configure the Database
<Steps>
### Prepare a Server-Side Database Instance and Obtain the Connection URL
Before deployment, make sure you have prepared a Postgres database instance. You can choose either of the following methods:
- `A.` Use Serverless Postgres instances like Vercel/Neon;
- `B.` Use self-deployed Postgres instances like Docker.
The configuration for both methods is slightly different, which will be distinguished in the next step.
### Add Environment Variables in Vercel
In Vercel's deployment environment variables, add the `DATABASE_URL` and other environment variables. Fill in the prepared Postgres database connection URL. The typical format for the database connection URL is `postgres://username:password@host:port/database`.
<Callout type={'warning'}>
Confirm the type of `Postgres` your provider offers. If it's `Node Postgres`, you must add the environment variable `DATABASE_DRIVER=node`.
To connect to the database using SSL, please refer to this [link](https://stackoverflow.com/questions/14021998/using-psql-to-connect-to-postgresql-in-ssl-mode) for instructions on how to configure it.
</Callout>
### Add the `KEY_VAULTS_SECRET` Environment Variable
After adding the `DATABASE_URL` environment variable, you need to add a `KEY_VAULTS_SECRET` environment variable. This variable is used to encrypt sensitive information like user-stored API keys. You can generate a random 32-character string as the key using `openssl rand -base64 32`.
Add this to the Vercel environment variables as well.
</Steps>
## 2. Configure the Identity Authentication Service
A server-side database needs to be paired with an identity authentication service to function properly. Therefore, the corresponding identity authentication service needs to be configured.
<Callout type={'warning'}>
Due to workload constraints, currently only Clerk is supported as an identity authentication
service solution. Integration with Next-Auth for server-side database is under development.
</Callout>
<Steps>
### Prepare the Clerk Identity 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.
<Callout type={'info'}>
If you are unfamiliar with Clerk, you can refer to [Authentication
Service-Clerk](/en/docs/self-hosting/advanced/authentication#clerk) for details on using Clerk.
</Callout>
### Add Public and Private Key Environment Variables in Vercel
In Vercel's deployment environment variables, add the `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` environment variables. You can click on "API Keys" in the menu, then copy the corresponding values and paste them into Vercel's environment variables.
<Image
alt={'Find the corresponding public and private key environment variables in Clerk'}
Since we let Clerk handle user authentication and management entirely, we need Clerk to notify our application and store data in the database when there are changes in the user lifecycle (create, update, delete). We achieve this 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 status changes.
Fill in your Vercel project's URL in the endpoint, such as `https://your-project.vercel.app/api/webhooks/clerk`. Then, in the Subscribe to events section, check the three user events (`user.created`, `user.deleted`, `user.updated`), and click create.
<Callout type={'warning'}>Ensure that the URL includes the `https://` prefix. Maintaining the integrity of the URL is crucial.</Callout>
<Image
alt={'Configure URL and user events when adding Clerk Webhooks'}
You have now successfully configured the Clerk identity authentication service. Next, we will configure the S3 storage service.
## 3. Configure S3 Storage Service
LobeChat has long supported multimodal AI conversations, involving the function of uploading images to AI. In the client-side database solution, image files are stored as binary data in the browser's indexedDB database. However, this solution is not feasible in the server-side database. We need to configure the S3 storage service to store a large number of image files, and S3 can also serve as a storage solution for file uploads.
<Callout type={'info'}>
In this article, S3 refers to a compatible S3 storage solution, which supports object storage
systems that comply with the Amazon S3 API. Common examples include Cloudflare R2 etc., all of
which support S3-compatible APIs.
</Callout>
<Steps>
### 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. Below is an example of the creation process using Cloudflare R2.
# Bucket request endpoint(note that the path of this link contains the bucket name, you must remove the path, or use the link provided on the "Apply for S3 API Token" page)
<Callout type={'warning'}>The path must be removed from the `S3_ENDPOINT`, otherwise, uploaded files will be inaccessible.</Callout>
### 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:
Since our server-side database needs to read and write to the S3 storage service, the permission needs to be set to `Administrator Read and Write`. Then, click Create.
<Callout type={'warning'}>The permission must be set to `Administrator Read and Write`, otherwise, uploading photos and other files will not be possible.</Callout>
### Add the Corresponding Environment Variables in Vercel
The steps to obtain the required environment variables may vary for different S3 service providers, but the obtained environment variables should be consistent in the end:
<Callout type={'warning'}>Ensure that the `S3_ENDPOINT` includes the `https://` prefix. Maintaining the integrity of the URL is crucial.</Callout>
After completing the above steps, the configuration of the server database should be done. Next, we can deploy LobeChat to Vercel and then visit your Vercel link to verify if the server database is working correctly.
<Steps>
### Redeploy the latest commit
After configuring the environment variables, you need to redeploy the latest commit and wait for the deployment to complete.
If you click on the login button in the top left corner and the login popup appears normally, then you have configured it successfully. Enjoy using it\~
@@ -76,9 +76,8 @@ When deploying LobeChat, you need to configure the following environment variabl
| Environment Variable | Type | Description |
| --- | --- | --- |
| `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
| `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `SSO_PROVIDERS` | Optional | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. |
| `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` | Optional | Select the single sign-on provider for LoboChat. Use `auth0` for Auth0. |
| `AUTH0_CLIENT_ID` | Required | Client ID of the Auth0 application |
| `AUTH0_CLIENT_SECRET` | Required | Client Secret of the Auth0 application |
| `AUTH0_ISSUER` | Required | Domain of the Auth0 application, `https://example.auth0.com` |
@@ -54,9 +54,8 @@ When deploying LobeChat, you need to configure the following environment variabl
| Environment Variable | Type | Description |
| --- | --- | --- |
| `ENABLE_OAUTH_SSO` | Required | Enable Single Sign-On (SSO) for LobeChat. Set to `1` to enable SSO. |
| `NEXTAUTH_SECRET` | Required | The secret used to encrypt Auth.js session tokens. You can generate a secret using the following command: `openssl rand -base64 32` |
| `SSO_PROVIDERS` | Required | Select the SSO provider for LoboChat. Use `authentik` for Authentik. |
| `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. |
| `AUTHENTIK_CLIENT_ID` | Required | The Client ID from the Authentik application provider details page |
| `AUTHENTIK_CLIENT_SECRET` | Required | The Client Secret from the Authentik application provider details page |
| `AUTHENTIK_ISSUER` | Required | The OpenID Configuration Issuer from the Authentik application provider details page |
@@ -71,9 +71,8 @@ When deploying LobeChat, you need to configure the following environment variabl
| Environment Variable | Type | Description |
| --- | --- | --- |
| `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
| `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate the key using the following command: `openssl rand -base64 32` |
| `SSO_PROVIDERS` | Required | Select the single sign-on provider for LoboChat. Use `azure-ad` for Microsoft Entra ID. |
| `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 `azure-ad` for Microsoft Entra ID. |
| `AZURE_AD_CLIENT_ID` | Required | Client ID of the Microsoft Entra ID application. |
| `AZURE_AD_CLIENT_SECRET` | Required | Client Secret of the Microsoft Entra ID application. |
| `AZURE_AD_TENANT_ID` | Required | Tenant ID of the Microsoft Entra ID application. |
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"
@@ -99,9 +99,8 @@ When deploying LobeChat, you need to configure the following environment variabl
| Environment Variable | Type | Description |
| --- | --- | --- |
| `ENABLE_OAUTH_SSO` | Required | Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on. |
| `NEXTAUTH_SECRET` | Required | Key used to encrypt Auth.js session tokens. You can generate a key using the following command: `openssl rand -base64 32` |
| `SSO_PROVIDERS` | Optional | Select the single sign-on provider for LoboChat. Use `zitadel` for ZITADEL. |
| `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` | Optional | Select the single sign-on provider for LoboChat. Use `zitadel` for ZITADEL. |
| `ZITADEL_CLIENT_ID` | Required | Client ID (`ClientId` as shown in ZITADEL) of the ZITADEL application |
| `ZITADEL_CLIENT_SECRET` | Required | Client Secret (`ClientSecret` as shown in ZITADEL) of the ZITADEL application |
| `ZITADEL_ISSUER` | Required | Issuer URL of the ZITADEL application |
WebRTC (Web Real-Time Communication) is a technology that enables peer-to-peer communication between browsers. In LobeChat, we experimentally implemented real-time data synchronization between devices based on WebRTC and YJS, without relying on traditional server databases. This solution offers high privacy, zero conflicts, and provides a real-time session synchronization experience.
## Configuring WebRTC for Synchronization
To use the WebRTC synchronization feature in LobeChat, you need to complete the following steps:
<Steps>
### Deploy Signaling Server
Deploy a WebRTC signaling server with one click using the Zeabur platform:
[](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.
After deployment, you will receive a URL, for example: `https://my-signaling-server.zeabur.app`.
### 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`.
### Configure WebRTC Sync Settings in LobeChat
1. Open LobeChat settings -> Data Sync
2. Enter the signaling server address in the WebRTC sync section;
### 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
Although WebRTC has the advantages of no database and flexibility, after extensive community testing, the following limitations and known issues have been identified:
### Requirement for Devices to be Online Simultaneously
WebRTC requires devices to be online simultaneously to synchronize, meaning changes cannot be made on one device while offline and then synced later on another device.
This limitation is due to the communication nature of WebRTC. In a pure frontend, serverless scenario, data synchronization between two devices can only be achieved through peer-to-peer communication. When one device is online and the other is offline, it is impossible to determine where the data should come from. Only when both devices are online can data communication occur. This mode is more like an online chat room where everyone needs to be online to see each other's data and achieve synchronization.
Therefore, in certain situations, WebRTC's pure peer-to-peer approach may not fully meet users' needs (e.g., one device is a work computer, and the other is a home computer), and there are also some issues with data synchronization.
### Network Issues Leading to Sync Failures
Due to the implementation mechanism of WebRTC, its peer-to-peer communication has strict network requirements. Many of our users have reported:
- Syncing between PCs is possible, but syncing between a mobile device with a SIM card and a PC is not, although syncing is possible when using the same WIFI as the PC;
- Syncing fails when switching networks.
### Stability and Performance Issues
- Some users have reported ICE connection failures on the Firefox browser: [WebRTC Data Sync Feedback](https://github.com/lobehub/lobe-chat/issues/1683#issuecomment-2094745907)
- For extremely long text or large amounts of conversation records, the synchronization process may slow down or become unstable: [When the model outputs a very long conversation, the end of the conversation will contain synchronization-related content tags, leading to sync failures](https://github.com/lobehub/lobe-chat/issues/1962)
## Our Recommendations
Considering the above reasons, we recommend users treat the WebRTC sync feature as experimental and regularly back up important data.
We have already released a more stable and user-friendly server database synchronization solution ([deployment guide](/docs/self-hosting/advanced/server-database)). We recommend users prioritize using the server database synchronization solution.
<Callout type={'warning'}>
Please note that we have officially announced the archiving of this sync feature in [PR
3182](https://github.com/lobehub/lobe-chat/pull/3182), and the above issues will no longer be
services in LobeChat, including OAuth SSO, NextAuth settings, and
provider-specific details.
tags:
- LobeChat
- Authentication Service
- Environment Variables
- OAuth SSO
- Clerk
- NextAuth
- Provider Details
---
## Authentication Service
# Authentication Service
LobeChat provides a complete authentication service capability when deployed. The following are the relevant environment variables. You can use these environment variables to easily define the identity verification services that need to be enabled in LobeChat.
## General Settings
## Next Auth
### `ENABLE_OAUTH_SSO`
### General Settings
- Type: Required
- Description: Enable single sign-on (SSO) for LobeChat. Set to `1` to enable single sign-on.
- Default: `-`
- Example: `1`
### `SSO_PROVIDERS`
- Type: Required
- Description: Select the single sign-on provider for LoboChat. For multiple SSO Providers separating them with commas, for example, `auth0,azure-ad,authentik`.
- Default: `auth0`
- Example: `auth0,azure-ad,authentik`
### `NEXTAUTH_SECRET`
#### `NEXT_AUTH_SECRET`
- Type: Required
- Description: Key used to encrypt the session tokens in Auth.js. You can generate the key using the following command: `openssl rand -base64 32`.
- Description: Select the single sign-on provider for LoboChat. For multiple SSO Providers separating them with commas, for example, `auth0,azure-ad,authentik`.
- Default: `auth0`
- Example: `auth0,azure-ad,authentik`
#### `NEXTAUTH_URL`
- Type: Optional
- Description: This URL is used to specify the callback address for Auth.js during OAuth authentication. It does not need to be set when deploying on Vercel.
- Default: `-`
- Example: `https://example.com/api/auth`
## Auth0
### Auth0
### `AUTH0_CLIENT_ID`
#### `AUTH0_CLIENT_ID`
- Type: Required
- Description: Client ID of the Auth0 application. You can access it [here](https://manage.auth0.com/dashboard) and navigate to the application settings to view.
- Default: `-`
- Example: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
### `AUTH0_CLIENT_SECRET`
#### `AUTH0_CLIENT_SECRET`
- Type: Required
- Description: Client Secret of the Auth0 application.
- Description: Tenant ID of the Microsoft Entra ID application.
- Default: `-`
- Example: `c8ae2f36-edf6-4cda-96b9-d3e198a47cba`
## Authentik
### Authentik
### `AUTHENTIK_CLIENT_ID`
#### `AUTHENTIK_CLIENT_ID`
- Type: Required
- Description: Client ID of the Authentik provider application. You can access it [here][auth0-client-page] and navigate to the application settings to view.
- Default: `-`
- Example: `evCnOJP1UX8FMnXR9Xkj5t0NyFn5p70P`
### `AUTHENTIK_CLIENT_SECRET`
#### `AUTHENTIK_CLIENT_SECRET`
- Type: Required
- Description: Client Secret of the Authentik provider application.
- Description: Client ID of the Github application. You can access it [here](https://github.com/settings/apps) and navigate to the application settings to view.
- Default: `-`
- Example: `abd94200333283550508`
### `GITHUB_CLIENT_SECRET`
#### `GITHUB_CLIENT_SECRET`
- Type: Required
- Description: Client Secret of the Github application.
- Description: Issuer of the ZITADEL application. This is usually the URL of the ZITADEL instance, and can be found in `URLs` tab of your application in the console.
@@ -160,3 +153,19 @@ LobeChat provides a complete authentication service capability when deployed. Th
providers, you can submit a [feature
request](https://github.com/lobehub/lobe-chat/issues/new/choose) or Pull Request.
</Callout>
## Clerk
### `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY`
- Type: Required
- Description: Publishable key of the Clerk application. You can access it [here](https://dashboard.clerk.com) and navigate to the API Keys to view.
- Default: `-`
- Example: `pk_test_Zmxvd4luZy1wdW1hLTIyLmNsXXJrTmFjY291bnRzLmRldiQ` in dev / `pk_live_Y2xlcdsubG9iZWh1Yi1cbmMuY24k` in production
### `CLERK_SECRET_KEY`
- Type: Required
- Description: Secret key of the Clerk application.
- Default: `-`
- Example: `sk_test_513Ma0P7IAWM1XMv4waxZjRYRajWTaCfJLjpEO3SD2` in dev / `sk_live_eMMlHjwJvZFUfczFljSKqZdwQtLvmczmsJSNmdrpeZ` in production
@@ -36,14 +36,7 @@ LobeChat provides some additional configuration options during deployment, which
When using the `random` mode, a random API Key will be selected from the available multiple API Keys.
When using the `turn` mode, the API Keys will be retrieved in a round-robin manner according to the specified order.
### `ENABLE_OAUTH_SSO`
- Type: Optional
- Description: Enable Single Sign-On (SSO) for LobeChat. Set to `1` to enable SSO. For more information, see [Authentication Services](#authentication-services).
- Default: -
- Example: `1`
When using the `turn` mode, the API Keys will be retrieved in a polling manner according to the specified order.
### `NEXT_PUBLIC_BASE_PATH`
@@ -57,7 +50,7 @@ When using the `turn` mode, the API Keys will be retrieved in a round-robin mann
- Type: Optional
- Description: 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 `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:
@@ -68,8 +61,8 @@ The `DEFAULT_AGENT_CONFIG` is used to configure the default settings for the Lob
| 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` | Set the maximum tokens to `300`. |
| 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`. |
- Description: Used to control LobeChat's feature functionalities. Supports multiple feature flags, using `+` to add a feature and `-` to disable a feature. Separate multiple feature flags with a comma `,` and enclose the entire value in quotes `"` to avoid parsing errors.
- Default: `-`
- Example: `"-welcome_suggest"`
For specific content, please refer to the [Feature Flags](/docs/self-hosting/advanced/feature-flags) documentation.
| `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
@@ -64,10 +64,10 @@ If Ollama is run as a macOS application, environment variables should be set usi
1. For each environment variable, call `launchctl setenv`.
```bash
launchctl setenv OLLAMA_HOST "0.0.0.0"
launchctl setenv OLLAMA_ORIGINS "*"
```
```bash
launchctl setenv OLLAMA_HOST "0.0.0.0"
launchctl setenv OLLAMA_ORIGINS "*"
```
2. Restart Ollama application.
@@ -77,25 +77,25 @@ If Ollama is run as a systemd service, environment variables should be set using
1. Edit the systemd service by calling `sudo systemctl edit ollama.service`.
```bash
sudo systemctl edit ollama.service
```
```bash
sudo systemctl edit ollama.service
```
2. For each environment variable, add a line `Environment` under section `[Service]`:
- Replace `sk-xxxx` in the above command with your OpenAI API Key.
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-ariable) section.
- For the complete list of environment variables supported by LobeChat, please refer to the [Environment Variables](/docs/self-hosting/environment-variables) section.
<Callout type="tip">
Since the official Docker image build takes about half an hour, if you see the "update available"
@@ -41,6 +41,6 @@ Vercel's assigned domain DNS may be polluted in some regions, so binding a custo
If you have deployed your project using the one-click deployment steps mentioned above, you may find that you are always prompted with "updates available." This is because Vercel creates a new project for you by default instead of forking this project, which causes the inability to accurately detect updates.
<Callout>
We recommend following the [Self-Hosting Upstream Sync](/docs/self-hosting/advanced/upstream-sync) steps to
Redeploy.
We recommend following the [Self-Hosting Upstream Sync](/docs/self-hosting/advanced/upstream-sync)
# Deploy LobeChat with Zeabur as serverless function
> Note: There are still issues with [middlewares and rewrites of next.js on Zeabur](https://github.com/lobehub/lobe-chat/pull/2775?notification_referrer_id=NT_kwDOAdi2DrQxMDkyODQ4MDc2NTozMDk3OTU5OA#issuecomment-2146713899), use at your own risk!
Since Zeabur does NOT officially support FREE users deploy containerized service, you may wish to deploy LobeChat as a serverless function service. To deploy LobeChat as a serverless function service on Zeabur, you can follow the steps below:
## Zeabur Deployment Process
<Steps>
### Fork LobeChat
### Add Zeabur pack config file
Add a `zbpack.json` configuration file with the following content to the root dir of your fork:
```json
{
"ignore_dockerfile": true,
"serverless": true
}
```
### Prepare your OpenAI API Key
Go to [OpenAI API Key](https://platform.openai.com/account/api-keys) to get your OpenAI API Key.
### Login to your [Zeabur dashboard](https://dash.zeabur.com)
If you do not already have an account, you will need to register one.
### Create a project and service
Create a project, then create a service under this project.
### Link your fork of LobeChat to the just created Zeabur service.
When adding service, choose github. This may triger a oAuth depend on varies factors like how you login to Zeabur and if you have already authorized Zeabur to access all your repos
### Bind a custom domain (optional)
You can create a subdomain provided by Zeabur, or choose to bind a custom domain. Currently, the domains provided by Zeabur have not been contaminated, and most regions can connect directly.
### Zeabur shall start auto build and you should be able to access it by the domain of your choice after a while.
LobeChat provides a rich variety of AI assistant resources. Users can easily add various assistants through the assistant market, offering a wide range of application scenarios for AI applications.
When you have added a large number of assistants, finding a specific assistant in the list may become challenging. LobeChat provides `search`, `grouping`, and `pinning` functions to help you better organize assistants and improve efficiency in locating them.
## Assistant Grouping
Firstly, LobeChat's AI assistants support organization through grouping. You can categorize assistants of the same type together and easily search for the required assistants by collapsing and expanding groups.
@@ -57,7 +57,7 @@ The second prompt generates longer output and better structure. The use of the t
- **Be Clear About Your Needs:** The model's output will strive to meet your needs, so if your needs are not clear, the output may not meet expectations.
- **Use Correct Grammar and Spelling:** The model will try to mimic your language style, so if your language style is problematic, the output may also be problematic.
- **Provide Sufficient Contextual Information:** The model will generate output based on the contextual information you provide, so if the information is insufficient, it may not produce the desired results.
</Callout>
After formulating effective prompts for discussing issues, you now need to refine the generated results. This may involve adjusting the output to fit constraints such as word count or combining concepts from different generated results.
In modern applications, user management and identity verification are essential functions. To meet the diverse needs of different users, LobeChat provides two main user authentication and management solutions: `next-auth` and `Clerk`. Whether you are looking for simple user registration and login or need advanced multi-factor authentication and user management, LobeChat can flexibly accommodate your requirements.
## next-auth: Flexible and Powerful Identity Verification Library
LobeChat integrates `next-auth`, a flexible and powerful identity verification library that supports various authentication methods, including OAuth, email login, and credential login. With `next-auth`, you can easily achieve the following functions:
- **User Registration and Login**: Support various authentication methods to meet different user needs.
- **Session Management**: Efficiently manage user sessions to ensure security.
- **Social Login**: Support quick login via various social platforms.
- **Data Security**: Ensure the security and privacy of user data.
<Callout type={'warning'}>
Due to workload constraints, integration of next-auth with a server-side database has not been
implemented yet. If you need to use a server-side database, please use Clerk.
</Callout>
<Callout type={'info'}>
For information on using Next-Auth, you can refer to [Authentication Services - Next
For users requiring advanced user management features, LobeChat also supports [Clerk](https://clerk.com), a modern user management platform. Clerk offers richer functionality to help you achieve higher security and flexibility:
In modern application development, the choice of data storage solution is crucial. To meet the needs of different users, LobeChat offers flexible configurations that support both local and server-side databases. Whether you prioritize data privacy and control or seek a convenient user experience, LobeChat can provide excellent solutions for you.
## Local Database: Data Control and Privacy Protection
For users who prefer more control over their data and value privacy protection, LobeChat offers support for local databases. By using IndexedDB as the storage solution and combining it with dexie as an Object-Relational Mapping (ORM) tool, LobeChat achieves efficient data management.
Additionally, we have introduced Conflict-Free Replicated Data Type (CRDT) technology to ensure a seamless multi-device synchronization experience. This experimental feature aims to provide users with greater autonomy and data security.
<Callout type={'info'}>
LobeChat defaults to the local database solution to reduce the onboarding cost for new users.
</Callout>
Furthermore, we have attempted to introduce CRDT technology to achieve cross-device synchronization based on the local database. This experimental feature aims to provide users with greater autonomy and data security.
## Server-Side Database: Convenient and Efficient User Experience
For users who seek a convenient user experience, LobeChat supports PostgreSQL as the server-side database. By managing data with Dirzzle ORM and combining it with Clerk for authentication, LobeChat can offer users an efficient and reliable server-side data management solution.
### Server-Side Database Technology Stack
- **DB**: PostgreSQL (Neon is the default)
- **ORM**: Dirzzle ORM
- **Auth**: Clerk
- **Server Router**: tRPC
## Deployment Solution Selection Guide
### 1. Local Database
The local database solution is suitable for users who wish to have strict control over their data. With LobeChat's support for local databases, you can securely store and manage data without relying on external servers. This solution is particularly suitable for users with high requirements for data privacy.
### 2. Server-Side Database
The server-side database solution is ideal for users who want to simplify data management processes and enjoy a convenient user experience. Through server-side databases and user authentication, LobeChat can ensure the security and efficiency of data. If you want to learn how to configure a server-side database, please refer to our [detailed documentation](/docs/self-hosting/advanced/server-database).
Whether you choose a local database or a server-side database, LobeChat can provide you with an excellent user experience.
@@ -49,3 +49,8 @@ Compared to cloud-based solutions, a local LLM provides higher privacy and secur
### Embark on Your LobeChat & Ollama AI Journey
Now, let's embark on this exciting journey together! Through the collaboration of LobeChat and Ollama AI, explore the endless possibilities brought by AI. Whether you are a tech enthusiast or simply curious about AI communication, LobeChat will offer you an unprecedented experience.
<Cards>
<Card href={'/docs/usage/providers'} title={'Using Multiple Model Providers'} />
<Card href={'/docs/usage/providers/ollama'} title={'Using Ollama Local Model'} />
@@ -45,6 +45,8 @@ We have implemented support for the following model service providers:
- **01.AI (Yi Model)**: Integrated the 01.AI models, with series of APIs featuring fast inference speed, which not only shortened the processing time, but also maintained excellent model performance. [Learn more](https://01.ai/)
- **Together.ai**: Over 100 leading open-source Chat, Language, Image, Code, and Embedding models are available through the Together Inference API. For these models you pay just for what you use. [Learn more](https://www.together.ai/)
- **Minimax**: Integrated the Minimax models, including the MoE model **abab6**, offers a broader range of choices. [Learn more](https://www.minimaxi.com/)
- **DeepSeek**: Integrated with the DeepSeek series models, an innovative AI startup from China, The product has been designed to provide a model that balances performance with price. [Learn more](https://www.deepseek.com/)
- **Qwen**: Integrated with the Qwen series models, including the latest **qwen-turbo**, **qwen-plus** and **qwen-max**. [Learn more](https://help.aliyun.com/zh/dashscope/developer-reference/model-introduction)
At the same time, we are also planning to support more model service providers, such as Replicate and Perplexity, to further enrich our service provider library. If you would like LobeChat to support your favorite service provider, feel free to join our [community discussion](https://github.com/lobehub/lobe-chat/discussions/1284).
@@ -57,3 +59,8 @@ At the same time, we are also planning to support more model service providers,
/>
To meet the specific needs of users, LobeChat also supports the use of local models based on [Ollama](https://ollama.ai), allowing users to flexibly use their own or third-party models. For more details, see [Local Model Support](/docs/usage/features/local-llm).
<Cards>
<Card href={'/docs/usage/providers'} title={'Using Multiple Model Providers'} />
<Card href={'/docs/usage/providers/ollama'} title={'Using Ollama Local Model'} />
@@ -28,7 +28,8 @@ If you are unfamiliar with the installation process of PWA, you can follow the s
## Running on Chrome / Edge
<Callout type={'important'}>
On macOS, when using a Chrome-installed PWA, it is required that Chrome be open, otherwise Chrome will automatically open and then launch the PWA app.
On macOS, when using a Chrome-installed PWA, it is required that Chrome be open, otherwise Chrome
will automatically open and then launch the PWA app.
</Callout>
<Steps>
@@ -62,7 +63,7 @@ Safari PWA requires macOS Ventura or later. The PWA installed by Safari does not
</Steps>
<Callout type={'tip'}>
The default installed LobeChat PWA icon has a black background, you can use <kbd>cmd</kbd> + <kbd>i</kbd> to paste the following image to replace it with a white background.
The default installed LobeChat PWA icon has a black background, you can use <kbd>cmd</kbd> + <kbd>i</kbd> to paste the following image to replace it with a white background.
In general, the basic interaction with Large Language Models (LLMs) can be done through the fundamental functions provided in this area (as shown above).
1. **Model Selection**: Choose the Large Language Model (LLM) to be used in the current conversation. For model settings, refer to [Model Providers](https://lobehub.com/docs/usage/providers).
2. **File/Image Upload**: When the selected model supports file or image recognition, users can upload files or images during the conversation with the model.
3. **Temperature Setting**: Adjust the randomness level of the model's output. The higher the value, the more random the output results. For detailed information, refer to the [Large Language Model Guide](https://lobehub.com/docs/usage/agents/model).
4. **History Record Setting**: Set the number of chat records the model needs to remember in this conversation. The longer the history, the more conversation content the model can remember, but it will also consume more context tokens.
5. **Voice Input**: Click this button to convert speech to text input. For more information, refer to [Speech-to-Text Conversion](https://lobehub.com/docs/usage/foundation/tts-stt).
6. **Plugin Setting**: Choose the plugins to enable in this conversation. For more information, refer to [Plugin Usage](https://lobehub.com/docs/usage/plugins/basic-usage).
7. **Token Usage**: Display the context length and token consumption of this conversation.
8. **Start New Topic**: End the current conversation and start a new topic. For more information, refer to [Topic Usage](https://lobehub.com/docs/usage/agents/topics).
9. **Send Button**: Send the current input content to the model. The dropdown menu provides additional send operation options.
By clicking the `Share` button in the top right corner of the chat window, you can share the current conversation records with others. LobeChat supports two sharing methods: `Screenshot Sharing` and `ShareGPT Sharing`.
[ShareGPT](https://sharegpt.com/) is an AI conversation sharing platform that allows users to easily share their conversations with Large Language Models (LLMs). Users can generate a permanent link with just one click, making it convenient to share these conversations with friends or others. By integrating ShareGPT functionality, LobeChat can generate links for conversation records with just one click, making sharing easy.
title: Guide to Using Text-to-Image Models in LobeChat
description: >-
Learn how to utilize text-to-image generation in LobeChat using DALL-E and
Midjourney plugins. Generate images seamlessly with AI assistance.
tags:
- Text-to-Image Models
- LobeChat
- DALL-E
- Midjourney
- Plugin Installation
- AI Assistance
---
# Guide to Using Text-to-Image Models in LobeChat
LobeChat supports text-to-image generation through a plugin mechanism. Currently, LobeChat comes with the built-in DALL-E plugin, which allows users to generate images using OpenAI's DALL-E model. Additionally, users can also install the official Midjourney plugin to utilize the Midjourney text-to-image feature.
## DALL-E Model
If you have configured the OpenAI API, you can enable the DALL-E plugin directly in the assistant interface and input prompts in the conversation for AI to generate images for you.
If the DALL-E plugin is not available, please check if the OpenAI API key has been correctly configured.
## Midjourney Model
LobeChat also offers the Midjourney plugin, which generates images by calling the Midjourney API. Please install the Midjourney plugin in the plugin store beforehand.
LobeChat supports users to translate conversation content into a specified language with just one click. After selecting the target language, LobeChat will use a pre-set AI model for translation and display the translated results in real-time in the chat window.
Select the voice input feature in the input window, and LobeChat will convert your speech to text and input it into the text box. After completing the input, you can send it directly to the AI.
title: Enhancing Multimodal Interaction with Visual Recognition Models
description: >-
Explore how LobeChat integrates visual recognition capabilities into large
language models, enabling multimodal interactions for enhanced user
experiences.
tags:
- Visual Recognition
- Multimodal Interaction
- Large Language Models
- LobeChat
- Custom Model Configuration
---
# Visual Model User Guide
The ecosystem of large language models that support visual recognition is becoming increasingly rich. Starting from `gpt-4-vision`, LobeChat now supports various large language models with visual recognition capabilities, enabling LobeChat to have multimodal interaction capabilities.
If the model you are currently using supports visual recognition, you can input image content by uploading a file or dragging the image directly into the input box. The model will automatically recognize the image content and provide feedback based on your prompts.
In the model list, models with a `👁️` icon next to their names indicate that the model supports visual recognition. Selecting such a model allows you to send image content.
If you need to add a custom model that is not currently in the list and explicitly supports visual recognition, you can enable the `Visual Recognition` feature in the `Custom Model Configuration` to allow the model to interact with images.
In the continuous development of LobeChat, we deeply understand the importance of diversity in model providers for providing AI conversation services to meet the needs of the community. Therefore, we have expanded our support to multiple model providers instead of being limited to a single one, in order to offer users a more diverse and rich selection of conversation options.
This approach allows LobeChat to adapt more flexibly to different user needs and provides developers with a wider range of choices.
[Zero One AI](https://www.01.ai/) is a global company dedicated to AI 2.0 large model technology and applications. Its billion-parameter Yi-Large closed-source model, when evaluated on Stanford University's English ranking AlpacaEval 2.0, is on par with GPT-4.
This document will guide you on how to use Zero One AI in LobeChat:
<Steps>
### Step 1: Obtain Zero One AI API Key
- Register and log in to the [Zero One AI Large Model Open Platform](https://platform.lingyiwanwu.com/)
- Go to the `Dashboard` and access the `API Key Management` menu
- A system-generated API key has been created for you automatically, or you can create a new one on this interface
The Anthropic Claude API is now available for everyone to use. This document will guide you on how to use [Anthropic Claude](https://www.anthropic.com/api) in LobeChat:
<Steps>
### Step 1: Obtain Anthropic Claude API Key
- Create an [Anthropic Claude API](https://www.anthropic.com/api) account.
- Get your [API key](https://console.anthropic.com/settings/keys).
The Claude API currently offers $5 of free credits, but it is only available in certain specific
countries/regions. You can go to Dashboard > Claim to see if it is applicable to your
country/region.
</Callout>
- Set up your billing for the API key to work on [https://console.anthropic.com/settings/plans](https://console.anthropic.com/settings/plans) (choose the "Build" plan so you can add credits and only pay for usage).
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.