RAG – Supabase操作流程

PostGreSQL 簡介與基礎操作:https://eminent-glider-8c3.notion.site/PostgreSQL-39e9def5443d807ba034dcbf3b8ab46e?pvs=74

創建賬號並登入

專案首頁

前往project setting複製API key與專案 id ,記得在本地建立.env.local

  • .env.local
SUPABASE_SERVICE_ROLE_KEY = eyJhbGciO
NEXT_PUBLIC_SUPABASE_ANON_KEY = eyJh
NEXT_PUBLIC_SUPABASE_URL = https://ejggsyxwsltpypfrfdcq.supabase.coCode language: JavaScript (javascript)
  • 接著在SQL Editor中執行 db/query.sql
  • 在SQL Editor中開第二個query,執行 db/RLS.sql
do $$
declare r record;
begin
  for r in (
    select policyname from pg_policies
    where schemaname = 'public' and tablename = 'documents'
  ) loop
    execute format('drop policy if exists %I on public.documents', r.policyname);
  end loop;
end $$;

alter table public.documents disable row level security;
grant all on table public.documents to anon, authenticated, service_role;
grant usage, select on sequence documents_id_seq to anon, authenticated, service_role;Code language: PHP (php)

當你在localhost3000向AI詢問問題後,前往 supabase查看會看到切分後的md

Leave a Reply

Your email address will not be published. Required fields are marked *