SillyTavern-Docs-RAG:为 RAG 清洗 SillyTavern 文档的自动化流水线
Pavdig/SillyTavern-Docs-RAG
该项目是源自 SillyTavern-Docs Issue #183 的 PoC,通过自动化流水线镜像并清洗官方 SillyTavern 文档,解决 RAG 知识库摄入时的 token 噪声与嵌套目录解析问题。
Note: This is a Proof of Concept (PoC) project initiated from SillyTavern-Docs Issue #183. It aims to solve the problem of "token noise" and nested directory parsing issues when ingesting SillyTavern documentation into RAG knowledge bases (like Open WebUI).
This repository hosts a fully automated pipeline that mirrors, processes, and sanitizes the official SillyTavern Documentation.
The goal is to create a "flat" and clean set of Markdown files optimized for AI ingestion. It also generates single-file bundles (llms.txt, llms.md, and llms.json) for easy drag-and-drop context in LLMs like ChatGPT or Claude.
📥 Downloads
Go to the Releases Page to download the latest RAG-ready ZIP package.
🛠️ Usage for RAG
Option 1: Knowledge Bases (e.g., Open WebUI)
- Download the latest
.zipfrom Releases. - Extract the
docs/folder. - Upload the files to your RAG Knowledge Base.
Option 2: Single-File Context (ChatGPT, Claude, etc.)
- Download the
.zipor view the files in the repo root. - Use
llms.txtorllms.md: Drag and drop this single file into a "Project" or long-context chat window. It contains the entire documentation in one readable file. Both files are identical in content —llms.mdis provided for tools that prefer a.mdextension. - Use
llms.json: For programmatic ingestion or tools that support JSON knowledge dumps.
⚙️ How it Works
The automation pipeline runs on a schedule to keep this repo in sync with SillyTavern documentation development — no manual intervention required.
1. The Build Process
Sanitization (sanitize_docs.py)
- Clone Upstream: Pulls the latest docs from the official repository.
- Flatten Structure: Converts nested folders into flat filenames to preserve context for the AI.
- Example:
SillyTavern-Docs/Installation/Windows.md→SillyTavern_Installation_Windows.md
- Example:
- Sanitize Content: Removes noise that confuses LLMs:
- Redirect stubs: Files that just say "Page moved" are skipped entirely.
- Front Matter: Metadata headers (
---) are stripped. - Screenshots: The entire "Screenshots" section is removed from files.
- Admonitions: Tags like
!!!warningand:::tipare stripped, but titles and body text are preserved. - Images: All image tags are removed entirely to reduce token usage.
- Internal links: Resolved and rewritten to match the flat output filenames (e.g.
[text](../foo/bar.md)→[text](SillyTavern_foo_bar.md)). Unresolvable links fall back to plain text. - External links: Converted to
Name (URL)format. - Empty table rows and
<br>tags: Cleaned up to reduce formatting noise.
Bundle Generation (generate_rag_bundle.py)
- Sort: Files are ordered logically for reading coherence — Readme → Installation → Usage → Administration → Extensions → Contributors → everything else.
- Strip remaining links: Any internal links still present after sanitization are reduced to plain text at the bundle stage.
- Generate Bundles: Aggregates all processed files into:
llms.txt/llms.md— identical single-file text bundles, one per extension.llms.json— structured JSON with one entry per doc section.
2. The Update Cycle (CI/CD)
The pipeline is fully automated end-to-end:
- Check: Every hour, the bot checks the official SillyTavern-Docs for changes.
- Process: If updates are found, docs are sanitized and bundles are regenerated.
- Commit: Changes are committed directly to
mainwith a descriptive message linking back to the upstream source commit. If multiple updates happen in one day, commits are namedSync: Docs Update YYYY-MM-DD,Sync: Docs Update YYYY-MM-DD - Update 2, and so on. - Release: The commit to
mainautomatically triggers a GitHub Release with a date-stamped ZIP file. Multiple releases in one day are taggedrelease-Mon-DD-YYYY,release-Mon-DD-YYYY-update-2, etc. - No-op guard: If the processed output is identical to what's already on
main, nothing is pushed and no release is created.
🎖️ Credits
来源:GitHub · github.com