本地AI助手

CHIMERA是一个完全本地的AI助手,具备RAG、网页搜索和持久记忆功能,无需API密钥和云端服务,适用于需要隐私保护和高性能的AI应用场景。

  • by figgiee
  • JavaScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 figgiee/chimera

使用说明


奇美拉

具有RAG、网络搜索和持久内存的完全本地AI助手。

完全在您的硬件上运行。没有API密钥。没有云。没有遥测。



入门指南 · 建筑 · MCP工具 · API 参考 · 配置




奇美拉是什么?

奇美拉连接 LM 工作室 通过 模型上下文协议。您当地的法学硕士获得了真正的能力:

知识与搜索

  • 通过pgvector进行语义文档搜索
  • 跨11个引擎的网络搜索(SearXNG)
  • 通过Context7获取实时库文档

记忆与互动

  • 具有语义回忆的会话记忆
  • 持久知识图
  • 文件系统访问(读/写/搜索)

文档处理

  • 上传并索引PDF、DOCX、TXT、MD
  • 使用TEI批量嵌入
  • 余弦相似度排名

愿景与分析

  • 屏幕截图与分析
  • PDF文本提取
  • 多模态视觉模型

[!重要] 所有处理都在本地进行。文档嵌入在您的计算机上,存储在您的数据库中,永远不会离开您的网络。


建筑

                          ┌─────────────────────────────────┐
                          │         LM Studio (Host)         │
                          │     Qwen 3.5 · localhost:1234    │
                          └───────────────┬─────────────────┘
                                          │ MCP (stdio)
                 ┌────────────────────────┼────────────────────────┐
                 │                        │                        │
        ┌────────┴────────┐    ┌──────────┴──────────┐    ┌───────┴───────┐
        │   chimera-rag   │    │  searxng · filesys   │    │  memory · pdf │
        │   (custom MCP)  │    │  context7 · screenshot│    │  (stdlib MCP) │
        └────────┬────────┘    └──────────┬──────────┘    └───────────────┘
                 │                        │
                 ▼                        ▼
  ┌──────────────────────────────────────────────────────────────────┐
  │                        Docker Network                            │
  │                                                                  │
  │  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐      │
  │  │  PostgreSQL   │    │     TEI      │    │   SearXNG    │      │
  │  │  + pgvector   │    │  embeddings  │    │  meta-search │      │
  │  │  port 5432    │    │  port 8001   │    │  port 8888   │      │
  │  └──────┬───────┘    └──────┬───────┘    └──────┬───────┘      │
  │         └───────────────────┼───────────────────┘               │
  │                      ┌──────┴──────┐                            │
  │                      │  RAG Server │                            │
  │                      │  FastAPI    │                            │
  │                      │  port 8080  │                            │
  │                      └─────────────┘                            │
  └──────────────────────────────────────────────────────────────────┘

back to top


入门指南

先决条件

要求 最低要求 建议
图形处理器 8GB VRAM 16GB VRAM
随机存取存储器 16GB 64GB
软件 Docker 桌面版, LM 工作室, Node.js 18+ —

第一步——克隆并启动Docker

git clone https://github.com/figgiee/chimera.git
cd chimera/rag-setup
docker compose up -d

[!提示] 首次启动需要大约3GB的Docker镜像,需要2-3分钟。后续启动是即时的。

等待健康检查:

docker compose ps    # all 4 services should show "healthy"

第二步——启动LM Studio

  1. 打开LM Studio并加载模型
  2. 在端口上启动服务器 1234
  3. 复制 mcp.json 到LM Studio配置(请参阅 配置)

步骤3——将Docker连接到LM Studio

LM Studio绑定到 localhost 只有。Docker容器需要一个端口代理才能访问它:

# Run once in Admin PowerShell — persists across reboots
netsh interface portproxy add v4tov4 listenport=1234 listenaddress=0.0.0.0 connectport=1234 connectaddress=127.0.0.1

步骤4——验证

curl http://localhost:8080/health
{
  "status": "ok",
  "services": {
    "database": "ok",
    "embeddings": "ok",
    "search": "ok",
    "llm_studio": "ok"
  }
}

[!注意] 如果 llm_studio 显示错误,请确保LM Studio正在运行并且端口代理已设置(步骤3)。

back to top


MCP工具

奇美拉提供 7台MCP服务器 通过LM Studio的插件系统,您可以访问LLM工具。

奇美拉抹布-- 定制RAG管道

工具 说明
search_documents 具有可配置相似性阈值的跨索引文档的语义向量搜索
upload_document 通过自动分块和嵌入上传和索引文档(PDF、DOCX、TXT、MD)
list_documents 列出所有带有ID、文件名和内容预览的索引文档
delete_document 从知识库中删除文档及其所有嵌入
store_conversation 通过语义嵌入保存对话回合以用于长期记忆
recall_conversation 使用语义相似性搜索过去的对话
rag_health 检查所有RAG管道服务的健康状况

外部MCP服务器

服务器 源 功能
搜索引擎 mcp searxng 跨11个引擎(DuckDuckGo、谷歌、必应、维基百科、arXiv、GitHub、Brave等)的尊重隐私的元搜索
文件系统 @模型上下文协议/服务器文件系统 跨配置的目录读取、写入、搜索和管理文件
记忆 @模型上下文协议/服务器内存 跨会话实体和关系的持久知识图
pdf阅读器 mcp pdf阅读器 高级PDF文本提取和结构化阅读
截图 mcp屏幕截图 用于视觉模型分析的屏幕截图
上下文7 @upush/context7 mcp 按需查找最新的图书馆文档

back to top


Docker服务

Service Image Port Description
chimera-rag-server python:3.11-slim (custom) 8080 FastAPI orchestrator — handles document upload, search, conversation memory, and LM Studio integration
chimera-postgres pgvector/pgvector:pg15 5432 PostgreSQL with pgvector extension — stores 384-dimensional embeddings with cosine similarity search
chimera-tei ghcr.io/huggingface/text-embeddings-inference 8001 HuggingFace Text Embeddings Inference — runs all-MiniLM-L6-v2 for fast vectorization
chimera-searxng searxng/searxng:latest 8888 Privacy-respecting meta-search engine — aggregates 11 search backends with no API keys

back to top


API 参考

GET /health — Service health check
curl localhost:8080/health
{
  "status": "ok",
  "timestamp": "2026-03-11T07:45:09.469968",
  "services": {
    "database": "ok",
    "embeddings": "ok",
    "search": "ok",
    "llm_studio": "ok"
  }
}
POST /api/search — Semantic document search
curl -X POST localhost:8080/api/search \
  -H "Content-Type: application/json" \
  -d '{"query": "machine learning", "limit": 5, "threshold": 0.3}'
参数 类型 默认值 说明
query 字符串 必需的 搜索查询文本
limit int 5 返回的最大结果
threshold 浮子 0.3 最小余弦相似度(0-1)
POST /api/documents/upload — Upload and index a document
curl -X POST localhost:8080/api/documents/upload -F "file=@paper.pdf"

支持: .pdf, .docx, .txt, .md

文档会自动分块,通过TEI以32个为一批嵌入,并存储在pgvector中。

GET /api/documents — List indexed documents
curl localhost:8080/api/documents

返回所有文档及其ID、文件名、上传时间戳和内容预览。

DELETE /api/documents/{id} — Delete a document
curl -X DELETE localhost:8080/api/documents/{document_id}

从数据库中删除文档和所有关联的嵌入。

POST /api/conversations/store — Store a conversation turn
curl -X POST localhost:8080/api/conversations/store \
  -H "Content-Type: application/json" \
  -d '{"conversation_id": "research-1", "role": "user", "content": "What is RAG?"}'
参数 类型 说明
conversation_id string 唯一对话标识符
role 字符串 user 或 assistant
content string 要嵌入和存储的消息内容
POST /api/conversations/recall — Recall past conversations
curl -X POST localhost:8080/api/conversations/recall \
  -H "Content-Type: application/json" \
  -d '{"query": "RAG architecture", "limit": 5}'
参数 类型 默认值 说明
query 字符串 必需的 语义搜索查询
conversation_id 字符串 null 仅限于特定对话
limit int 5 最大结果

back to top


配置

MCP服务器配置

将此复制到LM Studio MCP配置(~/.lmstudio/mcp.json),将路径替换为您的安装位置:

mcp.json
{
  "mcpServers": {
    "chimera-rag": {
      "command": "node",
      "args": ["<CHIMERA_PATH>/mcp-chimera-rag/index.js"],
      "env": { "RAG_SERVER_URL": "http://localhost:8080" }
    },
    "searxng-search": {
      "command": "node",
      "args": ["<CHIMERA_PATH>/mcp-searxng/dist/index.js"],
      "env": { "SEARXNG_URL": "http://localhost:8888" }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "~/Desktop", "~/Documents", "~/Downloads"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "pdf-reader": {
      "command": "node",
      "args": ["<CHIMERA_PATH>/mcp-pdf-reader/dist/index.js"]
    },
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp@latest"]
    },
    "screenshot": {
      "command": "node",
      "args": ["<CHIMERA_PATH>/mcp-screenshot/dist/index.js"]
    }
  }
}

系统提示

Chimera的推荐系统提示在设计上是最小的——小型模型在简洁的说明下表现更好:

Optimized system prompt (~120 tokens)
You are Chimera, a local AI assistant. Use your tools proactively. Be concise — lead with the answer.

Images, text, and code shared in chat are already in your context. Respond directly.

For dates, versions, current events, or anything time-sensitive: web_search first, then answer.

For questions that might relate to past sessions: recall_conversation to check, then answer.

After significant exchanges (research, analysis, problem-solving): store_conversation with a descriptive conversation_id.

If a tool fails, try an alternative approach. If a file path is given, read it immediately.

推荐模型

用例 型号 VRAM 速度
每日驱动程序 Qwen 3.5-9B Q4_K_M ~7 GB ~93 tok/s
繁重任务 Qwen 3.5-35B-A3B Q4_K_M ~14 GB ~18 tok/s
低VRAM 3.5-9B Q3_K_M ~5 GB ~100 tok/s

LM工作室设置(适用于35B型号)

设置 值 注释
上下文长度 16384 越高=VRAM越多,速度越慢
GPU卸载 25 层卸载到GPU
CPU线程数 24 为操作系统留出空间
并发预测 1 避免上下文分割

back to top


项目结构

chimera/
├── rag-setup/                     # Docker infrastructure + RAG server
│   ├── docker-compose.yml         # 4-service orchestration
│   ├── Dockerfile                 # RAG server image (Python 3.11)
│   ├── app.py                     # FastAPI application
│   ├── db.py                      # SQLAlchemy models + pgvector ops
│   ├── embeddings.py              # TEI client (embed + batch)
│   ├── search.py                  # Document search + SearXNG client
│   ├── llm.py                     # LM Studio health + model detection
│   ├── init.sql                   # pgvector extension bootstrap
│   ├── requirements.txt           # Python dependencies
│   ├── searxng-settings.yml       # 11 search engine configs
│   ├── documents/                 # Uploaded document storage
│   └── scripts/
│       ├── manage.sh              # Service management CLI
│       └── ingest-documents.py    # Batch document processor
│
├── mcp-chimera-rag/               # Custom MCP server
│   ├── index.js                   # 7 tool definitions + handlers
│   └── package.json
│
├── .env.example                   # Environment template
├── .gitignore
├── LICENSE
└── README.md

back to top


管理

cd rag-setup

./scripts/manage.sh start       # Start all services
./scripts/manage.sh stop        # Stop all services
./scripts/manage.sh restart     # Restart all services
./scripts/manage.sh rebuild     # Rebuild RAG server after code changes
./scripts/manage.sh health      # Check all service endpoints
./scripts/manage.sh logs        # Tail all logs (or: logs rag-server)
./scripts/manage.sh db-backup   # Backup PostgreSQL to ./backups/
./scripts/manage.sh reset       # Nuclear reset — destroys all data

硬件要求

要求 最低要求 建议
随机存取存储器 16gb 32Gb+
GPU VRAM 8 GB 16 GB+
操作系统 Windows 10、macOS 12或Linux --
软件 Docker桌面、LM Studio、Node.js 20+ --

Chimera完全在本地运行-无需云,无需API密钥。性能取决于您在LM Studio中加载的模型。

back to top



建于 LM 工作室 · pg向量 · 瑟克斯NG · 拥抱脸TEI · 主控程序


MIT许可证