Skip to content

Commit 729a977

Browse files
authored
📝 docs: update docs (lobehub#2669)
* 📝 docs: update docs * 📝 docs: update docs * 📝 docs: update docs
1 parent 65e3b80 commit 729a977

File tree

4 files changed

+105
-34
lines changed

4 files changed

+105
-34
lines changed

contributing/Basic/Feature-Development.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ This document aims to guide developers on how to develop a complete feature requ
44

55
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:
66

7-
1. Data Model / Database Definition
8-
2. Service Implementation / Model Implementation
9-
3. Frontend Data Flow Store Implementation
10-
4. UI Implementation and Action Binding
11-
5. Data Migration
12-
6. Data Import and Export
7+
1. [Data Model / Database Definition](#1-data-model--database-definition)
8+
2. [Service Implementation / Model Implementation](#2-service-implementation--model-implementation)
9+
3. [Frontend Data Flow Store Implementation](#3-frontend-data-flow-store-implementation)
10+
4. [UI Implementation and Action Binding](#4-ui-implementation-and-action-binding)
11+
5. [Data Migration](#5-data-migration)
12+
6. [Data Import and Export](#6-data-import-and-export)
1313

14-
## 1. Database Section
14+
## 1. Data Model / Database Definition
1515

1616
To implement the Session Group feature, it is necessary to define the relevant data model and indexes at the database level.
1717

@@ -119,7 +119,7 @@ As a result, you can now view the `sessionGroups` table in the `LOBE_CHAT_DB` in
119119

120120
![](https://github.com/lobehub/lobe-chat/assets/28616219/aea50f66-4060-4a32-88c8-b3c672d05be8)
121121

122-
## 2. Model and Service Section
122+
## 2. Service Implementation / Model Implementation
123123

124124
### Define Model
125125

@@ -176,7 +176,7 @@ class SessionService {
176176
}
177177
```
178178

179-
## 3. Store Action Section
179+
## 3. Frontend Data Flow Store Implementation
180180

181181
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).
182182

@@ -351,7 +351,7 @@ Since all data retrieval in the UI is implemented using syntax like `useSessionS
351351
>
352352
> 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.
353353
354-
## IV. UI Section
354+
## 4. UI Implementation and Action Binding
355355

356356
Bind Store Action in the UI component to implement interactive logic, for example `CreateGroupModal`:
357357

@@ -570,7 +570,7 @@ export class LocalDB extends Dexie {
570570

571571
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.
572572

573-
## VI. Data Import and Export
573+
## 6. Data Import and Export
574574

575575
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.
576576

contributing/Basic/Feature-Development.zh-CN.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
我们将以 sessionGroup 的实现为示例:[✨ feat: add session group manager](https://github.com/lobehub/lobe-chat/pull/1055) , 通过以下六个主要部分来阐述完整的实现流程:
66

7-
1. 数据模型 / 数据库定义
8-
2. Service 实现 / Model 实现
9-
3. 前端数据流 Store 实现
10-
4. UI 实现与 action 绑定
11-
5. 数据迁移
12-
6. 数据导入导出
7+
1. [数据模型 / 数据库定义](#一数据模型--数据库定义)
8+
2. [Service 实现 / Model 实现](#二service-实现--model-实现)
9+
3. [前端数据流 Store 实现](#三前端数据流-store-实现)
10+
4. [UI 实现与 action 绑定](#四ui-实现与-action-绑定)
11+
5. [数据迁移](#五数据迁移)
12+
6. [数据导入导出](#六数据导入导出)
1313

14-
## 一、数据库部分
14+
## 一、数据模型 / 数据库定义
1515

1616
为了实现 Session Group 功能,首先需要在数据库层面定义相关的数据模型和索引。
1717

@@ -119,7 +119,7 @@ export class LocalDB extends Dexie {
119119

120120
![](https://github.com/lobehub/lobe-chat/assets/28616219/aea50f66-4060-4a32-88c8-b3c672d05be8)
121121

122-
## 二、Model 与 Service 部分
122+
## 二、Service 实现 / Model 实现
123123

124124
### 定义 Model
125125

@@ -176,7 +176,7 @@ class SessionService {
176176
}
177177
```
178178

179-
## 三、Store Action 部分
179+
## 三、前端数据流 Store 实现
180180

181181
在 LobeChat 应用中,Store 是用于管理应用前端状态的模块。其中的 Action 是触发状态更新的函数,通常会调用服务层的方法来执行实际的数据处理操作,然后更新 Store 中的状态。我们采用了 `zustand` 作为 Store 模块的底层依赖,对于状态管理的详细实践介绍,可以查阅 [📘 状态管理最佳实践](../State-Management/State-Management-Intro.zh-CN.md)
182182

@@ -351,7 +351,7 @@ const customSessionGroups = (s: SessionStore): CustomSessionGroup[] => s.customS
351351
>
352352
> 如果你对 Selectors 的概念和功能不太了解,可以查阅 [📘 数据存储取数模块](../State-Management/State-Management-Selectors.zh-CN.md) 部分了解相关内容。
353353
354-
## 四、UI 部分
354+
## 四、UI 实现与 action 绑定
355355

356356
在 UI 组件中绑定 Store Action 实现交互逻辑,例如 `CreateGroupModal`
357357

contributing/Basic/Intro.md

+81-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
# Technical Development Getting Started Guide
22

3-
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.
3+
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.
44

55
#### TOC
66

77
- [Basic Technology Stack](#basic-technology-stack)
88
- [Folder Directory Structure](#folder-directory-structure)
9+
- [Local Development Environment Setup](#local-development-environment-setup)
10+
- [Code Style and Contribution Guide](#code-style-and-contribution-guide)
11+
- [Internationalization Implementation Guide](#internationalization-implementation-guide)
12+
- [Appendix: Resources and References](#appendix-resources-and-references)
913

1014
## Basic Technology Stack
1115

12-
The core technology stack of LobeChat includes:
16+
The core technology stack of LobeChat is as follows:
1317

14-
- **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.
15-
- **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.
16-
- **State Management**: We have opted for [zustand](https://github.com/pmndrs/zustand), a lightweight and easy-to-use state management library.
18+
- **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.
19+
- **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.
20+
- **State Management**: We selected [zustand](https://github.com/pmndrs/zustand), a lightweight and easy-to-use state management library.
1721
- **Network Requests**: We use [swr](https://swr.vercel.app/), a React Hooks library for data fetching.
18-
- **Routing**: For routing management, we directly use the solution provided by [Next.js](https://nextjs.org/) itself.
19-
- **Internationalization**: We use [i18next](https://www.i18next.com/) to implement multi-language support for the application.
22+
- **Routing**: For routing management, we directly use the solution provided by [Next.js](https://nextjs.org/).
23+
- **Internationalization**: We use [i18next](https://www.i18next.com/) to support multiple languages in the application.
2024
- **Styling**: We use [antd-style](https://github.com/ant-design/antd-style), a CSS-in-JS library that complements Ant Design.
2125
- **Unit Testing**: We use [vitest](https://github.com/vitest-dev/vitest) for unit testing.
2226

@@ -26,18 +30,82 @@ The folder directory structure of LobeChat is as follows:
2630

2731
```bash
2832
src
29-
├── app # Main logic of the application and code related to state management
33+
├── app # Code related to the main logic and state management of the application
3034
├── components # Reusable UI components
31-
├── config # Application configuration files, including client-side environment variables and server-side environment variables
35+
├── config # Application configuration files, including client and server environment variables
3236
├── const # Used to define constants, such as action types, route names, etc.
33-
├── features # Function modules related to business features, such as Agent settings, plugin development pop-ups, etc.
34-
├── hooks # Custom utility hooks reused throughout the application
37+
├── features # Business-related feature modules, such as Agent settings, plugin development pop-ups, etc.
38+
├── hooks # Custom utility Hooks reusable across the application
3539
├── layout # Application layout components, such as navigation bars, sidebars, etc.
3640
├── locales # Language files for internationalization
3741
├── services # Encapsulated backend service interfaces, such as HTTP requests
3842
├── store # Zustand store for state management
3943
├── types # TypeScript type definition files
40-
└── utils # Common utility functions
44+
└── utils # General utility functions
4145
```
4246

43-
For a detailed introduction to the directory structure, please refer to: [Folder Directory Structure](Folder-Structure.en-US.md)
47+
For a detailed introduction to the directory structure, see: [Folder Directory Structure](Folder-Structure.zh-CN.md)
48+
49+
## Local Development Environment Setup
50+
51+
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.
52+
53+
We recommend using WebStorm as your integrated development environment (IDE).
54+
55+
1. **Get the code**: Clone the LobeChat code repository locally:
56+
57+
```bash
58+
git clone https://github.com/lobehub/lobe-chat.git
59+
```
60+
61+
2. **Install dependencies**: Enter the project directory and install the required dependencies:
62+
63+
```bash
64+
cd lobe-chat
65+
# If you use Bun
66+
bun install
67+
# If you use PNPM
68+
pnpm install
69+
```
70+
71+
3. **Run and debug**: Start the local development server and begin your development journey:
72+
73+
```bash
74+
# Start the development server with Bun
75+
bun run dev
76+
# Visit http://localhost:3010 to view the application
77+
```
78+
79+
> \[!IMPORTANT]\
80+
> If you encounter the error "Could not find 'stylelint-config-recommended'" when installing dependencies with `npm`, please reinstall the dependencies using `pnpm` or `bun`.
81+
82+
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).
83+
84+
## Code Style and Contribution Guide
85+
86+
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.
87+
88+
- **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.
89+
- **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.
90+
91+
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.
92+
93+
For detailed code style and contribution guidelines, please refer to [Code Style and Contribution Guide](Contributing-Guidelines.zh-CN.md).
94+
95+
## Internationalization Implementation Guide
96+
97+
LobeChat uses `i18next` and `lobe-i18n` to implement multilingual support, ensuring a global user experience.
98+
99+
Internationalization files are located in `src/locales`, containing the default language (Chinese). We generate other language JSON files automatically through `lobe-i18n`.
100+
101+
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.
102+
103+
For a detailed guide on internationalization implementation, please refer to [Internationalization Implementation Guide](../Internationalization/Internationalization-Implementation.zh-CN.md).
104+
105+
## Appendix: Resources and References
106+
107+
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.
108+
109+
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.
110+
111+
If you have any questions or need further assistance, please do not hesitate to contact us through the above channels.

contributing/Basic/Intro.zh-CN.md

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ bun run dev
7676
# 访问 http://localhost:3010 查看应用
7777
```
7878

79+
> \[!IMPORTANT]\
80+
> 如果使用`npm`安装依赖出现`Could not find "stylelint-config-recommended"`错误,请使用 `pnpm` 或者 `bun` 重新安装依赖。
81+
7982
现在,你应该可以在浏览器中看到 LobeChat 的欢迎页面。详细的环境配置指南,请参考 [开发环境设置指南](Setup-Development.zh-CN.md)
8083

8184
## 代码风格与贡献指南

0 commit comments

Comments
 (0)