{"id":13796976,"url":"https://github.com/mayooear/langchain-supabase-website-chatbot","last_synced_at":"2025-04-04T13:11:43.270Z","repository":{"id":147107528,"uuid":"612286425","full_name":"mayooear/langchain-supabase-website-chatbot","owner":"mayooear","description":"Build a chatgpt chatbot for your website using LangChain, Supabase, Typescript, Openai, and Next.js. ","archived":false,"fork":false,"pushed_at":"2023-04-24T15:34:06.000Z","size":4508,"stargazers_count":683,"open_issues_count":7,"forks_count":188,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T12:07:53.783Z","etag":null,"topics":["chatgpt","gpt3","langchain","nextjs","notion","openai","supabase","typescript"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=R2FMzcsmQY8","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mayooear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-10T15:49:18.000Z","updated_at":"2025-03-22T03:32:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"b219e6ca-b3a3-44c0-826a-e2ef93500955","html_url":"https://github.com/mayooear/langchain-supabase-website-chatbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayooear%2Flangchain-supabase-website-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayooear%2Flangchain-supabase-website-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayooear%2Flangchain-supabase-website-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mayooear%2Flangchain-supabase-website-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mayooear","download_url":"https://codeload.github.com/mayooear/langchain-supabase-website-chatbot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247182365,"owners_count":20897380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatgpt","gpt3","langchain","nextjs","notion","openai","supabase","typescript"],"created_at":"2024-08-03T23:01:19.057Z","updated_at":"2025-04-04T13:11:43.252Z","avatar_url":"https://github.com/mayooear.png","language":"TypeScript","funding_links":[],"categories":["SDK, Libraries, Frameworks","TypeScript"],"sub_categories":["JavaScript/Typescript"],"readme":"# LangChain \u0026 Supabase - Create a ChatGpt Chatbot for Your Website\n\nCreate a chatgpt chatbot for your website using LangChain, Supabase, Typescript, Openai, and Next.js. LangChain is a framework that makes it easier to build scalable AI/LLM apps. Supabase is an open source Postgres database that can store embeddings using a pg vector extension.\n\n[Tutorial video](https://www.youtube.com/watch?v=prbloUGlvLE)\n\n[Get in touch via twitter if you need help](https://twitter.com/mayowaoshin)\n\nThe visual guide of this repo and tutorial is in the `visual guide` folder.\n\n## Development\n\n1. Clone the repo\n\n```\ngit clone [github https url]\n```\n\n2. Install packages\n\n```\npnpm install\n```\n\n3. Set up your `.env` file\n\n- Copy `.env.local.example` into `.env`\n  Your `.env` file should look like this:\n\n```\nOPENAI_API_KEY=\n\nNEXT_PUBLIC_SUPABASE_URL=\nNEXT_PUBLIC_SUPABASE_ANON_KEY=\nSUPABASE_SERVICE_ROLE_KEY=\n\n```\n\n- Visit [openai](https://help.openai.com/en/articles/4936850-where-do-i-find-my-secret-api-key) to retrieve API keys and insert into your `.env` file.\n- Visit [supabase](https://supabase.com/) to create a database and retrieve your keys in the user dashboard as per [docs instructions](https://supabase.com/docs)\n\n4. In the `config` folder, replace the urls in the array with your website urls (the script requires more than one url).\n\n5. In the `utils/custom_web_loader.ts` inside the `load` function replace the values of `title`, `date` and `content` with the css elements of text you'd like extract from a given webpage. You can learn more about how to use Cheerio [here](https://cheerio.js.org/)\n\nYou can add your custom elements to the metadata to meet your needs, note however that the default loader format as per below expects at least a string for `pageContent` and `metadata` that contains a `source` property as a returned value:\n\n```\nasync load(): Promise\u003cDocument[]\u003e{\n  const $ = await this.scrape();\n      const text = $(\"body\").text();\n    const metadata = { source: this.webPath };\n    return [new Document({ pageContent: text, metadata })];\n  }\n\n```\n\nThe `pageContent` and `metadata` will later be stored in your supabase database table.\n\n6. Copy and run `schema.sql` in your supabase sql editor\n\n- cross check the `documents` table exists in the database as well as the `match_documents` function.\n\n## 🧑 Instructions for scraping and embedding\n\nTo run the scraping and embedding script in `scripts/scrape-embed.ts` simply run:\n\n`npm run scrape-embed`\n\nThis script will visit all the urls noted in the `config` folder and extract the data you specified in the `custom_web_loader.ts` file.\n\nThen it will use OpenAI's Embeddings(`text-embedding-ada-002`) to convert your scraped data into vectors.\n\n## Run the app\n\nOnce you've verified that the embeddings and content have been successfully added to your supabase table, you can run the app `npm run dev` and type a question to ask your website.\n\n## Credit\n\nFrontend of this repo is inspired by [langchain-chat-nextjs](https://github.com/zahidkhawaja/langchain-chat-nextjs)\n\nThis repo uses in-depth Notion guides from the [website](https://thomasjfrank.com/) of productivity expert, Thomas Frank.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayooear%2Flangchain-supabase-website-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmayooear%2Flangchain-supabase-website-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmayooear%2Flangchain-supabase-website-chatbot/lists"}