mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99b19d085f | |||
| 0a381e01ca | |||
| b7763987aa | |||
| 2d3cd503b1 | |||
| 1cb0a3d102 | |||
| 54cc813d8a | |||
| a1300aca51 | |||
| 317be3c5db | |||
| bae39f3c48 | |||
| 7f7c698ed2 | |||
| 1371b89f27 | |||
| c4ad0b3707 | |||
| ce19bc9b2a | |||
| b9d3f03bc0 | |||
| 1294c7d75e | |||
| dd3fb6d546 | |||
| e43afdf7a0 |
@@ -5,7 +5,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'docs/developer/database-schema.dbml'
|
||||
- 'docs/development/database-schema.dbml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
name: Wiki Sync
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'docs/wiki/**'
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
update-wiki:
|
||||
runs-on: ubuntu-latest
|
||||
name: Wiki sync
|
||||
steps:
|
||||
- uses: OrlovM/Wiki-Action@v1
|
||||
with:
|
||||
path: 'docs/wiki'
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
LobeChat uses [Auth.js v5](https://authjs.dev/) as the external authentication service. Auth.js is an open-source authentication library that provides a simple way to implement authentication and authorization features. This document will introduce how to use Auth.js to implement a new authentication provider.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Add New Authentication Provider](#add-new-authentication-provider)
|
||||
- [Pre-requisites: Check the Official Provider List](#pre-requisites-check-the-official-provider-list)
|
||||
- [Step 1: Add Authenticator Core Code](#step-1-add-authenticator-core-code)
|
||||
- [Step 2: Update Server Configuration Code](#step-2-update-server-configuration-code)
|
||||
- [Step 3: Change Frontend Pages](#step-3-change-frontend-pages)
|
||||
- [Step 4: Configure the Environment Variables](#step-4-configure-the-environment-variables)
|
||||
- [Step 5: Modify server-side user information processing logic](#step-5-modify-server-side-user-information-processing-logic)
|
||||
|
||||
## Add New Authentication Provider
|
||||
|
||||
To add a new authentication provider in LobeChat (for example, adding Okta), you need to follow the steps below:
|
||||
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
LobeChat 使用 [Auth.js v5](https://authjs.dev/) 作为外部身份验证服务。Auth.js 是一个开源的身份验证库,它提供了一种简单的方式来实现身份验证和授权功能。本文档将介绍如何使用 Auth.js 来实现新的身份验证方式。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [添加新的身份验证提供者](#添加新的身份验证提供者)
|
||||
- [准备工作:查阅官方的提供者列表](#准备工作查阅官方的提供者列表)
|
||||
- [步骤 1: 新增关键代码](#步骤-1-新增关键代码)
|
||||
- [步骤 2: 更新服务端配置代码](#步骤-2-更新服务端配置代码)
|
||||
- [步骤 3: 修改前端页面](#步骤-3-修改前端页面)
|
||||
- [步骤 4: 配置环境变量](#步骤-4-配置环境变量)
|
||||
- [步骤 5: 修改服务端用户信息处理逻辑](#步骤-5-修改服务端用户信息处理逻辑)
|
||||
|
||||
## 添加新的身份验证提供者
|
||||
|
||||
为了在 LobeChat 中添加新的身份验证提供者(例如添加 Okta),你需要完成以下步骤:
|
||||
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
LobeChat is an AI chat application built on the Next.js framework, aiming to provide an AI productivity platform that enables users to interact with AI through natural language. The following is an overview of the architecture design of LobeChat:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Application Architecture Overview](#application-architecture-overview)
|
||||
- [Frontend Architecture](#frontend-architecture)
|
||||
- [Edge Runtime API](#edge-runtime-api)
|
||||
- [Agents Market](#agents-market)
|
||||
- [Plugin Market](#plugin-market)
|
||||
- [Security and Performance Optimization](#security-and-performance-optimization)
|
||||
- [Development and Deployment Process](#development-and-deployment-process)
|
||||
|
||||
## Application Architecture Overview
|
||||
|
||||
The overall architecture of LobeChat consists of the frontend, EdgeRuntime API, Agents Market, Plugin Market, and independent plugins. These components collaborate to provide a complete AI experience.
|
||||
|
||||
@@ -2,16 +2,6 @@
|
||||
|
||||
LobeChat 是一个基于 Next.js 框架构建的 AI 聊天应用,旨在提供一个 AI 生产力平台,使用户能够与 AI 进行自然语言交互。以下是 LobeChat 的架构设计介稿:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [应用架构概览](#应用架构概览)
|
||||
- [前端架构](#前端架构)
|
||||
- [Edge Runtime API](#edge-runtime-api)
|
||||
- [Agents 市场](#agents-市场)
|
||||
- [插件市场](#插件市场)
|
||||
- [安全性和性能优化](#安全性和性能优化)
|
||||
- [开发和部署流程](#开发和部署流程)
|
||||
|
||||
## 应用架构概览
|
||||
|
||||
LobeChat 的整体架构由前端、EdgeRuntime API、Agents 市场、插件市场和独立插件组成。这些组件相互协作,以提供完整的 AI 体验。
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
|
||||
This document explains the implementation logic of Lobe Chat API in client-server interactions, including event sequences and core components involved.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Interaction Sequence Diagram](#interaction-sequence-diagram)
|
||||
- [Main Process Steps](#main-process-steps)
|
||||
- [AgentRuntime Overview](#agentruntime-overview)
|
||||
|
||||
## Interaction Sequence Diagram
|
||||
|
||||
```mermaid
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
|
||||
本文档说明了 Lobe Chat API 在前后端交互中的实现逻辑,包括事件序列和涉及的核心组件。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [交互时序图](#交互时序图)
|
||||
- [主要步骤说明](#主要步骤说明)
|
||||
- [AgentRuntime 说明](#agentruntime-说明)
|
||||
|
||||
## 交互时序图
|
||||
|
||||
```mermaid
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
|
||||
Welcome to the Code Style and Contribution Guidelines for LobeChat. This guide will help you understand our code standards and contribution process, ensuring code consistency and smooth project progression.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Code Style](#code-style)
|
||||
- [ESLint](#eslint)
|
||||
- [Prettier](#prettier)
|
||||
- [remarklint](#remarklint)
|
||||
- [stylelint](#stylelint)
|
||||
- [Style Checking](#style-checking)
|
||||
- [Contribution Process](#contribution-process)
|
||||
- [Gitmoji](#gitmoji)
|
||||
- [Semantic Release](#semantic-release)
|
||||
- [Commitlint](#commitlint)
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
|
||||
## Code Style
|
||||
|
||||
In LobeChat, we use the [@lobehub/lint](https://github.com/lobehub/lobe-lint) package to maintain a unified code style. This package incorporates configurations for `ESLint`, `Prettier`, `remarklint`, and `stylelint` to ensure that our JavaScript, Markdown, and CSS files adhere to the same coding standards.
|
||||
|
||||
@@ -2,20 +2,6 @@
|
||||
|
||||
欢迎来到 LobeChat 的代码风格与贡献指南。本指南将帮助您理解我们的代码规范和贡献流程,确保代码的一致性和项目的顺利进行。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [代码风格](#代码风格)
|
||||
- [ESLint](#eslint)
|
||||
- [Prettier](#prettier)
|
||||
- [remarklint](#remarklint)
|
||||
- [stylelint](#stylelint)
|
||||
- [风格检查](#风格检查)
|
||||
- [贡献流程](#贡献流程)
|
||||
- [Gitmoji](#gitmoji)
|
||||
- [Semantic Release](#semantic-release)
|
||||
- [Commitlint](#commitlint)
|
||||
- [如何贡献](#如何贡献)
|
||||
|
||||
## 代码风格
|
||||
|
||||
在 LobeChat 中,我们使用 [@lobehub/lint](https://github.com/lobehub/lobe-lint) 程序包来统一代码风格。该程序包内置了 `ESLint`、`Prettier`、`remarklint` 和 `stylelint` 的配置,以确保我们的 JavaScript、Markdown 和 CSS 文件遵循相同的编码标准。
|
||||
|
||||
@@ -10,14 +10,6 @@ LobeChat is built on the Next.js framework and uses TypeScript as the primary de
|
||||
|
||||
Taking the "Chat Messages" feature as an example, here are the brief steps to implement this feature:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [1. Define Routes](#1-define-routes)
|
||||
- [2. Define Data Structure](#2-define-data-structure)
|
||||
- [3. Create Zustand Store](#3-create-zustand-store)
|
||||
- [4. Create Page and Components](#4-create-page-and-components)
|
||||
- [5. Function Binding](#5-function-binding)
|
||||
|
||||
## 1. Define Routes
|
||||
|
||||
In the `src/app` directory, we need to define a new route to host the "Chat Messages" page. Generally, we would create a new folder under `src/app`, for example, `chat`, and create a `page.tsx` file within this folder to export a React component as the main body of the page.
|
||||
|
||||
@@ -10,14 +10,6 @@ LobeChat 基于 Next.js 框架构建,使用 TypeScript 作为主要开发语
|
||||
|
||||
我们以 "会话消息" 功能为例,以下是实现这个功能的简要步骤:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [1. 定义路由](#1-定义路由)
|
||||
- [2. 定义数据结构](#2-定义数据结构)
|
||||
- [3. 创建 Zustand Store](#3-创建-zustand-store)
|
||||
- [4. 创建页面与组件](#4-创建页面与组件)
|
||||
- [5. 功能绑定](#5-功能绑定)
|
||||
|
||||
## 1. 定义路由
|
||||
|
||||
在 `src/app` 目录下,我们需要定义一个新的路由来承载 "会话消息" 页面。一般来说,我们会在 `src/app` 下创建一个新的文件夹,例如 `chat`,并且在这个文件夹中创建 `page.tsx`文件,在该文件中导出 React 组件作为页面的主体。
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
|
||||
Welcome to the LobeChat development environment setup guide.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Online Development](#online-development)
|
||||
- [Local Development](#local-development)
|
||||
- [Development Environment Requirements](#development-environment-requirements)
|
||||
- [Project Setup](#project-setup)
|
||||
|
||||
## Online Development
|
||||
|
||||
If you have access to GitHub Codespaces, you can click the button below to enter the online development environment with just one click:
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
|
||||
欢迎阅读 LobeChat 的开发环境设置指南。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [在线开发](#在线开发)
|
||||
- [本地开发](#本地开发)
|
||||
- [开发环境需求](#开发环境需求)
|
||||
- [项目设置](#项目设置)
|
||||
|
||||
## 在线开发
|
||||
|
||||
如果你有 GitHub Codespaces 的使用权限,可以点击下方按钮一键进入在线开发环境:
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
LobeChat's testing strategy includes unit testing and end-to-end (E2E) testing. Below are detailed explanations of each type of testing:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Unit Testing](#unit-testing)
|
||||
- [🚧 End-to-End Testing](#-end-to-end-testing)
|
||||
- [Development Testing](#development-testing)
|
||||
- [1. Unit Testing](#1-unit-testing)
|
||||
- [Testing Strategy](#testing-strategy)
|
||||
|
||||
## Unit Testing
|
||||
|
||||
Unit testing is used to test the functionality of independent units in the application, such as components, functions, utility functions, etc. We use [vitest][vitest-url] for unit testing.
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
LobeChat 的测试策略包括单元测试和端到端 (E2E) 测试。下面是每种测试的详细说明:
|
||||
|
||||
#### TOC
|
||||
|
||||
- [单元测试](#单元测试)
|
||||
- [🚧 端到端测试](#-端到端测试)
|
||||
- [开发测试](#开发测试)
|
||||
- [1. 单元测试](#1-单元测试)
|
||||
- [测试策略](#测试策略)
|
||||
|
||||
## 单元测试
|
||||
|
||||
单元测试用于测试应用中的独立单元(如组件、函数、工具函数等)的功能。我们使用 [vitest][vitest-url] 进行单元测试。
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
LobeChat uses [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) as the i18n solution, which allows for quick addition of new language support in the application.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Adding New Language Support](#adding-new-language-support)
|
||||
- [Step 1: Update the Internationalization Configuration File](#step-1-update-the-internationalization-configuration-file)
|
||||
- [Step 2: Automatically Translate Language Files](#step-2-automatically-translate-language-files)
|
||||
- [Step 3: Submit and Review Your Changes](#step-3-submit-and-review-your-changes)
|
||||
- [Additional Information](#additional-information)
|
||||
|
||||
## Adding New Language Support
|
||||
|
||||
To add new language internationalization support in LobeChat (for example, adding Vietnamese `vi-VN`), please follow the steps below:
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
LobeChat 使用 [lobe-i18n](https://github.com/lobehub/lobe-cli-toolbox/tree/master/packages/lobe-i18n) 作为 i18n 解决方案,可以在应用中快速添加新的语言支持。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [添加新的语言支持](#添加新的语言支持)
|
||||
- [步骤 1: 更新国际化配置文件](#步骤-1-更新国际化配置文件)
|
||||
- [步骤 2: 自动翻译语言文件](#步骤-2-自动翻译语言文件)
|
||||
- [步骤 3: 提交和审查你的更改](#步骤-3-提交和审查你的更改)
|
||||
- [附加信息](#附加信息)
|
||||
|
||||
## 添加新的语言支持
|
||||
|
||||
为了在 LobeChat 中添加新的语言国际化支持,(例如添加越南语 `vi-VN`),请按照以下步骤操作:
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
Welcome to the LobeChat Internationalization Implementation Guide. This document will guide you through understanding the internationalization mechanism of LobeChat, including file structure and how to add new languages. LobeChat uses `i18next` and `lobe-i18n` as the internationalization solution, aiming to provide users with seamless multilingual support.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Internationalization Overview](#internationalization-overview)
|
||||
- [File Structure](#file-structure)
|
||||
- [Core Implementation Logic](#core-implementation-logic)
|
||||
- [Adding Support for New Languages](#adding-support-for-new-languages)
|
||||
- [Resources and Further Reading](#resources-and-further-reading)
|
||||
|
||||
## Internationalization Overview
|
||||
|
||||
Internationalization (i18n for short) is the process of enabling an application to adapt to different languages and regions. In LobeChat, we support multiple languages and achieve dynamic language switching and content localization through the `i18next` library. Our goal is to provide a localized experience for global users.
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
|
||||
欢迎阅读 LobeChat 国际化实现指南。本文档将指导你了解 LobeChat 的国际化机制,包括文件结构、如何添加新语种。LobeChat 采用 `i18next` 和 `lobe-i18n` 作为国际化解决方案,旨在为用户提供流畅的多语言支持。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [国际化概述](#国际化概述)
|
||||
- [文件结构](#文件结构)
|
||||
- [核心实现逻辑](#核心实现逻辑)
|
||||
- [添加新的语言支持](#添加新的语言支持)
|
||||
- [资源和进一步阅读](#资源和进一步阅读)
|
||||
|
||||
## 国际化概述
|
||||
|
||||
国际化(Internationalization,简称为 i18n)是一个让应用能够适应不同语言和地区的过程。在 LobeChat 中,我们支持多种语言,并通过 `i18next` 库来实现语言的动态切换和内容的本地化。我们的目标是让 LobeChat 能够为全球用户提供本地化的体验。
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# Lighthouse Reports
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Chat Page](#chat-page)
|
||||
- [Discover Page](#discover-page)
|
||||
|
||||
## Chat Page
|
||||
|
||||
> **Info**\
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# Lighthouse 测试报告
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Chat 聊天页面](#chat-聊天页面)
|
||||
- [Discover 发现页面](#discover-发现页面)
|
||||
|
||||
## Chat 聊天页面
|
||||
|
||||
> **Info**\
|
||||
|
||||
@@ -2,15 +2,6 @@
|
||||
|
||||
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.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Basic Technology Stack](#basic-technology-stack)
|
||||
- [Folder Directory Structure](#folder-directory-structure)
|
||||
- [Local Development Environment Setup](#local-development-environment-setup)
|
||||
- [Code Style and Contribution Guide](#code-style-and-contribution-guide)
|
||||
- [Internationalization Implementation Guide](#internationalization-implementation-guide)
|
||||
- [Appendix: Resources and References](#appendix-resources-and-references)
|
||||
|
||||
## Basic Technology Stack
|
||||
|
||||
The core technology stack of LobeChat is as follows:
|
||||
|
||||
@@ -2,15 +2,6 @@
|
||||
|
||||
欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [基础技术栈](#基础技术栈)
|
||||
- [文件夹目录架构](#文件夹目录架构)
|
||||
- [本地开发环境设置](#本地开发环境设置)
|
||||
- [代码风格与贡献指南](#代码风格与贡献指南)
|
||||
- [国际化实现指南](#国际化实现指南)
|
||||
- [附录:资源与参考](#附录资源与参考)
|
||||
|
||||
## 基础技术栈
|
||||
|
||||
LobeChat 的核心技术栈如下:
|
||||
|
||||
@@ -4,13 +4,6 @@
|
||||
|
||||
LobeChat differs from traditional CRUD web applications in that it involves a large amount of rich interactive capabilities. Therefore, it is crucial to design a data flow architecture that is easy to develop and maintain. This document will introduce the best practices for data flow management in LobeChat.
|
||||
|
||||
#### TOC
|
||||
|
||||
- [Key Concepts](#key-concepts)
|
||||
- [Hierarchical Structure](#hierarchical-structure)
|
||||
- [Best Practices for LobeChat SessionStore Directory Structure](#best-practices-for-lobechat-sessionstore-directory-structure)
|
||||
- [Implementation of SessionStore](#implementation-of-sessionstore)
|
||||
|
||||
## Key Concepts
|
||||
|
||||
| Concept | Explanation |
|
||||
|
||||
@@ -4,13 +4,6 @@
|
||||
|
||||
LobeChat 不同于传统 CRUD 的网页,存在大量的富交互能力,如何设计一个易于开发与易于维护的数据流架构非常重要。本篇文档将介绍 LobeChat 中的数据流管理最佳实践。
|
||||
|
||||
#### TOC
|
||||
|
||||
- [概念要素](#概念要素)
|
||||
- [结构分层](#结构分层)
|
||||
- [LobeChat SessionStore 目录结构最佳实践](#lobechat-sessionstore-目录结构最佳实践)
|
||||
- [SessionStore 的实现](#sessionstore-的实现)
|
||||
|
||||
## 概念要素
|
||||
|
||||
| 概念名词 | 解释 |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<div align="center">
|
||||
|
||||
<img height="120" src="https://registry.npmmirror.com/@lobehub/assets-logo/1.0.0/files/assets/logo-3d.webp">
|
||||
<img height="120" src="https://gw.alipayobjects.com/zos/kitchen/qJ3l3EPsdW/split.svg">
|
||||
<img height="120" src="https://registry.npmmirror.com/@lobehub/assets-emoji/1.3.0/files/assets/robot.webp">
|
||||
|
||||
</div>
|
||||
|
||||

|
||||
|
||||
We've moved the contributing wiki to [this page](https://lobehub.com/zh/docs/development/start).
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
"db:push": "drizzle-kit push",
|
||||
"db:push-test": "NODE_ENV=test drizzle-kit push",
|
||||
"db:studio": "drizzle-kit studio",
|
||||
"db:visualize": "dbdocs build docs/developer/database-schema.dbml --project lobe-chat",
|
||||
"db:visualize": "dbdocs build docs/development/database-schema.dbml --project lobe-chat",
|
||||
"db:z-pull": "drizzle-kit introspect",
|
||||
"dev": "next dev --turbopack -p 3010",
|
||||
"docs:i18n": "lobe-i18n md && npm run lint:md && npm run lint:mdx",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
||||
|
||||
import * as schema from '../../src/database/schemas';
|
||||
|
||||
const out = join(__dirname,'../../docs/developer/database-schema.dbml');
|
||||
const out = join(__dirname, '../../docs/development/database-schema.dbml');
|
||||
const relational = true;
|
||||
|
||||
pgGenerate({ out, relational, schema });
|
||||
|
||||
Reference in New Issue
Block a user