From 0878f2b243dee13fa248d0b46a9ab712a9bc2a0e Mon Sep 17 00:00:00 2001 From: canisminor1990 Date: Thu, 14 Dec 2023 17:33:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20Add=20wiki=20toc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Deployment/Analytics.md | 5 +++++ docs/Deployment/Analytics.zh-CN.md | 5 +++++ docs/Deployment/Docker-Deployment.md | 7 +++++++ docs/Deployment/Docker-Deployment.zh-CN.md | 7 +++++++ docs/Development/Architecture.md | 10 ++++++++++ docs/Development/Architecture.zh-CN.md | 10 ++++++++++ docs/Development/Chat-API.md | 9 +++++++++ docs/Development/Chat-API.zh-CN.md | 9 +++++++++ docs/Development/Feature-Development.md | 8 ++++++++ docs/Development/Feature-Development.zh-CN.md | 8 ++++++++ docs/Development/Steup-Development.md | 7 +++++++ docs/Development/Steup-Development.zh-CN.md | 7 +++++++ docs/Development/Test.md | 8 ++++++++ docs/Development/Test.zh-CN.md | 8 ++++++++ docs/Development/index.md | 5 +++++ docs/Development/index.zh-CN.md | 5 +++++ 16 files changed, 118 insertions(+) diff --git a/docs/Deployment/Analytics.md b/docs/Deployment/Analytics.md index 8a477f125b36a..0f5c44fd9eab5 100644 --- a/docs/Deployment/Analytics.md +++ b/docs/Deployment/Analytics.md @@ -2,6 +2,11 @@ To better analyze the usage of LobeChat users, we have integrated several free/open-source data statistics services in LobeChat for collecting user usage data, which you can enable as needed. +#### TOC + +- [Vercel Analytics](#vercel-analytics) +- [🚧 Posthog](#-posthog) + ## Vercel Analytics [Vercel Analytics](https://vercel.com/analytics) is a data analysis service launched by Vercel, which can help you collect website visit information, including traffic, sources, and devices used for access. diff --git a/docs/Deployment/Analytics.zh-CN.md b/docs/Deployment/Analytics.zh-CN.md index aed5465041a5f..44a6c216fde14 100644 --- a/docs/Deployment/Analytics.zh-CN.md +++ b/docs/Deployment/Analytics.zh-CN.md @@ -2,6 +2,11 @@ 为更好地帮助分析 LobeChat 的用户使用情况,我们在 LobeChat 中集成了若干免费 / 开源的数据统计服务,用于收集用户的使用情况,你可以按需开启。 +#### TOC + +- [Vercel Analytics](#vercel-analytics) +- [🚧 Posthog](#-posthog) + ## Vercel Analytics [Vercel Analytics](https://vercel.com/analytics) 是 Vercel 推出的一款数据分析服务,它可以帮助你收集网站的访问情况,包括访问量、访问来源、访问设备等等。 diff --git a/docs/Deployment/Docker-Deployment.md b/docs/Deployment/Docker-Deployment.md index e854e6a2b082e..dc8846e2f78f7 100644 --- a/docs/Deployment/Docker-Deployment.md +++ b/docs/Deployment/Docker-Deployment.md @@ -6,6 +6,13 @@ We provide [Docker Images][docker-release-link] for you to deploy LobeChat service on your private device. +#### TOC + +- [Install Docker container environment](#install-docker-container-environment) +- [Deploy container image](#deploy-container-image) + - [`A` Command deployment (recommended)](#a-command-deployment-recommended) + - [`B` Docker Compose](#b-docker-compose) + ## Install Docker container environment If already installed, skip this step. diff --git a/docs/Deployment/Docker-Deployment.zh-CN.md b/docs/Deployment/Docker-Deployment.zh-CN.md index e01df6f2c05d7..253cc7f3e069a 100644 --- a/docs/Deployment/Docker-Deployment.zh-CN.md +++ b/docs/Deployment/Docker-Deployment.zh-CN.md @@ -6,6 +6,13 @@ 我们提供了 [Docker 镜像][docker-release-link],供你在自己的私有设备上部署 LobeChat 服务 +#### TOC + +- [安装 Docker 容器环境](#安装-docker-容器环境) +- [部署容器镜像](#部署容器镜像) + - [`A` 指令部署(推荐)](#a-指令部署推荐) + - [`B` Docker Compose](#b-docker-compose) + ## 安装 Docker 容器环境 如果已安装,请跳过此步 diff --git a/docs/Development/Architecture.md b/docs/Development/Architecture.md index 65b965e5b5348..dd812bd555c5b 100644 --- a/docs/Development/Architecture.md +++ b/docs/Development/Architecture.md @@ -2,6 +2,16 @@ LobeChat is an AI conversation 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. diff --git a/docs/Development/Architecture.zh-CN.md b/docs/Development/Architecture.zh-CN.md index d7be09552c40c..865a48c45bb9f 100644 --- a/docs/Development/Architecture.zh-CN.md +++ b/docs/Development/Architecture.zh-CN.md @@ -2,6 +2,16 @@ LobeChat 是一个基于 Next.js 框架构建的 AI 会话应用,旨在提供一个 AI 生产力平台,使用户能够与 AI 进行自然语言交互。以下是 LobeChat 的架构设计介稿: +#### TOC + +- [应用架构概览](#应用架构概览) +- [前端架构](#前端架构) +- [Edge Runtime API](#edge-runtime-api) +- [Agents 市场](#agents-市场) +- [插件市场](#插件市场) +- [安全性和性能优化](#安全性和性能优化) +- [开发和部署流程](#开发和部署流程) + ## 应用架构概览 LobeChat 的整体架构由前端、EdgeRuntime API、Agents 市场、插件市场和独立插件组成。这些组件相互协作,以提供完整的 AI 体验。 diff --git a/docs/Development/Chat-API.md b/docs/Development/Chat-API.md index 17b4aad32d5bd..682e7142e2e2b 100644 --- a/docs/Development/Chat-API.md +++ b/docs/Development/Chat-API.md @@ -2,6 +2,15 @@ The implementation of LobeChat's large model AI mainly relies on OpenAI's API, including the core conversation API on the backend and the integrated API on the frontend. Next, we will introduce the implementation approach and code for the backend and frontend separately. +#### TOC + +- [Backend Implementation](#backend-implementation) + - [Core Conversation API](#core-conversation-api) + - [Conversation Result Processing](#conversation-result-processing) +- [Frontend Implementation](#frontend-implementation) + - [Frontend Integration](#frontend-integration) + - [Using Streaming to Get Results](#using-streaming-to-get-results) + ## Backend Implementation The following code removes authentication, error handling, and other logic, retaining only the core functionality logic. diff --git a/docs/Development/Chat-API.zh-CN.md b/docs/Development/Chat-API.zh-CN.md index f6ce525400813..71aca2a5ee148 100644 --- a/docs/Development/Chat-API.zh-CN.md +++ b/docs/Development/Chat-API.zh-CN.md @@ -2,6 +2,15 @@ LobeChat 的大模型 AI 实现主要依赖于 OpenAI 的 API,包括后端的核心会话 API 和前端的集成 API。接下来,我们将分别介绍后端和前端的实现思路和代码。 +#### TOC + +- [后端实现](#后端实现) + - [核心会话 API](#核心会话-api) + - [会话结果处理](#会话结果处理) +- [前端实现](#前端实现) + - [前端集成](#前端集成) + - [使用流式获取结果](#使用流式获取结果) + ## 后端实现 以下代码中移除了鉴权、错误处理等逻辑,仅保留了核心的主要功能逻辑。 diff --git a/docs/Development/Feature-Development.md b/docs/Development/Feature-Development.md index 98e9df630ab94..81c5ef796b9c3 100644 --- a/docs/Development/Feature-Development.md +++ b/docs/Development/Feature-Development.md @@ -10,6 +10,14 @@ 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. diff --git a/docs/Development/Feature-Development.zh-CN.md b/docs/Development/Feature-Development.zh-CN.md index 4b75dad137b92..13a3fd251ef19 100644 --- a/docs/Development/Feature-Development.zh-CN.md +++ b/docs/Development/Feature-Development.zh-CN.md @@ -10,6 +10,14 @@ 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 组件作为页面的主体。 diff --git a/docs/Development/Steup-Development.md b/docs/Development/Steup-Development.md index 96dccdec12660..ca7263ac317c2 100644 --- a/docs/Development/Steup-Development.md +++ b/docs/Development/Steup-Development.md @@ -2,6 +2,13 @@ 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: diff --git a/docs/Development/Steup-Development.zh-CN.md b/docs/Development/Steup-Development.zh-CN.md index cbd28530b7555..80da7fdca173f 100644 --- a/docs/Development/Steup-Development.zh-CN.md +++ b/docs/Development/Steup-Development.zh-CN.md @@ -2,6 +2,13 @@ 欢迎阅读 LobeChat 的开发环境设置指南。 +#### TOC + +- [在线开发](#在线开发) +- [本地开发](#本地开发) + - [开发环境需求](#开发环境需求) + - [项目设置](#项目设置) + ## 在线开发 如果你有 GitHub Codespaces 的使用权限,可以点击下方按钮一键进入在线开发环境: diff --git a/docs/Development/Test.md b/docs/Development/Test.md index 3ec3f7ffcc1ca..4a50d3e1ef324 100644 --- a/docs/Development/Test.md +++ b/docs/Development/Test.md @@ -2,6 +2,14 @@ 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. diff --git a/docs/Development/Test.zh-CN.md b/docs/Development/Test.zh-CN.md index 9cdfa26dec3df..8b520d70e9978 100644 --- a/docs/Development/Test.zh-CN.md +++ b/docs/Development/Test.zh-CN.md @@ -2,6 +2,14 @@ LobeChat 的测试策略包括单元测试和端到端 (E2E) 测试。下面是每种测试的详细说明: +#### TOC + +- [单元测试](#单元测试) +- [🚧 端到端测试](#-端到端测试) +- [开发测试](#开发测试) + - [1. 单元测试](#1-单元测试) +- [测试策略](#测试策略) + ## 单元测试 单元测试用于测试应用中的独立单元(如组件、函数、工具函数等)的功能。我们使用 [vitest][vitest-url] 进行单元测试。 diff --git a/docs/Development/index.md b/docs/Development/index.md index e90a0602909d4..086a80ad9968e 100644 --- a/docs/Development/index.md +++ b/docs/Development/index.md @@ -2,6 +2,11 @@ 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. +#### TOC + +- [Basic Technology Stack](#basic-technology-stack) +- [Folder Directory Structure](#folder-directory-structure) + ## Basic Technology Stack The core technology stack of LobeChat includes: diff --git a/docs/Development/index.zh-CN.md b/docs/Development/index.zh-CN.md index f042779e3c0b2..5fc4d3a51268d 100644 --- a/docs/Development/index.zh-CN.md +++ b/docs/Development/index.zh-CN.md @@ -2,6 +2,11 @@ 欢迎来到 LobeChat 技术开发上手指南。LobeChat 是一款基于 Next.js 框架构建的 AI 会话应用,它汇集了一系列的技术栈,以实现多样化的功能和特性。本指南将详细介绍 LobeChat 的主要技术组成,以及如何在你的开发环境中配置和使用这些技术。 +#### TOC + +- [基础技术栈](#基础技术栈) +- [文件夹目录架构](#文件夹目录架构) + ## 基础技术栈 LobeChat 的核心技术栈如下: