Перейти к содержанию
НОВОЕПознакомьтесь с Alaaddin — вашим ИИ-джинном с голосом. trig8n запускается 1 января 2027. Что нового

Библиотека / RAG и базы знаний

RAG и базы знаний

Наполнение векторной базы знаний Supabase из Notion с эмбеддингами через Ollama

Запускается вручную: читает страницы Notion, создаёт эмбеддинги локальной моделью Ollama и сохраняет их в таблицу pgvector в Supabase для поиска.

Что делает

## Prerequisites ### 1. Notion: create an integration - Go to https://www.notion.so/my-integrations - Click "New integration" and give it a name - Copy the Internal Integration Token (you will need it in Step 4) - In your Notion database, click Share → Invite your integration ### 2. Supabase: enable pgvector and create the table In your Supabase project, open the SQL Editor from the left sidebar and run: sql create extension if not exists vector; create table documents ( id bigserial primary key, content text, metadata jsonb, embedding vector(768) ); create or replace function match_documents ( query_embedding vector(768), match_count int default 5, filter jsonb default '{}' ) returns table ( id bigint, content text, metadata jsonb, similarity float ) language plpgsql as $$ begin return query select documents.id, documents.content, documents.metadata, 1 - (documents.embedding query_embedding) as similarity from documents where documents.metadata @> filter order by documents.embedding query_embedding limit match_count; end; $$; ### 3. Ollama: running locally - Install Ollama: https://ollama.com - Pull the embedding model: ollama pull nomic-embed-text - Make sure Ollama is running before executing this workflow ### 4. Add credentials in n8n In n8n, go to Settings → Credentials → Add Credential and create: Notion API (type: Notion API): - Internal Integration Token → paste the token copied in Step 1 Supabase (type: Supabase): - Host URL → Supabase Dashboard → Settings → API → Project URL - Service Role Secret → same page, under "Project API keys" → service_role Ollama (type: Ollama): - Base URL → http://localhost:11434 ### 5. Connect credentials to nodes Open each node that shows a credential warning and select the matching credential from the dropdown. ### 6. Configure the Remove Existing Embeddings node Open the Remove Existing Embeddings node and replace YOUR_SUPABASE_PROJECT_URL with your Supabase project URL (found in Supabase Dashboard → Settings → API → Project URL). Select your Supabase credential from the dropdown. This node runs at the start of every execution and clears all documents from the knowledge base before re-inserting fresh content, so re-running the workflow never creates duplicates.

Шаги

  1. Start Notion Ingestion
  2. Get Notion Pages
  3. Fetch Page Blocks
  4. Aggregate Block Text
  5. Insert into Knowledge Store
  6. Generate Embeddings Ollama
  7. Load Default Data
  8. Split Text for Processing
  9. Schedule Sync
  10. Skip Empty Pages
  11. Remove Existing Embeddings

Похожие автоматизации