Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/docs_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docs CI

on:
pull_request:
paths:
- "docs/**"
- ".github/workflows/docs_ci.yml"
push:
branches: [master]
paths:
- "docs/**"
- ".github/workflows/docs_ci.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
Comment thread
sourcery-ai[bot] marked this conversation as resolved.
Resolved
with:
persist-credentials: false

- name: Setup pnpm
uses: pnpm/action-setup@v6.1.0
with:
version: 10.28.2

- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: "24.13.0"
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml

- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: ./docs

- name: Test LLM documentation generator
run: pnpm run docs:test
working-directory: ./docs

- name: Build documentation
run: pnpm run docs:build
working-directory: ./docs

- name: Verify generated documentation
working-directory: ./docs
run: |
test -f .vitepress/dist/llms.txt
test -f .vitepress/dist/llms-full.txt
test -f .vitepress/dist/llms-zh.txt
test -f .vitepress/dist/llms-en.txt
test -f .vitepress/dist/raw/zh/index.md
test -f .vitepress/dist/raw/en/index.md
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ yarn.lock
# Bundled dashboard dist (generated by hatch_build.py during pip wheel build)
astrbot/dashboard/dist/

# Generated documentation artifacts for AI agents
docs/public/llms*.txt
docs/public/raw/
docs/public/.llms-*

# Operating System
**/.DS_Store
.DS_Store
Expand Down
22 changes: 22 additions & 0 deletions docs/.vitepress/config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { relative } from "node:path";
import { defineConfig } from "vitepress";
import { head } from "./config/head";
import { rawMarkdownPathForPage } from "../scripts/generate-llms.mjs";

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -17,6 +19,26 @@ export default defineConfig({

lastUpdated: true,
ignoreDeadLinks: true,
srcExclude: ["public/raw/**"],

transformPageData(pageData, { siteConfig }) {
const sourceRelativePath = relative(siteConfig.srcDir, pageData.filePath);
const rawMarkdownPath = rawMarkdownPathForPage(sourceRelativePath);
if (!rawMarkdownPath || pageData.frontmatter.layout === false) {
return;
}

// Expose the original source to discoverable AI and developer tooling.
pageData.frontmatter.head ??= [];
pageData.frontmatter.head.push([
"link",
{
rel: "alternate",
type: "text/markdown",
href: rawMarkdownPath,
},
]);
},

locales: {
root: {
Expand Down
16 changes: 16 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,19 @@ _✨ 易上手的多平台 LLM 聊天机器人及开发框架(的官方文档

![image](https://github.com/user-attachments/assets/48f72a71-9456-4166-bbd2-f2a6c8cd740f)

## AI Agent 文档

文档构建会自动生成以下文件,不需要手动编辑或提交:

- `/llms.txt`:面向 AI Agent 的文档索引。
- `/llms-full.txt`:中英文完整文档。
- `/llms-zh.txt`、`/llms-en.txt`:按语言拆分的完整文档。
- `/raw/zh/...md`、`/raw/en/...md`:单篇 Markdown 原文。

本地生成和测试:

```bash
pnpm run docs:generate
pnpm run docs:test
```

6 changes: 4 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"scripts": {
"docs:dev": "vitepress dev --host",
"docs:build": "vitepress build",
"docs:generate": "node scripts/generate-llms.mjs",
"docs:test": "node --test tests/generate-llms.test.mjs",
"docs:dev": "node scripts/generate-llms.mjs && vitepress dev --host",
"docs:build": "node scripts/generate-llms.mjs && vitepress build",
"docs:preview": "vitepress preview"
},
"devDependencies": {
Expand Down
Loading
Loading