Skip to content

Commit

Permalink
📝 docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
RubuJam committed May 27, 2024
1 parent 6e11b2e commit d1eedd6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions contributing/Basic/Feature-Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -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](#1-database-section)
2. [Service Implementation / Model Implementation](#2-model-and-service-section)
3. [Frontend Data Flow Store Implementation](#3-store-action-section)
4. [UI Implementation and Action Binding](#4-ui-section)
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.

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

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

## 2. Model and Service Section
## 2. Service Implementation / Model Implementation

### Define Model

Expand Down Expand Up @@ -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).

Expand Down Expand Up @@ -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.
## 4. UI Section
## 4. UI Implementation and Action Binding

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

Expand Down
16 changes: 8 additions & 8 deletions contributing/Basic/Feature-Development.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

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

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

## 一、数据库部分
## 一、数据模型 / 数据库定义

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

Expand Down Expand Up @@ -119,7 +119,7 @@ export class LocalDB extends Dexie {

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

## 二、Model 与 Service 部分
## 二、Service 实现 / Model 实现

### 定义 Model

Expand Down Expand Up @@ -176,7 +176,7 @@ class SessionService {
}
```

## 三、Store Action 部分
## 三、前端数据流 Store 实现

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion contributing/Basic/Intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bun run dev
```

> \[!IMPORTANT]\
> If you use `npm` to install dependencies, you should run `npm run stylelint-config-recommended@13.0.0` before committing your code, otherwise you will encounter the error `Could not find "stylelint-config-recommended"`.
> If you are using `npm` to install dependencies, please run `npm run stylelint-config-recommended@13.0.0` before committing your code to avoid the `Could not find "stylelint-config-recommended"` error.
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).

Expand Down
2 changes: 1 addition & 1 deletion contributing/Basic/Intro.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bun run dev
```

> \[!IMPORTANT]\
> 如果使用`npm`安装依赖,当你进行代码提交前,应先运行`npm run stylelint-config-recommended@13.0.0`否则会报错`Could not find "stylelint-config-recommended"`
> 如果使用`npm`安装依赖,请在提交代码前运行`npm run stylelint-config-recommended@13.0.0`这样可以避免出现`Could not find "stylelint-config-recommended"`错误
现在,你应该可以在浏览器中看到 LobeChat 的欢迎页面。详细的环境配置指南,请参考 [开发环境设置指南](Setup-Development.zh-CN.md)

Expand Down

0 comments on commit d1eedd6

Please sign in to comment.