@lobehub/chat 0.111.3 → 0.111.5

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 (53) hide show
  1. package/.i18nrc.js +7 -5
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +2 -2
  4. package/README.zh-CN.md +3 -3
  5. package/docs/Deployment/Analytics.md +20 -0
  6. package/docs/{Analytics.zh-CN.md → Deployment/Analytics.zh-CN.md} +5 -0
  7. package/docs/{Docker-Deployment.md → Deployment/Docker-Deployment.md} +7 -0
  8. package/docs/{Docker-Deployment.zh-CN.md → Deployment/Docker-Deployment.zh-CN.md} +7 -0
  9. package/docs/{Environment-Variable.md → Deployment/Environment-Variable.md} +1 -1
  10. package/docs/{Environment-Variable.zh-CN.md → Deployment/Environment-Variable.zh-CN.md} +1 -1
  11. package/docs/Development/Architecture.md +47 -0
  12. package/docs/{Development-Guide → Development}/Architecture.zh-CN.md +11 -1
  13. package/docs/Development/Chat-API.md +136 -0
  14. package/docs/{Development-Guide → Development}/Chat-API.zh-CN.md +10 -1
  15. package/docs/Development/Data-Store-Selectors.md +68 -0
  16. package/docs/{Development-Guide/Data-Store/Selectors.zh-CN.md → Development/Data-Store-Selectors.zh-CN.md} +1 -1
  17. package/docs/Development/Feature-Development.md +126 -0
  18. package/docs/{Development-Guide → Development}/Feature-Development.zh-CN.md +9 -1
  19. package/docs/Development/Folder-Structure.md +40 -0
  20. package/docs/Development/Resources.md +19 -0
  21. package/docs/Development/Steup-Development.md +69 -0
  22. package/docs/{Development-Guide → Development}/Steup-Development.zh-CN.md +8 -1
  23. package/docs/Development/Test.md +87 -0
  24. package/docs/{Development-Guide → Development}/Test.zh-CN.md +9 -1
  25. package/docs/Development/index.md +43 -0
  26. package/docs/{Development-Guide → Development}/index.zh-CN.md +6 -1
  27. package/docs/Home.md +32 -19
  28. package/docs/_Sidebar.md +29 -19
  29. package/locales/en_US/chat.json +1 -1
  30. package/package.json +8 -1
  31. package/scripts/docsWorkflow/const.ts +14 -0
  32. package/scripts/docsWorkflow/index.ts +73 -0
  33. package/scripts/docsWorkflow/toc.ts +60 -0
  34. package/scripts/docsWorkflow/utils.ts +38 -0
  35. package/src/chains/__tests__/summaryTitle.test.ts +2 -2
  36. package/src/chains/summaryTitle.ts +3 -4
  37. package/src/const/modelTokens.ts +3 -1
  38. package/src/store/global/selectors/__snapshots__/settings.test.ts.snap +16 -0
  39. package/src/types/llm.ts +2 -0
  40. /package/docs/{Deploy-with-Azure-OpenAI.md → Deployment/Deploy-with-Azure-OpenAI.md} +0 -0
  41. /package/docs/{Deploy-with-Azure-OpenAI.zh-CN.md → Deployment/Deploy-with-Azure-OpenAI.zh-CN.md} +0 -0
  42. /package/docs/{Upstream-Sync.md → Deployment/Upstream-Sync.md} +0 -0
  43. /package/docs/{Upstream-Sync.zh-CN.md → Deployment/Upstream-Sync.zh-CN.md} +0 -0
  44. /package/docs/{Development-Guide → Development}/Folder-Structure.zh-CN.md +0 -0
  45. /package/docs/{Development-Guide → Development}/Resources.zh-CN.md +0 -0
  46. /package/docs/{Lighthouse.md → Others/Lighthouse.md} +0 -0
  47. /package/docs/{Lighthouse.zh-CN.md → Others/Lighthouse.zh-CN.md} +0 -0
  48. /package/docs/{Plugin-Development.md → Plugins/Plugin-Development.md} +0 -0
  49. /package/docs/{Plugin-Development.zh-CN.md → Plugins/Plugin-Development.zh-CN.md} +0 -0
  50. /package/docs/{Usage-Agents.md → Usage/Usage-Agents.md} +0 -0
  51. /package/docs/{Usage-Agents.zh-CN.md → Usage/Usage-Agents.zh-CN.md} +0 -0
  52. /package/docs/{Usage-Topics.md → Usage/Usage-Topics.md} +0 -0
  53. /package/docs/{Usage-Topics.zh-CN.md → Usage/Usage-Topics.zh-CN.md} +0 -0
@@ -1,4 +1,4 @@
1
- ## 如何开发一个新功能
1
+ # 如何开发一个新功能
2
2
 
3
3
  LobeChat 基于 Next.js 框架构建,使用 TypeScript 作为主要开发语言。在开发新功能时,我们需要遵循一定的开发流程,以确保代码的质量和稳定性。大致的流程分为以下五步:
4
4
 
@@ -10,6 +10,14 @@ 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
+
13
21
  ## 1. 定义路由
14
22
 
15
23
  在 `src/app` 目录下,我们需要定义一个新的路由来承载 "会话消息" 页面。一般来说,我们会在 `src/app` 下创建一个新的文件夹,例如 `chat`,并且在这个文件夹中创建 `page.tsx`文件,在该文件中导出 React 组件作为页面的主体。
@@ -0,0 +1,40 @@
1
+ # Directory Structure
2
+
3
+ The directory structure of LobeChat is as follows:
4
+
5
+ ```bash
6
+ src
7
+ ├── app # Main logic and state management related code for the application
8
+ ├── components # Reusable UI components
9
+ ├── config # Application configuration files, including client-side and server-side environment variables
10
+ ├── const # Used to define constants, such as action types, route names, etc.
11
+ ├── features # Function modules related to business functions, such as agent settings, plugin development pop-ups, etc.
12
+ ├── hooks # Custom utility hooks reused throughout the application
13
+ ├── layout # Application layout components, such as navigation bars, sidebars, etc.
14
+ ├── locales # Internationalization language files
15
+ ├── services # Encapsulated backend service interfaces, such as HTTP requests
16
+ ├── store # Zustand store for state management
17
+ ├── types # TypeScript type definition files
18
+ └── utils # Common utility functions
19
+ ```
20
+
21
+ ## app
22
+
23
+ In the `app` folder, we organize each route page according to the app router's [Route Groups](https://nextjs.org/docs/app/building-your-application/routing/route-groups) to separately handle the implementation of desktop and mobile code. Taking the file structure of the `welcome` page as an example:
24
+
25
+ ```bash
26
+ welcome
27
+ ├── (desktop) # Desktop implementation
28
+ │ ├── features # Desktop-specific features
29
+ │ ├── index.tsx # Main entry file for desktop
30
+ │ └── layout.desktop.tsx # Desktop layout component
31
+ ├── (mobile) # Mobile implementation
32
+ │ ├── features # Mobile-specific features
33
+ │ ├── index.tsx # Main entry file for mobile
34
+ │ └── layout.mobile.tsx # Mobile layout component
35
+ ├── features # This folder contains features code shared by both desktop and mobile, such as the Banner component
36
+ │ └── Banner
37
+ └── page.tsx # This is the main entry file for the page, used to load desktop or mobile code based on the device type
38
+ ```
39
+
40
+ In this way, we can clearly distinguish and manage desktop and mobile code, while also easily reusing code required on both devices, thereby improving development efficiency and maintaining code cleanliness and maintainability.
@@ -0,0 +1,19 @@
1
+ # Resources and References
2
+
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
+
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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+
19
+ We will continue to update and supplement this list to provide developers with more reference resources.
@@ -0,0 +1,69 @@
1
+ # Environment Setup Guide
2
+
3
+ Welcome to the LobeChat development environment setup guide.
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
+ ## Online Development
13
+
14
+ If you have access to GitHub Codespaces, you can click the button below to enter the online development environment with just one click:
15
+
16
+ [![][codespaces-shield]][codespaces-link]
17
+
18
+ ## Local Development
19
+
20
+ Before starting development on LobeChat, you need to install and configure some necessary software and tools in your local environment. This document will guide you through these steps.
21
+
22
+ ### Development Environment Requirements
23
+
24
+ First, you need to install the following software:
25
+
26
+ - Node.js: LobeChat is built on Node.js, so you need to install Node.js. We recommend installing the latest stable version.
27
+ - Yarn: We use Yarn as the preferred package manager. You can download and install it from the Yarn official website.
28
+ - PNPM: We use PNPM as an auxiliary package manager. You can download and install it from the PNPM official website.
29
+ - Git: We use Git for version control. You can download and install it from the Git official website.
30
+ - IDE: You can choose your preferred integrated development environment (IDE). We recommend using WebStorm, a powerful IDE particularly suitable for TypeScript development.
31
+
32
+ ### Project Setup
33
+
34
+ After installing the above software, you can start setting up the LobeChat project.
35
+
36
+ 1. **Get the code**: First, you need to clone the LobeChat codebase from GitHub. Run the following command in the terminal:
37
+
38
+ ```bash
39
+ git clone https://github.com/lobehub/lobe-chat.git
40
+ ```
41
+
42
+ 2. **Install dependencies**: Then, navigate to the project directory and use Yarn to install the project's dependencies:
43
+
44
+ ```bash
45
+ cd lobe-chat
46
+ yarn install
47
+ ```
48
+
49
+ If you are using PNPM, you can execute:
50
+
51
+ ```bash
52
+ cd lobe-chat
53
+ pnpm install
54
+ ```
55
+
56
+ 3. **Start the development server**: After installing the dependencies, you can start the development server:
57
+
58
+ ```bash
59
+ yarn run dev
60
+ ```
61
+
62
+ Now, you can open `http://localhost:3010` in your browser, and you should see the welcome page of LobeChat. This indicates that you have successfully set up the development environment.
63
+
64
+ ![](https://github-production-user-asset-6210df.s3.amazonaws.com/28616219/274655364-414bc31e-8511-47a3-af17-209b530effc7.png)
65
+
66
+ During the development process, if you encounter any issues with environment setup or have any questions about LobeChat development, feel free to ask us at any time. We look forward to seeing your contributions!
67
+
68
+ [codespaces-link]: https://codespaces.new/lobehub/lobe-chat
69
+ [codespaces-shield]: https://github.com/codespaces/badge.svg
@@ -1,7 +1,14 @@
1
- # LobeChat 环境设置指南
1
+ # 环境设置指南
2
2
 
3
3
  欢迎阅读 LobeChat 的开发环境设置指南。
4
4
 
5
+ #### TOC
6
+
7
+ - [在线开发](#在线开发)
8
+ - [本地开发](#本地开发)
9
+ - [开发环境需求](#开发环境需求)
10
+ - [项目设置](#项目设置)
11
+
5
12
  ## 在线开发
6
13
 
7
14
  如果你有 GitHub Codespaces 的使用权限,可以点击下方按钮一键进入在线开发环境:
@@ -0,0 +1,87 @@
1
+ # Testing Guide
2
+
3
+ LobeChat's testing strategy includes unit testing and end-to-end (E2E) testing. Below are detailed explanations of each type of testing:
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
+ ## Unit Testing
14
+
15
+ 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
+
17
+ To run unit tests, you can use the following command:
18
+
19
+ ```
20
+ npm run test
21
+ ```
22
+
23
+ This will run all unit tests and generate a test report.
24
+
25
+ We encourage developers to write corresponding unit tests while writing code to ensure the quality and stability of the code.
26
+
27
+ ## 🚧 End-to-End Testing
28
+
29
+ End-to-end testing is used to test the functionality and performance of the application in a real environment. It simulates real user operations and verifies the application's performance in different scenarios.
30
+
31
+ Currently, there is no integrated end-to-end testing in LobeChat. We will gradually introduce end-to-end testing in subsequent iterations.
32
+
33
+ ## Development Testing
34
+
35
+ ### 1. Unit Testing
36
+
37
+ Unit testing is conducted on the smallest testable units in the application, usually functions, components, or modules. In LobeChat, we use [vitest][vitest-url] for unit testing.
38
+
39
+ #### Writing Test Cases
40
+
41
+ Before writing unit tests, you need to create a directory with the same name as the file to be tested and name the test file `<filename>.test.ts`. For example, if you want to test the `src/utils/formatDate.ts` file, the test file should be named `src/utils/formatDate.test.ts`.
42
+
43
+ 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
+
45
+ ```typescript
46
+ import { formatNumber } from './formatNumber';
47
+
48
+ describe('formatNumber', () => {
49
+ it('should format number with comma separator', () => {
50
+ const result = formatNumber(1000);
51
+ expect(result).toBe('1,000');
52
+ });
53
+
54
+ it('should return the same number if it is less than 1000', () => {
55
+ const result = formatNumber(500);
56
+ expect(result).toBe('500');
57
+ });
58
+ });
59
+ ```
60
+
61
+ In test cases, you can use the `expect` function to assert whether the test results meet expectations. The `expect` function can be used with various matchers, such as `toBe`, `toEqual`, `toBeTruthy`, etc.
62
+
63
+ #### Running Unit Tests
64
+
65
+ Execute unit tests by running the following command:
66
+
67
+ ```
68
+ npm run test
69
+ ```
70
+
71
+ This will run all unit tests and output the test results.
72
+
73
+ ## Testing Strategy
74
+
75
+ To write effective test cases, you can consider the following testing strategies:
76
+
77
+ - **Boundary Testing**: Test the boundary conditions of inputs, such as minimum value, maximum value, empty value, etc.
78
+ - **Exception Testing**: Test the code handling exceptional cases, such as error handling, fallback in exceptional situations, etc.
79
+ - **Functional Testing**: Test whether various functional modules of the application work properly, including user interaction, data processing, etc.
80
+ - **Compatibility Testing**: Test the compatibility of the application on different browsers and devices.
81
+ - **Performance Testing**: Test the performance of the application under different loads, such as response time, resource utilization, etc.
82
+
83
+ Also, ensure that your test cases have good coverage, covering critical code and functionality in the application.
84
+
85
+ By properly writing and executing unit tests, integration tests, and end-to-end tests, you can improve the quality and stability of the application and promptly identify and fix potential issues.
86
+
87
+ [vitest-url]: https://vitest.dev/
@@ -1,7 +1,15 @@
1
- # LobeChat 测试指南
1
+ # 测试指南
2
2
 
3
3
  LobeChat 的测试策略包括单元测试和端到端 (E2E) 测试。下面是每种测试的详细说明:
4
4
 
5
+ #### TOC
6
+
7
+ - [单元测试](#单元测试)
8
+ - [🚧 端到端测试](#-端到端测试)
9
+ - [开发测试](#开发测试)
10
+ - [1. 单元测试](#1-单元测试)
11
+ - [测试策略](#测试策略)
12
+
5
13
  ## 单元测试
6
14
 
7
15
  单元测试用于测试应用中的独立单元(如组件、函数、工具函数等)的功能。我们使用 [vitest][vitest-url] 进行单元测试。
@@ -0,0 +1,43 @@
1
+ # Technical Development Getting Started Guide
2
+
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.
4
+
5
+ #### TOC
6
+
7
+ - [Basic Technology Stack](#basic-technology-stack)
8
+ - [Folder Directory Structure](#folder-directory-structure)
9
+
10
+ ## Basic Technology Stack
11
+
12
+ The core technology stack of LobeChat includes:
13
+
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.
17
+ - **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.
20
+ - **Styling**: We use [antd-style](https://github.com/ant-design/antd-style), a CSS-in-JS library that complements Ant Design.
21
+ - **Unit Testing**: We use [vitest](https://github.com/vitest-dev/vitest) for unit testing.
22
+
23
+ ## Folder Directory Structure
24
+
25
+ The folder directory structure of LobeChat is as follows:
26
+
27
+ ```bash
28
+ src
29
+ ├── app # Main logic of the application and code related to state management
30
+ ├── components # Reusable UI components
31
+ ├── config # Application configuration files, including client-side environment variables and server-side environment variables
32
+ ├── 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
35
+ ├── layout # Application layout components, such as navigation bars, sidebars, etc.
36
+ ├── locales # Language files for internationalization
37
+ ├── services # Encapsulated backend service interfaces, such as HTTP requests
38
+ ├── store # Zustand store for state management
39
+ ├── types # TypeScript type definition files
40
+ └── utils # Common utility functions
41
+ ```
42
+
43
+ For a detailed introduction to the directory structure, please refer to: [Folder Directory Structure](Folder-Structure.en-US.md)
@@ -1,7 +1,12 @@
1
- # LobeChat 技术开发上手指南
1
+ # 技术开发上手指南
2
2
 
3
3
  欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。
4
4
 
5
+ #### TOC
6
+
7
+ - [基础技术栈](#基础技术栈)
8
+ - [文件夹目录架构](#文件夹目录架构)
9
+
5
10
  ## 基础技术栈
6
11
 
7
12
  LobeChat 的核心技术栈如下:
package/docs/Home.md CHANGED
@@ -12,42 +12,61 @@ LobeChat is a open-source, extensible ([Function Calling][fc-url]), high-perform
12
12
 
13
13
  ![](https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png)
14
14
 
15
+ <!-- DOCS LIST -->
16
+
15
17
  ### 🤯 LobeChat Usage
16
18
 
17
- - [Custom Agents Guide](Usage-Agents) | [自定义助手指南](Usage-Agents.zh-CN)
18
- - [Topics Guide](Usage-Topics) | [话题指南](Usage-Topics.zh-CN)
19
+ - [Custom Agents Guide](https://github.com/lobehub/lobe-chat/wiki/Usage-Agents) | [自定义助手指南](https://github.com/lobehub/lobe-chat/wiki/Usage-Agents)
20
+ - [Topic Guide](https://github.com/lobehub/lobe-chat/wiki/Usage-Topics) | [话题指南](https://github.com/lobehub/lobe-chat/wiki/Usage-Topics)
21
+
22
+ ---
23
+
24
+ ### 🛳 Self Hosting
25
+
26
+ - [Data Statistics](https://github.com/lobehub/lobe-chat/wiki/Analytics) | [数据统计](https://github.com/lobehub/lobe-chat/wiki/Analytics)
27
+ - [Deploying with Azure OpenAI](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI) | [使用 Azure OpenAI 部署](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI)
28
+ - [Docker Deployment Guide](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment) | [Docker 部署指引](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment)
29
+ - [LobeChat Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [LobeChat 环境变量](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable)
30
+ - [Maintaining Updates with LobeChat Self-Deployment](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync) | [LobeChat 自部署保持更新](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync)
19
31
 
20
32
  ---
21
33
 
22
- #### 🛳 Self Hosting
34
+ ### ⌨️ Development
23
35
 
24
- - [Environment Variables](Environment-Variable) | [环境变量](Environment-Variable.zh-CN)
25
- - [Maintaining Updates with LobeChat Self-Deployment](Upstream-Sync) | [自部署保持更新](Upstream-Sync.zh-CN)
26
- - [Deploying with Azure OpenAI](Deploy-with-Azure-OpenAI) | [使用 Azure OpenAI 部署](Deploy-with-Azure-OpenAI.zh-CN)
27
- - [Docker Deployment Guide](Docker-Deployment) | [Docker 部署指引](Docker-Deployment.zh-CN)
36
+ - [Technical Development Getting Started Guide](https://github.com/lobehub/lobe-chat/wiki/index) | [技术开发上手指南](https://github.com/lobehub/lobe-chat/wiki/index)
37
+ - [Architecture Design](https://github.com/lobehub/lobe-chat/wiki/Architecture) | [架构设计](https://github.com/lobehub/lobe-chat/wiki/Architecture)
38
+ - [Conversation API Implementation Logic](https://github.com/lobehub/lobe-chat/wiki/Chat-API) | [会话 API 实现逻辑](https://github.com/lobehub/lobe-chat/wiki/Chat-API)
39
+ - [Data Store Selector](https://github.com/lobehub/lobe-chat/wiki/Data-Store-Selectors) | [数据存储取数模块](https://github.com/lobehub/lobe-chat/wiki/Data-Store-Selectors)
40
+ - [Directory Structure](https://github.com/lobehub/lobe-chat/wiki/Folder-Structure) | [目录架构](https://github.com/lobehub/lobe-chat/wiki/Folder-Structure)
41
+ - [Environment Setup Guide](https://github.com/lobehub/lobe-chat/wiki/Steup-Development) | [环境设置指南](https://github.com/lobehub/lobe-chat/wiki/Steup-Development)
42
+ - [How to Develop a New Feature](https://github.com/lobehub/lobe-chat/wiki/Feature-Development) | [如何开发一个新功能](https://github.com/lobehub/lobe-chat/wiki/Feature-Development)
43
+ - [Resources and References](https://github.com/lobehub/lobe-chat/wiki/Resources) | [资源与参考](https://github.com/lobehub/lobe-chat/wiki/Resources)
44
+ - [Testing Guide](https://github.com/lobehub/lobe-chat/wiki/Test) | [测试指南](https://github.com/lobehub/lobe-chat/wiki/Test)
28
45
 
29
46
  ---
30
47
 
31
48
  ### 🤖 Agents
32
49
 
33
- - [Agent Index and Submit][agent-index] | [助手索引与提交][agent-index-cn]
50
+ - [Agent Index and Submit](https://github.com/lobehub/lobe-chat-agents) | [助手索引与提交](https://github.com/lobehub/lobe-chat-agents/blob/main/README.zh-CN.md)
34
51
 
35
52
  ---
36
53
 
37
54
  ### 🧩 Plugins
38
55
 
39
- - [Plugin Index and Submit][plugin-index] | [插件索引与提交][plugin-index-cn]
40
- - [Plugin Development](Plugin-Development) | [插件开发](Plugin-Development.zh-CN)
41
- - [Plugin SDK Docs][plugin-sdk] | [插件 SDK 文档][plugin-skd-cn]
56
+ - [LobeChat Plugin Development](https://github.com/lobehub/lobe-chat/wiki/Plugin-Development) | [LobeChat 插件开发](https://github.com/lobehub/lobe-chat/wiki/Plugin-Development)
57
+ - [Plugin Index and Submit](https://github.com/lobehub/lobe-chat-plugins) | [插件索引与提交](https://github.com/lobehub/lobe-chat-plugins/blob/main/README.zh-CN.md)
58
+ - [Plugin SDK Docs](https://chat-plugin-sdk.lobehub.com) | [插件 SDK 文档](https://chat-plugin-sdk.lobehub.com)
42
59
 
43
60
  ---
44
61
 
45
- #### 📊 Other
62
+ ### 📊 Others
46
63
 
47
- - [Lighthouse Report](Lighthouse) | [性能测试](Lighthouse.zh-CN)
64
+ - [Lighthouse Reports](https://github.com/lobehub/lobe-chat/wiki/Lighthouse) | [Lighthouse 测试报告](https://github.com/lobehub/lobe-chat/wiki/Lighthouse)
48
65
 
49
66
  ---
50
67
 
68
+ <!-- DOCS LIST -->
69
+
51
70
  <details><summary><h4>📝 License</h4></summary>
52
71
 
53
72
  [![][fossa-license-shield]][fossa-license-url]
@@ -59,14 +78,8 @@ This project is [MIT][license-url] licensed.
59
78
 
60
79
  <!-- LINK GROUP -->
61
80
 
62
- [agent-index]: https://github.com/lobehub/lobe-chat-agents
63
- [agent-index-cn]: https://github.com/lobehub/lobe-chat-agents/blob/main/README.zh-CN.md
64
81
  [fc-url]: https://sspai.com/post/81986
65
82
  [fossa-license-shield]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat.svg?type=large
66
83
  [fossa-license-url]: https://app.fossa.com/projects/git%2Bgithub.com%2Flobehub%2Flobe-chat
67
84
  [license-url]: https://github.com/lobehub/lobe-chat/blob/main/LICENSE
68
- [plugin-index]: https://github.com/lobehub/lobe-chat-plugins
69
- [plugin-index-cn]: https://github.com/lobehub/lobe-chat-plugins/blob/main/README.zh-CN.md
70
- [plugin-sdk]: https://chat-plugin-sdk.lobehub.com
71
- [plugin-skd-cn]: https://chat-plugin-sdk.lobehub.com
72
85
  [profile-url]: https://github.com/lobehub
package/docs/_Sidebar.md CHANGED
@@ -4,37 +4,47 @@
4
4
 
5
5
  - [TOC](Home) | [目录](Home)
6
6
 
7
+ <!-- DOCS LIST -->
8
+
7
9
  #### 🤯 LobeChat Usage
8
10
 
9
- - [Custom Agents Guide](Usage-Agents) | [中文](Usage-Agents.zh-CN)
10
- - [Topics Guide](Usage-Topics) | [中文](Usage-Topics.zh-CN)
11
+ - [Custom Agents Guide](https://github.com/lobehub/lobe-chat/wiki/Usage-Agents) | [中文](https://github.com/lobehub/lobe-chat/wiki/Usage-Agents)
12
+ - [Topic Guide](https://github.com/lobehub/lobe-chat/wiki/Usage-Topics) | [中文](https://github.com/lobehub/lobe-chat/wiki/Usage-Topics)
11
13
 
12
14
  #### 🛳 Self Hosting
13
15
 
14
- - [Environment Variables](Environment-Variable) | [中文](Environment-Variable.zh-CN)
15
- - [Upstream Sync](Upstream-Sync) | [中文](Upstream-Sync.zh-CN)
16
- - [Deploying with Azure OpenAI](Deploy-with-Azure-OpenAI) | [中文](Deploy-with-Azure-OpenAI.zh-CN)
17
- - [Docker Deployment Guide](Docker-Deployment) | [中文](Docker-Deployment.zh-CN)
16
+ - [Data Statistics](https://github.com/lobehub/lobe-chat/wiki/Analytics) | [中文](https://github.com/lobehub/lobe-chat/wiki/Analytics)
17
+ - [Deploying with Azure OpenAI](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI) | [中文](https://github.com/lobehub/lobe-chat/wiki/Deploy-with-Azure-OpenAI)
18
+ - [Docker Deployment Guide](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment) | [中文](https://github.com/lobehub/lobe-chat/wiki/Docker-Deployment)
19
+ - [LobeChat Environment Variables](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable) | [中文](https://github.com/lobehub/lobe-chat/wiki/Environment-Variable)
20
+ - [Maintaining Updates with LobeChat Self-Deployment](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync) | [中文](https://github.com/lobehub/lobe-chat/wiki/Upstream-Sync)
21
+
22
+ #### ⌨️ Development
23
+
24
+ - [Technical Development Getting Started Guide](https://github.com/lobehub/lobe-chat/wiki/index) | [中文](https://github.com/lobehub/lobe-chat/wiki/index)
25
+ - [Architecture Design](https://github.com/lobehub/lobe-chat/wiki/Architecture) | [中文](https://github.com/lobehub/lobe-chat/wiki/Architecture)
26
+ - [Conversation API Implementation Logic](https://github.com/lobehub/lobe-chat/wiki/Chat-API) | [中文](https://github.com/lobehub/lobe-chat/wiki/Chat-API)
27
+ - [Data Store Selector](https://github.com/lobehub/lobe-chat/wiki/Data-Store-Selectors) | [中文](https://github.com/lobehub/lobe-chat/wiki/Data-Store-Selectors)
28
+ - [Directory Structure](https://github.com/lobehub/lobe-chat/wiki/Folder-Structure) | [中文](https://github.com/lobehub/lobe-chat/wiki/Folder-Structure)
29
+ - [Environment Setup Guide](https://github.com/lobehub/lobe-chat/wiki/Steup-Development) | [中文](https://github.com/lobehub/lobe-chat/wiki/Steup-Development)
30
+ - [How to Develop a New Feature](https://github.com/lobehub/lobe-chat/wiki/Feature-Development) | [中文](https://github.com/lobehub/lobe-chat/wiki/Feature-Development)
31
+ - [Resources and References](https://github.com/lobehub/lobe-chat/wiki/Resources) | [中文](https://github.com/lobehub/lobe-chat/wiki/Resources)
32
+ - [Testing Guide](https://github.com/lobehub/lobe-chat/wiki/Test) | [中文](https://github.com/lobehub/lobe-chat/wiki/Test)
18
33
 
19
34
  #### 🤖 Agents
20
35
 
21
- - [Agent Index][agent-index] | [中文][agent-index-cn]
36
+ - [Agent Index and Submit](https://github.com/lobehub/lobe-chat-agents) | [中文](https://github.com/lobehub/lobe-chat-agents/blob/main/README.zh-CN.md)
22
37
 
23
38
  #### 🧩 Plugins
24
39
 
25
- - [Plugin Index][plugin-index] | [中文][plugin-index-cn]
26
- - [Plugin Development](Plugin-Development) | [中文](Plugin-Development.zh-CN)
27
- - [Plugin SDK Docs][plugin-sdk] | [中文][plugin-skd-cn]
40
+ - [LobeChat Plugin Development](https://github.com/lobehub/lobe-chat/wiki/Plugin-Development) | [中文](https://github.com/lobehub/lobe-chat/wiki/Plugin-Development)
41
+ - [Plugin Index and Submit](https://github.com/lobehub/lobe-chat-plugins) | [中文](https://github.com/lobehub/lobe-chat-plugins/blob/main/README.zh-CN.md)
42
+ - [Plugin SDK Docs](https://chat-plugin-sdk.lobehub.com) | [中文](https://chat-plugin-sdk.lobehub.com)
28
43
 
29
- #### 📊 Other
44
+ #### 📊 Others
30
45
 
31
- - [Lighthouse Report](Lighthouse) | [中文](Lighthouse.zh-CN)
46
+ - [Lighthouse Reports](https://github.com/lobehub/lobe-chat/wiki/Lighthouse) | [中文](https://github.com/lobehub/lobe-chat/wiki/Lighthouse)
32
47
 
33
- <!-- LINK GROUP -->
48
+ <!-- DOCS LIST -->
34
49
 
35
- [agent-index]: https://github.com/lobehub/lobe-chat-agents
36
- [agent-index-cn]: https://github.com/lobehub/lobe-chat-agents/blob/main/README.zh-CN.md
37
- [plugin-index]: https://github.com/lobehub/lobe-chat-plugins
38
- [plugin-index-cn]: https://github.com/lobehub/lobe-chat-plugins/blob/main/README.zh-CN.md
39
- [plugin-sdk]: https://chat-plugin-sdk.lobehub.com
40
- [plugin-skd-cn]: https://chat-plugin-sdk.lobehub.com
50
+ <!-- LINK GROUP -->
@@ -73,5 +73,5 @@
73
73
  "dragDesc": "Drag and drop files here, support uploading multiple images. Hold down Shift to send images directly.",
74
74
  "dragTitle": "Upload Image"
75
75
  },
76
- "warp": "换行"
76
+ "warp": "Warp"
77
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.111.3",
3
+ "version": "0.111.5",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -30,6 +30,7 @@
30
30
  "build:analyze": "ANALYZE=true next build",
31
31
  "build:docker": "DOCKER=true next build",
32
32
  "dev": "next dev -p 3010",
33
+ "docs": "lobe-i18n md && npm run workflow:docs",
33
34
  "i18n": "npm run workflow:i18n && lobe-i18n",
34
35
  "lint": "npm run lint:ts && npm run lint:style && npm run type-check && npm run lint:circular",
35
36
  "lint:circular": "dpdm src/**/*.ts --warning false --tree false --exit-code circular:1 -T true",
@@ -46,6 +47,7 @@
46
47
  "test:coverage": "vitest run --coverage --passWithNoTests",
47
48
  "test:update": "vitest -u",
48
49
  "type-check": "tsc --noEmit",
50
+ "workflow:docs": "bun scripts/docsWorkflow/index.ts",
49
51
  "workflow:i18n": "ts-node --project ./tsconfig.json scripts/i18nWorkflow/index.ts",
50
52
  "workflow:readme": "bun scripts/readmeWorkflow/index.ts"
51
53
  },
@@ -153,18 +155,23 @@
153
155
  "dpdm": "^3",
154
156
  "eslint": "^8",
155
157
  "fake-indexeddb": "^5",
158
+ "glob": "^10",
156
159
  "husky": "^8",
157
160
  "jsdom": "^23.0.0",
158
161
  "lint-staged": "^15",
159
162
  "lodash": "^4",
160
163
  "markdown-table": "^3",
161
164
  "node-fetch": "^3",
165
+ "p-map": "^7",
162
166
  "prettier": "^3",
163
167
  "remark-cli": "^11",
168
+ "remark-parse": "^10",
164
169
  "semantic-release": "^21",
165
170
  "stylelint": "^15",
166
171
  "ts-node": "^10",
167
172
  "typescript": "^5",
173
+ "unified": "^11",
174
+ "unist-util-visit": "^5",
168
175
  "vitest": "0.34.6"
169
176
  },
170
177
  "publishConfig": {
@@ -0,0 +1,14 @@
1
+ import { globSync } from 'glob';
2
+ import { resolve } from 'node:path';
3
+
4
+ export const WIKI_URL = 'https://github.com/lobehub/lobe-chat/wiki/';
5
+ export const ROOT = resolve(__dirname, '../..');
6
+ export const DOCS_DIR = resolve(ROOT, 'docs');
7
+ export const HOME_PATH = resolve(DOCS_DIR, 'Home.md');
8
+ export const SIDEBAR_PATH = resolve(DOCS_DIR, '_Sidebar.md');
9
+ export const docsFiles = globSync(resolve(DOCS_DIR, '**/*.md'), {
10
+ ignore: ['Home.md', '_Sidebar.md', '_Footer.md'],
11
+ nodir: true,
12
+ }).filter((file) => !file.includes('.zh-CN.md'));
13
+
14
+ export const SPLIT = '<!-- DOCS LIST -->';
@@ -0,0 +1,73 @@
1
+ import { consola } from 'consola';
2
+ import { relative, resolve } from 'node:path';
3
+ import pMap from 'p-map';
4
+ import urlJoin from 'url-join';
5
+
6
+ import { DOCS_DIR, HOME_PATH, SIDEBAR_PATH, WIKI_URL, docsFiles } from './const';
7
+ import toc from './toc';
8
+ import { genMdLink, getTitle, updateDocs } from './utils';
9
+
10
+ const run = async () => {
11
+ consola.info(`Find ${docsFiles.length} entry doc files`);
12
+ const docs: any = await pMap(toc, async (item) => {
13
+ const childrenFiles = docsFiles.filter((file) => file.includes(resolve(DOCS_DIR, item.dir)));
14
+
15
+ const children: any = await pMap(childrenFiles, async (path) => {
16
+ const paths = {
17
+ cn: path.replace('.md', '.zh-CN.md'),
18
+ en: path,
19
+ };
20
+ const links = {
21
+ cn: urlJoin(WIKI_URL, relative(DOCS_DIR, paths.cn).split('/')[1].replace('.zh-CN.md', '')),
22
+ en: urlJoin(WIKI_URL, relative(DOCS_DIR, paths.en).split('/')[1].replace('.md', '')),
23
+ };
24
+ const titles = {
25
+ cn: await getTitle(paths.cn),
26
+ en: await getTitle(paths.en),
27
+ };
28
+ return {
29
+ links,
30
+ paths,
31
+ titles,
32
+ };
33
+ });
34
+ return {
35
+ children: children,
36
+ ...item,
37
+ };
38
+ });
39
+
40
+ let homeContent = '';
41
+ let sidebarContent = '';
42
+
43
+ docs.forEach((item: any) => {
44
+ homeContent += `### ${item.title}\n\n`;
45
+ sidebarContent += `#### ${item.title}\n\n`;
46
+ const data = [...(item.children || []), ...(item.extra || [])];
47
+ data
48
+ .sort((a, b) => {
49
+ if (a.links.en.includes('index')) return -1;
50
+ if (b.links.en.includes('index')) return 1;
51
+ return a.titles.en.localeCompare(b.titles.en);
52
+ })
53
+ .forEach((child: any) => {
54
+ homeContent += ` - ${genMdLink(child.titles.en, child.links.en)} | ${genMdLink(
55
+ child.titles.cn,
56
+ child.links.cn,
57
+ )}\n`;
58
+ sidebarContent += `- ${genMdLink(child.titles.en, child.links.en)} | ${genMdLink(
59
+ '中文',
60
+ child.links.cn,
61
+ )}\n`;
62
+ });
63
+ homeContent += `\n\n---\n\n`;
64
+ sidebarContent += `\n\n`;
65
+ });
66
+
67
+ updateDocs(HOME_PATH, homeContent);
68
+ consola.success(`Update Home.md`);
69
+ updateDocs(SIDEBAR_PATH, sidebarContent);
70
+ consola.success(`Update _Sidebar.md`);
71
+ };
72
+
73
+ run();