n8n-rag qdrant 知识库搭建

使用LM Studio选择模型下载

image

导入ollama

PS C:\Users\xxx\.lmstudio\models\Qwen\Qwen3-Embedding-4B-GGUF> echo "FROM C:\Users\25671\.lmstudio\models\Qwen\Qwen3-Embedding-4B-GGUF"  > Modelfile
PS C:\Users\xxx\.lmstudio\models\Qwen\Qwen3-Embedding-4B-GGUF> ollama create qwen3embedding -f Modelfile

n8n前置

https://github.com/n8n-io/self-hosted-ai-starter-kit

使用vscode打开桌面的project-n8n文件夹
打开vscode里的终端使用以下命令

git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git

拉取后vscode打开该git文件夹 (file open folder)

打开docker-compose.yaml 暴露postgres端口
  postgres:
    image: postgres:16-alpine
    hostname: postgres
    networks: ['demo']
    restart: unless-stopped
    ports:
    - 5432:5432
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB


.env.example 改为 .env
docker compose --profile cpu up



n8n使用

使用http://host.docker.internal:11434 访问windows的ollama
image
连接ollama成功

rag搭建 ai agent

1.form (on form submission) -> 2.qdrant vector store (add documents to vector store) -> 3.embeding model -> 4.default data loader(custom) -> 5.recursive character text splitter(chunk)
image
image
image
image
chunksize
文档在语义上非常简单,则可以切块少一点为400少一点
chunkoverlap
字符与块之间的重叠,为四分之一
image

搭建聊天工作流

image

image
嵌入式模型得一样,qdrant得id一样

image

添加表单进rag

image

image

image

成功

注意 使用n8n

image
windows写文件路径时需要用反斜杠\

posted @ 2025-07-07 10:28  supermao12  阅读(362)  评论(0)    收藏  举报