@lobehub/chat 1.78.0 → 1.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.github/workflows/sync-database-schema.yml +1 -1
  2. package/.github/workflows/wiki-sync.yml +2 -2
  3. package/CHANGELOG.md +25 -0
  4. package/changelog/v1.json +9 -0
  5. package/{contributing/Basic/Add-New-Authentication-Providers.md → docs/development/basic/add-new-authentication-providers.mdx} +0 -10
  6. package/{contributing/Basic/Add-New-Authentication-Providers.zh-CN.md → docs/development/basic/add-new-authentication-providers.zh-CN.mdx} +0 -10
  7. package/{contributing/Basic/Architecture.md → docs/development/basic/architecture.mdx} +0 -10
  8. package/{contributing/Basic/Architecture.zh-CN.md → docs/development/basic/architecture.zh-CN.mdx} +0 -10
  9. package/{contributing/Basic/Chat-API.md → docs/development/basic/chat-api.mdx} +6 -12
  10. package/{contributing/Basic/Chat-API.zh-CN.md → docs/development/basic/chat-api.zh-CN.mdx} +6 -12
  11. package/{contributing/Basic/Contributing-Guidelines.md → docs/development/basic/contributing-guidelines.mdx} +0 -14
  12. package/{contributing/Basic/Contributing-Guidelines.zh-CN.md → docs/development/basic/contributing-guidelines.zh-CN.mdx} +0 -14
  13. package/{contributing/Basic/Feature-Development-Frontend.md → docs/development/basic/feature-development-frontend.mdx} +0 -8
  14. package/{contributing/Basic/Feature-Development-Frontend.zh-CN.md → docs/development/basic/feature-development-frontend.zh-CN.mdx} +0 -8
  15. package/{contributing/Basic/Feature-Development.md → docs/development/basic/feature-development.mdx} +9 -10
  16. package/{contributing/Basic/Feature-Development.zh-CN.md → docs/development/basic/feature-development.zh-CN.mdx} +14 -15
  17. package/{contributing/Basic/Resources.md → docs/development/basic/resources.mdx} +0 -6
  18. package/{contributing/Basic/Resources.zh-CN.md → docs/development/basic/resources.zh-CN.mdx} +0 -6
  19. package/{contributing/Basic/Setup-Development.md → docs/development/basic/setup-development.mdx} +0 -7
  20. package/{contributing/Basic/Setup-Development.zh-CN.md → docs/development/basic/setup-development.zh-CN.mdx} +0 -7
  21. package/{contributing/Basic/Test.md → docs/development/basic/test.mdx} +3 -11
  22. package/{contributing/Basic/Test.zh-CN.md → docs/development/basic/test.zh-CN.mdx} +3 -11
  23. package/{contributing/Internationalization/Add-New-Locale.md → docs/development/internationalization/add-new-locale.mdx} +0 -8
  24. package/{contributing/Internationalization/Add-New-Locale.zh-CN.md → docs/development/internationalization/add-new-locale.zh-CN.mdx} +0 -8
  25. package/{contributing/Internationalization/Internationalization-Implementation.md → docs/development/internationalization/internationalization-implementation.mdx} +3 -11
  26. package/{contributing/Internationalization/Internationalization-Implementation.zh-CN.md → docs/development/internationalization/internationalization-implementation.zh-CN.mdx} +3 -11
  27. package/{contributing/Others/Lighthouse.md → docs/development/others/lighthouse.mdx} +8 -13
  28. package/{contributing/Others/Lighthouse.zh-CN.md → docs/development/others/lighthouse.zh-CN.mdx} +8 -13
  29. package/{contributing/Basic/Intro.md → docs/development/start.mdx} +6 -15
  30. package/{contributing/Basic/Intro.zh-CN.md → docs/development/start.zh-CN.mdx} +6 -15
  31. package/{contributing/State-Management/State-Management-Intro.md → docs/development/state-management/state-management-intro.mdx} +4 -9
  32. package/{contributing/State-Management/State-Management-Intro.zh-CN.md → docs/development/state-management/state-management-intro.zh-CN.mdx} +11 -16
  33. package/docs/wiki/HOME.md +11 -0
  34. package/package.json +2 -2
  35. package/scripts/dbmlWorkflow/index.ts +1 -1
  36. package/src/locales/default/tool.ts +10 -10
  37. package/src/server/modules/SearXNG.ts +7 -4
  38. package/src/server/routers/tools/search.ts +7 -5
  39. package/src/services/search.ts +1 -1
  40. package/src/store/chat/slices/builtinTool/actions/searXNG.test.ts +9 -9
  41. package/src/store/chat/slices/builtinTool/actions/searXNG.ts +7 -3
  42. package/src/tools/web-browsing/components/CategoryAvatar.tsx +1 -1
  43. package/src/tools/web-browsing/components/SearchBar.tsx +1 -3
  44. package/src/tools/web-browsing/const.ts +11 -11
  45. package/src/tools/web-browsing/index.ts +2 -2
  46. package/src/types/tool/search.ts +1 -1
  47. package/contributing/Home.md +0 -87
  48. package/contributing/Upstream-Sync.md +0 -58
  49. package/contributing/Upstream-Sync.zh-CN.md +0 -58
  50. package/contributing/_Footer.md +0 -1
  51. package/contributing/_Sidebar.md +0 -48
  52. /package/{contributing/Basic/Folder-Structure.md → docs/development/basic/folder-structure.mdx} +0 -0
  53. /package/{contributing/Basic/Folder-Structure.zh-CN.md → docs/development/basic/folder-structure.zh-CN.mdx} +0 -0
  54. /package/docs/{developer → development}/database-schema.dbml +0 -0
  55. /package/{contributing/State-Management/State-Management-Selectors.md → docs/development/state-management/state-management-selectors.mdx} +0 -0
  56. /package/{contributing/State-Management/State-Management-Selectors.zh-CN.md → docs/development/state-management/state-management-selectors.zh-CN.mdx} +0 -0
@@ -5,7 +5,7 @@ on:
5
5
  branches:
6
6
  - main
7
7
  paths:
8
- - 'docs/developer/database-schema.dbml'
8
+ - 'docs/development/database-schema.dbml'
9
9
 
10
10
  jobs:
11
11
  build:
@@ -4,7 +4,7 @@ on:
4
4
  workflow_dispatch:
5
5
  push:
6
6
  paths:
7
- - 'contributing/**'
7
+ - 'docs/wiki/**'
8
8
  branches:
9
9
  - main
10
10
 
@@ -15,5 +15,5 @@ jobs:
15
15
  steps:
16
16
  - uses: OrlovM/Wiki-Action@v1
17
17
  with:
18
- path: 'contributing'
18
+ path: 'docs/wiki'
19
19
  token: ${{ secrets.GH_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,31 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## [Version 1.79.0](https://github.com/lobehub/lobe-chat/compare/v1.78.0...v1.79.0)
6
+
7
+ <sup>Released on **2025-04-09**</sup>
8
+
9
+ #### ✨ Features
10
+
11
+ - **misc**: Add wiki migrate instructions.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's improved
19
+
20
+ - **misc**: Add wiki migrate instructions ([8279340](https://github.com/lobehub/lobe-chat/commit/8279340))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
5
30
  ## [Version 1.78.0](https://github.com/lobehub/lobe-chat/compare/v1.77.18...v1.78.0)
6
31
 
7
32
  <sup>Released on **2025-04-09**</sup>
package/changelog/v1.json CHANGED
@@ -1,4 +1,13 @@
1
1
  [
2
+ {
3
+ "children": {
4
+ "features": [
5
+ "Add wiki migrate instructions."
6
+ ]
7
+ },
8
+ "date": "2025-04-09",
9
+ "version": "1.79.0"
10
+ },
2
11
  {
3
12
  "children": {
4
13
  "features": [
@@ -2,16 +2,6 @@
2
2
 
3
3
  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.
4
4
 
5
- ### TOC
6
-
7
- - [Add New Authentication Provider](#add-new-authentication-provider)
8
- - [Pre-requisites: Check the Official Provider List](#pre-requisites-check-the-official-provider-list)
9
- - [Step 1: Add Authenticator Core Code](#step-1-add-authenticator-core-code)
10
- - [Step 2: Update Server Configuration Code](#step-2-update-server-configuration-code)
11
- - [Step 3: Change Frontend Pages](#step-3-change-frontend-pages)
12
- - [Step 4: Configure the Environment Variables](#step-4-configure-the-environment-variables)
13
- - [Step 5: Modify server-side user information processing logic](#step-5-modify-server-side-user-information-processing-logic)
14
-
15
5
  ## Add New Authentication Provider
16
6
 
17
7
  To add a new authentication provider in LobeChat (for example, adding Okta), you need to follow the steps below:
@@ -2,16 +2,6 @@
2
2
 
3
3
  LobeChat 使用 [Auth.js v5](https://authjs.dev/) 作为外部身份验证服务。Auth.js 是一个开源的身份验证库,它提供了一种简单的方式来实现身份验证和授权功能。本文档将介绍如何使用 Auth.js 来实现新的身份验证方式。
4
4
 
5
- ### TOC
6
-
7
- - [添加新的身份验证提供者](#添加新的身份验证提供者)
8
- - [准备工作:查阅官方的提供者列表](#准备工作查阅官方的提供者列表)
9
- - [步骤 1: 新增关键代码](#步骤-1-新增关键代码)
10
- - [步骤 2: 更新服务端配置代码](#步骤-2-更新服务端配置代码)
11
- - [步骤 3: 修改前端页面](#步骤-3-修改前端页面)
12
- - [步骤 4: 配置环境变量](#步骤-4-配置环境变量)
13
- - [步骤 5: 修改服务端用户信息处理逻辑](#步骤-5-修改服务端用户信息处理逻辑)
14
-
15
5
  ## 添加新的身份验证提供者
16
6
 
17
7
  为了在 LobeChat 中添加新的身份验证提供者(例如添加 Okta),你需要完成以下步骤:
@@ -2,16 +2,6 @@
2
2
 
3
3
  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:
4
4
 
5
- #### TOC
6
-
7
- - [Application Architecture Overview](#application-architecture-overview)
8
- - [Frontend Architecture](#frontend-architecture)
9
- - [Edge Runtime API](#edge-runtime-api)
10
- - [Agents Market](#agents-market)
11
- - [Plugin Market](#plugin-market)
12
- - [Security and Performance Optimization](#security-and-performance-optimization)
13
- - [Development and Deployment Process](#development-and-deployment-process)
14
-
15
5
  ## Application Architecture Overview
16
6
 
17
7
  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 @@
2
2
 
3
3
  LobeChat 是一个基于 Next.js 框架构建的 AI 聊天应用,旨在提供一个 AI 生产力平台,使用户能够与 AI 进行自然语言交互。以下是 LobeChat 的架构设计介稿:
4
4
 
5
- #### TOC
6
-
7
- - [应用架构概览](#应用架构概览)
8
- - [前端架构](#前端架构)
9
- - [Edge Runtime API](#edge-runtime-api)
10
- - [Agents 市场](#agents-市场)
11
- - [插件市场](#插件市场)
12
- - [安全性和性能优化](#安全性和性能优化)
13
- - [开发和部署流程](#开发和部署流程)
14
-
15
5
  ## 应用架构概览
16
6
 
17
7
  LobeChat 的整体架构由前端、EdgeRuntime API、Agents 市场、插件市场和独立插件组成。这些组件相互协作,以提供完整的 AI 体验。
@@ -2,12 +2,6 @@
2
2
 
3
3
  This document explains the implementation logic of Lobe Chat API in client-server interactions, including event sequences and core components involved.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Interaction Sequence Diagram](#interaction-sequence-diagram)
8
- - [Main Process Steps](#main-process-steps)
9
- - [AgentRuntime Overview](#agentruntime-overview)
10
-
11
5
  ## Interaction Sequence Diagram
12
6
 
13
7
  ```mermaid
@@ -129,7 +123,7 @@ sequenceDiagram
129
123
 
130
124
  Agent avatar auto-generation implementation:
131
125
 
132
- ```typescript
126
+ ```ts
133
127
  // src/features/AgentSetting/store/action.ts
134
128
  autoPickEmoji: async () => {
135
129
  const { config, meta, dispatchMeta } = get();
@@ -153,7 +147,7 @@ sequenceDiagram
153
147
 
154
148
  Translation feature implementation:
155
149
 
156
- ```typescript
150
+ ```ts
157
151
  // src/store/chat/slices/translate/action.ts
158
152
  translateMessage: async (id, targetLang) => {
159
153
  // ...omitted code...
@@ -209,7 +203,7 @@ AgentRuntime is a core abstraction layer in Lobe Chat that encapsulates a unifie
209
203
 
210
204
  4. **Plugin Architecture**: Through the `src/libs/agent-runtime/runtimeMap.ts` mapping table, it implements an extensible plugin architecture, making it easy to add new model providers. Currently, it supports over 40 different model providers:
211
205
 
212
- ```typescript
206
+ ```ts
213
207
  export const providerRuntimeMap = {
214
208
  openai: LobeOpenAI,
215
209
  anthropic: LobeAnthropicAI,
@@ -223,7 +217,7 @@ AgentRuntime is a core abstraction layer in Lobe Chat that encapsulates a unifie
223
217
 
224
218
  5. **Adapter Pattern**: Internally, it uses the adapter pattern to adapt different provider APIs to the unified `src/libs/agent-runtime/BaseAI.ts` interface:
225
219
 
226
- ```typescript
220
+ ```ts
227
221
  export interface LobeRuntimeAI {
228
222
  baseURL?: string;
229
223
  chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions): Promise<Response>;
@@ -242,7 +236,7 @@ AgentRuntime is a core abstraction layer in Lobe Chat that encapsulates a unifie
242
236
  1. **OpenRouter Adapter**:
243
237
  OpenRouter is a unified API that allows access to AI models from multiple providers. Lobe Chat implements support for OpenRouter through an adapter:
244
238
 
245
- ```typescript
239
+ ```ts
246
240
  // OpenRouter adapter implementation
247
241
  class LobeOpenRouterAI implements LobeRuntimeAI {
248
242
  client: OpenAI;
@@ -281,7 +275,7 @@ AgentRuntime is a core abstraction layer in Lobe Chat that encapsulates a unifie
281
275
  2. **Google Gemini Adapter**:
282
276
  Gemini is Google's large language model. Lobe Chat supports Gemini series models through a dedicated adapter:
283
277
 
284
- ```typescript
278
+ ```ts
285
279
  import { GoogleGenerativeAI } from '@google/generative-ai';
286
280
 
287
281
  // Gemini adapter implementation
@@ -2,12 +2,6 @@
2
2
 
3
3
  本文档说明了 Lobe Chat API 在前后端交互中的实现逻辑,包括事件序列和涉及的核心组件。
4
4
 
5
- #### TOC
6
-
7
- - [交互时序图](#交互时序图)
8
- - [主要步骤说明](#主要步骤说明)
9
- - [AgentRuntime 说明](#agentruntime-说明)
10
-
11
5
  ## 交互时序图
12
6
 
13
7
  ```mermaid
@@ -129,7 +123,7 @@ sequenceDiagram
129
123
 
130
124
  角色头像自动生成实现:
131
125
 
132
- ```typescript
126
+ ```ts
133
127
  // src/features/AgentSetting/store/action.ts
134
128
  autoPickEmoji: async () => {
135
129
  const { config, meta, dispatchMeta } = get();
@@ -153,7 +147,7 @@ sequenceDiagram
153
147
 
154
148
  翻译功能实现:
155
149
 
156
- ```typescript
150
+ ```ts
157
151
  // src/store/chat/slices/translate/action.ts
158
152
  translateMessage: async (id, targetLang) => {
159
153
  // ...省略部分代码...
@@ -209,7 +203,7 @@ AgentRuntime 是 Lobe Chat 中的一个核心抽象层,它封装了与不同 A
209
203
 
210
204
  4. **插件化架构**:通过 `src/libs/agent-runtime/runtimeMap.ts` 映射表,实现了可扩展的插件化架构,方便添加新的模型提供商。目前支持超过 40 个不同的模型提供商:
211
205
 
212
- ```typescript
206
+ ```ts
213
207
  export const providerRuntimeMap = {
214
208
  openai: LobeOpenAI,
215
209
  anthropic: LobeAnthropicAI,
@@ -223,7 +217,7 @@ AgentRuntime 是 Lobe Chat 中的一个核心抽象层,它封装了与不同 A
223
217
 
224
218
  5. **适配器模式**:在内部使用适配器模式,将不同提供商的 API 适配到统一的 `src/libs/agent-runtime/BaseAI.ts` 接口:
225
219
 
226
- ```typescript
220
+ ```ts
227
221
  export interface LobeRuntimeAI {
228
222
  baseURL?: string;
229
223
  chat(payload: ChatStreamPayload, options?: ChatCompetitionOptions): Promise<Response>;
@@ -242,7 +236,7 @@ AgentRuntime 是 Lobe Chat 中的一个核心抽象层,它封装了与不同 A
242
236
  1. **OpenRouter 适配器**:
243
237
  OpenRouter 是一个统一 API,可以通过它访问多个模型提供商的 AI 模型。Lobe Chat 通过适配器实现对 OpenRouter 的支持:
244
238
 
245
- ```typescript
239
+ ```ts
246
240
  // OpenRouter 适配器实现
247
241
  class LobeOpenRouterAI implements LobeRuntimeAI {
248
242
  client: OpenAI;
@@ -281,7 +275,7 @@ AgentRuntime 是 Lobe Chat 中的一个核心抽象层,它封装了与不同 A
281
275
  2. **Google Gemini 适配器**:
282
276
  Gemini 是 Google 的大语言模型,Lobe Chat 通过专门的适配器支持 Gemini 系列模型:
283
277
 
284
- ```typescript
278
+ ```ts
285
279
  import { GoogleGenerativeAI } from '@google/generative-ai';
286
280
 
287
281
  // Gemini 适配器实现
@@ -2,20 +2,6 @@
2
2
 
3
3
  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.
4
4
 
5
- ## TOC
6
-
7
- - [Code Style](#code-style)
8
- - [ESLint](#eslint)
9
- - [Prettier](#prettier)
10
- - [remarklint](#remarklint)
11
- - [stylelint](#stylelint)
12
- - [Style Checking](#style-checking)
13
- - [Contribution Process](#contribution-process)
14
- - [Gitmoji](#gitmoji)
15
- - [Semantic Release](#semantic-release)
16
- - [Commitlint](#commitlint)
17
- - [How to Contribute](#how-to-contribute)
18
-
19
5
  ## Code Style
20
6
 
21
7
  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 @@
2
2
 
3
3
  欢迎来到 LobeChat 的代码风格与贡献指南。本指南将帮助您理解我们的代码规范和贡献流程,确保代码的一致性和项目的顺利进行。
4
4
 
5
- ## TOC
6
-
7
- - [代码风格](#代码风格)
8
- - [ESLint](#eslint)
9
- - [Prettier](#prettier)
10
- - [remarklint](#remarklint)
11
- - [stylelint](#stylelint)
12
- - [风格检查](#风格检查)
13
- - [贡献流程](#贡献流程)
14
- - [Gitmoji](#gitmoji)
15
- - [Semantic Release](#semantic-release)
16
- - [Commitlint](#commitlint)
17
- - [如何贡献](#如何贡献)
18
-
19
5
  ## 代码风格
20
6
 
21
7
  在 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
10
10
 
11
11
  Taking the "Chat Messages" feature as an example, here are the brief steps to implement this feature:
12
12
 
13
- #### TOC
14
-
15
- - [1. Define Routes](#1-define-routes)
16
- - [2. Define Data Structure](#2-define-data-structure)
17
- - [3. Create Zustand Store](#3-create-zustand-store)
18
- - [4. Create Page and Components](#4-create-page-and-components)
19
- - [5. Function Binding](#5-function-binding)
20
-
21
13
  ## 1. Define Routes
22
14
 
23
15
  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 作为主要开发语
10
10
 
11
11
  我们以 "会话消息" 功能为例,以下是实现这个功能的简要步骤:
12
12
 
13
- #### TOC
14
-
15
- - [1. 定义路由](#1-定义路由)
16
- - [2. 定义数据结构](#2-定义数据结构)
17
- - [3. 创建 Zustand Store](#3-创建-zustand-store)
18
- - [4. 创建页面与组件](#4-创建页面与组件)
19
- - [5. 功能绑定](#5-功能绑定)
20
-
21
13
  ## 1. 定义路由
22
14
 
23
15
  在 `src/app` 目录下,我们需要定义一个新的路由来承载 "会话消息" 页面。一般来说,我们会在 `src/app` 下创建一个新的文件夹,例如 `chat`,并且在这个文件夹中创建 `page.tsx`文件,在该文件中导出 React 组件作为页面的主体。
@@ -13,7 +13,7 @@ We will use the implementation of sessionGroup as an example: [✨ feat: add ses
13
13
 
14
14
  ## 1. Data Model / Database Definition
15
15
 
16
- To implement the Session Group feature, it is necessary to define the relevant data model and indexes at the database level.
16
+ To implementation the Session Group feature, it is necessary to define the relevant data model and indexes at the database level.
17
17
 
18
18
  Define a new sessionGroup table in 3 steps:
19
19
 
@@ -21,7 +21,7 @@ Define a new sessionGroup table in 3 steps:
21
21
 
22
22
  Define the data model of `DB_SessionGroup` in `src/database/schema/sessionGroup.ts`:
23
23
 
24
- ```typescript
24
+ ```ts
25
25
  import { z } from 'zod';
26
26
 
27
27
  export const DB_SessionGroupSchema = z.object({
@@ -70,7 +70,7 @@ export const dbSchemaV3 = {
70
70
 
71
71
  > \[!Important]
72
72
  >
73
- > If you are unfamiliar with the need to create indexes here and the syntax of schema definition, you may need to familiarize yourself with the basics of Dexie.js. You can refer to the [📘 Local Database](./Local-Database.zh-CN) section for relevant information.
73
+ > If you are unfamiliar with the need to create indexes here and the syntax of schema definition, you may need to familiarize yourself with the basics of Dexie.js.
74
74
 
75
75
  ### 3. Add the sessionGroups Table to the Local DB
76
76
 
@@ -127,7 +127,7 @@ When building the LobeChat application, the Model is responsible for interacting
127
127
 
128
128
  In `src/database/model/sessionGroup.ts`, the `SessionGroupModel` is defined as follows:
129
129
 
130
- ```typescript
130
+ ```ts
131
131
  import { BaseModel } from '@/database/client/core';
132
132
  import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup';
133
133
  import { nanoid } from '@/utils/uuid';
@@ -155,7 +155,7 @@ To maintain code maintainability and extensibility, we place the logic related t
155
155
 
156
156
  `SessionService` implements session group-related request logic by calling methods from `SessionGroupModel`. The following is the implementation of Session Group-related request logic in `sessionService`:
157
157
 
158
- ```typescript
158
+ ```ts
159
159
  class SessionService {
160
160
  // ... Omitted session business logic
161
161
 
@@ -178,7 +178,7 @@ class SessionService {
178
178
 
179
179
  ## 3. Frontend Data Flow Store Implementation
180
180
 
181
- 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).
181
+ 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).
182
182
 
183
183
  ### sessionGroup CRUD
184
184
 
@@ -238,7 +238,7 @@ To handle these groups, we need to refactor the implementation logic of `useFetc
238
238
 
239
239
  This method is defined in `createSessionSlice` as follows:
240
240
 
241
- ```typescript
241
+ ```ts
242
242
  export const createSessionSlice: StateCreator<
243
243
  SessionStore,
244
244
  [['zustand/devtools', never]],
@@ -271,7 +271,7 @@ After successfully retrieving the data, we use the `set` method to update the `c
271
271
 
272
272
  The `sessionService.getGroupedSessions` method is responsible for calling the backend API `SessionModel.queryWithGroups()`.
273
273
 
274
- ```typescript
274
+ ```ts
275
275
  class SessionService {
276
276
  // ... other SessionGroup related implementations
277
277
 
@@ -285,7 +285,7 @@ class SessionService {
285
285
 
286
286
  This method is the core method called by `sessionService.getGroupedSessions`, and it is responsible for querying and organizing session data. The code is as follows:
287
287
 
288
- ```typescript
288
+ ```ts
289
289
  class _SessionModel extends BaseModel {
290
290
  // ... other methods
291
291
 
@@ -510,7 +510,6 @@ describe('MigrationV2ToV3', () => {
510
510
  ```
511
511
 
512
512
  ```markdown
513
-
514
513
  ```
515
514
 
516
515
  Unit tests require the use of `fixtures` to fix the test data. The test cases include verification logic for two parts: 1) the correctness of a single migration (v2 -> v3) and 2) the correctness of a complete migration (v1 -> v3).
@@ -21,7 +21,7 @@
21
21
 
22
22
  在 `src/database/schema/sessionGroup.ts` 中定义 `DB_SessionGroup` 的数据模型:
23
23
 
24
- ```typescript
24
+ ```ts
25
25
  import { z } from 'zod';
26
26
 
27
27
  export const DB_SessionGroupSchema = z.object({
@@ -70,7 +70,7 @@ export const dbSchemaV3 = {
70
70
 
71
71
  > \[!Important]
72
72
  >
73
- > 如果你不了解为何此处需要创建索引,以及不了解此处的 schema 的定义语法。你可能需要提前了解下 Dexie.js 相关的基础知识,可以查阅 [📘 本地数据库](./Local-Database.zh-CN) 部分了解相关内容。
73
+ > 如果你不了解为何此处需要创建索引,以及不了解此处的 schema 的定义语法。你可能需要提前了解下 Dexie.js 相关的基础知识。
74
74
 
75
75
  ### 3. 在本地 DB 中加入 sessionGroups 表
76
76
 
@@ -127,7 +127,7 @@ export class LocalDB extends Dexie {
127
127
 
128
128
  在 `src/database/model/sessionGroup.ts` 中定义 `SessionGroupModel`:
129
129
 
130
- ```typescript
130
+ ```ts
131
131
  import { BaseModel } from '@/database/client/core';
132
132
  import { DB_SessionGroup, DB_SessionGroupSchema } from '@/database/client/schemas/sessionGroup';
133
133
  import { nanoid } from '@/utils/uuid';
@@ -155,7 +155,7 @@ export const SessionGroupModel = new _SessionGroupModel();
155
155
 
156
156
  `SessionService` 通过调用 `SessionGroupModel` 的方法来实现对会话分组的管理。 在 `sessionService` 中实现 Session Group 相关的请求逻辑:
157
157
 
158
- ```typescript
158
+ ```ts
159
159
  class SessionService {
160
160
  // ... 省略 session 业务逻辑
161
161
 
@@ -178,7 +178,7 @@ class SessionService {
178
178
 
179
179
  ## 三、前端数据流 Store 实现
180
180
 
181
- 在 LobeChat 应用中,Store 是用于管理应用前端状态的模块。其中的 Action 是触发状态更新的函数,通常会调用服务层的方法来执行实际的数据处理操作,然后更新 Store 中的状态。我们采用了 `zustand` 作为 Store 模块的底层依赖,对于状态管理的详细实践介绍,可以查阅 [📘 状态管理最佳实践](../State-Management/State-Management-Intro.zh-CN.md)
181
+ 在 LobeChat 应用中,Store 是用于管理应用前端状态的模块。其中的 Action 是触发状态更新的函数,通常会调用服务层的方法来执行实际的数据处理操作,然后更新 Store 中的状态。我们采用了 `zustand` 作为 Store 模块的底层依赖,对于状态管理的详细实践介绍,可以查阅 [📘 状态管理最佳实践](/zh/docs/development/state-management/state-management-intro)
182
182
 
183
183
  ### sessionGroup CRUD
184
184
 
@@ -238,7 +238,7 @@ export const createSessionGroupSlice: StateCreator<
238
238
 
239
239
  该方法在 `createSessionSlice` 中定义,如下所示:
240
240
 
241
- ```typescript
241
+ ```ts
242
242
  export const createSessionSlice: StateCreator<
243
243
  SessionStore,
244
244
  [['zustand/devtools', never]],
@@ -271,7 +271,7 @@ export const createSessionSlice: StateCreator<
271
271
 
272
272
  使用 `sessionService.getGroupedSessions` 方法负责调用后端接口 `SessionModel.queryWithGroups()`
273
273
 
274
- ```typescript
274
+ ```ts
275
275
  class SessionService {
276
276
  // ... 其他 SessionGroup 相关的实现
277
277
 
@@ -285,7 +285,7 @@ class SessionService {
285
285
 
286
286
  此方法是 `sessionService.getGroupedSessions` 调用的核心方法,它负责查询和组织会话数据,代码如下:
287
287
 
288
- ```typescript
288
+ ```ts
289
289
  class _SessionModel extends BaseModel {
290
290
  // ... 其他方法
291
291
 
@@ -348,8 +348,7 @@ const customSessionGroups = (s: SessionStore): CustomSessionGroup[] => s.customS
348
348
  由于在 UI 中的取数全部是通过 `useSessionStore(sessionSelectors.defaultSessions)` 这样的写法实现的,因此我们只需要修改 `defaultSessions` 的选择器实现,即可完成数据结构的变更。 UI 层的取数代码完全不用变更,可以大大降低重构的成本和风险。
349
349
 
350
350
  > !\[Important]
351
- >
352
- > 如果你对 Selectors 的概念和功能不太了解,可以查阅 [📘 数据存储取数模块](../State-Management/State-Management-Selectors.zh-CN.md) 部分了解相关内容。
351
+ > 如果你对 Selectors 的概念和功能不太了解,可以查阅 [📘 数据存储取数模块](/zh/docs/development/state-management/state-management-selectors) 部分了解相关内容。
353
352
 
354
353
  ## 四、UI 实现与 action 绑定
355
354
 
@@ -570,15 +569,15 @@ export class LocalDB extends Dexie {
570
569
 
571
570
  数据导入导出的核心实现在 `src/service/config.ts` 的 `ConfigService` 中,其中的关键方法如下:
572
571
 
573
- | 方法名称 | 描述 |
574
- | --------------------- | ---------------- |
575
- | `importConfigState` | 导入配置数据 |
572
+ | 方法名称 | 描述 |
573
+ | --------------------- | -------- |
574
+ | `importConfigState` | 导入配置数据 |
576
575
  | `exportAgents` | 导出所有助理数据 |
577
576
  | `exportSessions` | 导出所有会话数据 |
578
577
  | `exportSingleSession` | 导出单个会话数据 |
579
578
  | `exportSingleAgent` | 导出单个助理数据 |
580
- | `exportSettings` | 导出设置数据 |
581
- | `exportAll` | 导出所有数据 |
579
+ | `exportSettings` | 导出设置数据 |
580
+ | `exportAll` | 导出所有数据 |
582
581
 
583
582
  ### 数据导出
584
583
 
@@ -3,17 +3,11 @@
3
3
  The design and development of LobeChat would not have been possible without the excellent projects in the community and ecosystem. We have used or referred to some outstanding resources and guides in the design and development process. Here are some key reference resources for developers to refer to during the development and learning process:
4
4
 
5
5
  1. **OpenAI API Guide**: We use OpenAI's API to access and process AI conversation data. You can check out the [OpenAI API Guide](https://platform.openai.com/docs/api-reference/introduction) for more details.
6
-
7
6
  2. **OpenAI SDK**: We use OpenAI's Node.js SDK to interact with OpenAI's API. You can view the source code and documentation on the [OpenAI SDK](https://github.com/openai/openai-node) GitHub repository.
8
-
9
7
  3. **AI SDK**: We use Vercel's AI SDK to access and process AI conversation data. You can refer to the documentation of [AI SDK](https://sdk.vercel.ai/docs) for more details.
10
-
11
8
  4. **LangChain**: Our early conversation feature was implemented based on LangChain. You can visit [LangChain](https://langchain.com) to learn more about it.
12
-
13
9
  5. **Chat-Next-Web**: Chat Next Web is an excellent project, and some of LobeChat's features and workflows are referenced from its implementation. You can view the source code and documentation on the [Chat-Next-Web](https://github.com/Yidadaa/ChatGPT-Next-Web) GitHub repository.
14
-
15
10
  6. **Next.js Documentation**: Our project is built on Next.js, and you can refer to the [Next.js Documentation](https://nextjs.org/docs) for more information about Next.js.
16
-
17
11
  7. **FlowGPT**: FlowGPT is currently the world's largest Prompt community, and some of the agents in LobeChat come from active authors in FlowGPT. You can visit [FlowGPT](https://flowgpt.com/) to learn more about it.
18
12
 
19
13
  We will continue to update and supplement this list to provide developers with more reference resources.
@@ -3,17 +3,11 @@
3
3
  LobeChat 的设计和开发离不开社区和生态中的优秀项目。我们在设计和开发过程中使用或参考了一些优秀的资源和指南。以下是一些主要的参考资源,供开发者在开发和学习过程中参考:
4
4
 
5
5
  1. **OpenAI API 指南**:我们使用 OpenAI 的 API 来获取和处理 AI 的会话数据。你可以查看 [OpenAI API 指南](https://platform.openai.com/docs/api-reference/introduction) 了解更多详情。
6
-
7
6
  2. **OpenAI SDK**:我们使用 OpenAI 的 Node.js SDK 来与 OpenAI 的 API 交互。你可以在 [OpenAI SDK](https://github.com/openai/openai-node) 的 GitHub 仓库中查看源码和文档。
8
-
9
7
  3. **AI SDK**:我们使用 Vercel 的 AI SDK 来获取和处理 AI 的会话数据。你可以查看 [AI SDK](https://sdk.vercel.ai/docs) 的文档来了解更多详情。
10
-
11
8
  4. **LangChain**:我们早期的会话功能是基于 LangChain 实现的。你可以访问 [LangChain](https://langchain.com) 来了解更多关于它的信息。
12
-
13
9
  5. **Chat-Next-Web**:Chat Next Web 是一个优秀的项目,LobeChat 的部分功能、Workflow 等参考了它的实现。你可以在 [Chat-Next-Web](https://github.com/Yidadaa/ChatGPT-Next-Web) 的 GitHub 仓库中查看源码和文档。
14
-
15
10
  6. **Next.js 文档**:我们的项目是基于 Next.js 构建的,你可以查看 [Next.js 文档](https://nextjs.org/docs) 来了解更多关于 Next.js 的信息。
16
-
17
11
  7. **FlowGPT**:FlowGPT 是目前全球最大的 Prompt 社区,LobeChat 中的一些 Agent 来自 FlowGPT 的活跃作者。你可以访问 [FlowGPT](https://flowgpt.com/) 来了解更多关于它的信息。
18
12
 
19
13
  我们会持续更新和补充这个列表,为开发者提供更多的参考资源。
@@ -2,13 +2,6 @@
2
2
 
3
3
  Welcome to the LobeChat development environment setup guide.
4
4
 
5
- #### TOC
6
-
7
- - [Online Development](#online-development)
8
- - [Local Development](#local-development)
9
- - [Development Environment Requirements](#development-environment-requirements)
10
- - [Project Setup](#project-setup)
11
-
12
5
  ## Online Development
13
6
 
14
7
  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 @@
2
2
 
3
3
  欢迎阅读 LobeChat 的开发环境设置指南。
4
4
 
5
- #### TOC
6
-
7
- - [在线开发](#在线开发)
8
- - [本地开发](#本地开发)
9
- - [开发环境需求](#开发环境需求)
10
- - [项目设置](#项目设置)
11
-
12
5
  ## 在线开发
13
6
 
14
7
  如果你有 GitHub Codespaces 的使用权限,可以点击下方按钮一键进入在线开发环境:
@@ -2,21 +2,13 @@
2
2
 
3
3
  LobeChat's testing strategy includes unit testing and end-to-end (E2E) testing. Below are detailed explanations of each type of testing:
4
4
 
5
- #### TOC
6
-
7
- - [Unit Testing](#unit-testing)
8
- - [🚧 End-to-End Testing](#-end-to-end-testing)
9
- - [Development Testing](#development-testing)
10
- - [1. Unit Testing](#1-unit-testing)
11
- - [Testing Strategy](#testing-strategy)
12
-
13
5
  ## Unit Testing
14
6
 
15
7
  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.
16
8
 
17
9
  To run unit tests, you can use the following command:
18
10
 
19
- ```
11
+ ```bash
20
12
  npm run test
21
13
  ```
22
14
 
@@ -42,7 +34,7 @@ Before writing unit tests, you need to create a directory with the same name as
42
34
 
43
35
  In the test file, you can use the `describe` and `it` functions to organize and write test cases. The `describe` function is used to create a test suite, and the `it` function is used to write specific test cases.
44
36
 
45
- ```typescript
37
+ ```ts
46
38
  import { formatNumber } from './formatNumber';
47
39
 
48
40
  describe('formatNumber', () => {
@@ -64,7 +56,7 @@ In test cases, you can use the `expect` function to assert whether the test resu
64
56
 
65
57
  Execute unit tests by running the following command:
66
58
 
67
- ```
59
+ ```bash
68
60
  npm run test
69
61
  ```
70
62