一个围绕王小波作品和思想线索构建的 RAG 聊天项目,包含 Web 聊天界面、Node.js 服务端、本地 RAG 构建脚本,以及一个 Android WebView 壳工程。
A Wang Xiaobo themed RAG chat project with a web chat UI, Node.js backend, local corpus-building scripts, and an Android WebView wrapper.
-
Web 聊天界面:支持聊天记录、本地用户标识、回答来源、导出对话长图。
-
RAG 服务端:本地检索语料片段,结合 DeepSeek/OpenAI-compatible API 生成回答。
-
监控页:统计缓存、Token 估算、会话和模型调用情况。
-
Android 壳:使用 WebView 打开部署后的 Web 服务。
-
Web chat UI with conversation history, local user identity, source display, and long-image export.
-
RAG backend that searches local corpus chunks and calls a DeepSeek/OpenAI-compatible model API.
-
Monitoring page for cache, token estimates, conversations, and model usage.
-
Android WebView wrapper for the deployed web service.
为了适合公开上传,仓库不包含以下内容:
- API key、SSH key、服务器 IP/域名、Nginx 线上配置
- 完整原文语料、压缩包、生成后的 RAG JSONL/索引
- 聊天记录、头像缓存、模型回复缓存、日志
- APK、Gradle build 目录和本机 SDK 配置
For public release, this repository excludes secrets, server details, full source corpus, generated RAG indexes, runtime cache, logs, APKs, Gradle build output, and local SDK configuration.
deploy/wxb-rag-chat/ Web app and Node.js server
android-wxb-app/ Android WebView wrapper source
rag/ Local RAG data notes
docs/screenshots/ README screenshots
*.py Corpus and local retrieval scripts
先用你有权使用的本地语料生成 RAG 数据:
python .\build_wxb_rag_corpus.py
python .\build_wxb_vector_index.py把生成的 rag/ 文件复制到 deploy/wxb-rag-chat/rag/,然后启动 Web 服务:
cd deploy\wxb-rag-chat
copy .env.example .env
# 在 .env 中填入 DEEPSEEK_API_KEY
node server.js访问:
http://127.0.0.1:6868/
http://127.0.0.1:6868/monitor
Generate RAG data from your own authorized local corpus, copy the generated files into deploy/wxb-rag-chat/rag/, configure .env, and start the server with node server.js.
cd android-wxb-app
.\gradlew.bat assembleDebug默认打开地址在 android-wxb-app/app/src/main/res/values/strings.xml 中配置。公开版使用 https://example.com/xiaobo/ 占位,部署后请改成你自己的 HTTPS 地址。
The Android wrapper URL is configured in android-wxb-app/app/src/main/res/values/strings.xml. The public repo uses https://example.com/xiaobo/ as a placeholder.
node --check deploy\wxb-rag-chat\server.js
node --input-type=module -e "import('./deploy/wxb-rag-chat/lib/rag-search.js').then(() => console.log('ok'))"