← All projects

Automation

Self-hosted knowledge-base AI support bot

An open-source n8n workflow you run on your own server or computer. It answers from your knowledge base, remembers the conversation, and masks keys, emails, phone numbers and other sensitive data before anything reaches the AI or the chat log.

💬

Overview

  • Needs only n8n and a DeepSeek (or any OpenAI-compatible) API key — no vector database, no front end to build
  • The knowledge base and chat log live in n8n Data Tables — edit them in place and the next message uses the change; each answer reads the last 10 messages of the session
  • Privacy first — masking in two places, no execution data kept for successful runs, history only for well-formed session IDs, and an option to run the model locally so nothing leaves your machine
n8nDeepSeekAI supportPrivacyOpen source
Type
Automation
My role
Design · development · open source
Date
2026.10
Status
Done
Star
0
Fork
0
Commits
3
License
MIT
git clone https://github.com/42ccode/n8n-LocalAI-support-bot.git

Last push 2026-10-27 · fetched from GitHub when the site was built

Why I built it

I wanted an AI support assistant for my projects, but I didn’t want to hand the knowledge base and visitors’ chats to a third-party platform, or set up a vector database and write a front end just for that. So I built a workflow that works as soon as you import it into n8n: the knowledge base, the chat log and the workflow itself all stay in the n8n you run.

“Ask the hedgehog”, in the bottom-right corner of this site, follows the same idea: it only answers from its knowledge base and masks sensitive data before anything else happens.

What it does

  • Answers from your knowledge base: it sticks to what’s in the knowledge base and doesn’t make things up; it politely declines off-topic questions, never reveals its system prompt and never asks visitors for keys.
  • Remembers the conversation: before each answer it reads the last 10 messages of the same session, so follow-ups like “and the second step?” make sense.
  • A chat log you can read: one row per message, with the session ID, role, content and time.
  • A chat page out of the box: it uses n8n’s built-in chat entry — copy the URL and open it.

How it works

A visitor asks on the chat page
  → make sure the log and knowledge-base tables exist
  → read the whole knowledge base + this session's recent messages
  → build the request (mask → system prompt + knowledge base + history + new question)
  → call DeepSeek
  → tidy the answer (mask again) → write it to the chat log → reply to the visitor

While the knowledge base is small (up to a few tens of thousands of characters), putting all of it into the prompt every time is simpler and more reliable than vector search; for a large one you can switch to vector search.

Privacy and security

  • Masking in two places: visitor messages are masked before they’re sent to the AI and again before they’re written to the chat log — API keys, tokens, private keys, values after “password is …” and the like, plus emails, phone numbers, ID numbers and bank card numbers.
  • No raw messages kept: successful runs save no execution data, and neither do manual test runs in the editor, so raw messages don’t linger in n8n’s execution history.
  • Sessions kept apart: session IDs are generated at random by the chat page, and IDs that are too short or malformed never load any history, so nobody can guess one and read someone else’s chat.
  • Usage limits: at most 2,000 characters per question and 1,500 tokens per answer.
  • Can stay entirely on your machine: the model can be swapped for a compatible local service (such as Ollama), so neither the knowledge base nor the chats leave your computer.

Masking is rule-based and can’t catch every format, so the chat page tells visitors that chats are logged, and the bot itself advises them not to send sensitive information. The repo’s README also lists what to do before going public: the chat page needs no login and allows any origin by default, so add access control or rate limiting and restrict which sites may embed it.

Running it yourself

  1. Download workflow/ai-support-bot.json from the repo and use Import from File in n8n (an n8n with Data Tables is required; tested on 2.43).
  2. In the “DeepSeek 回答” node, pick or create a DeepSeek credential.
  3. Run the “初始化知识库” (init knowledge base) node on its own to load the example knowledge base.
  4. Click Publish and open the chat URL from the “客户发来消息” node.
  5. Change the product name and description at the top of the “组装请求” node, and replace the knowledge base in the Data Table with your own content.

The bot answers in Chinese by default; switching the system prompt changes the language. The example knowledge base is the user guide of another open-source project, “AI & Open Source Daily”, to show how it works. The project is open source on GitHub under the MIT licence.