vercel / ai-chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
https://chat.vercel.ai
Other
6.12k stars 1.89k forks source link

Unable to use with Langchain YoutubeLoader #203

Closed nextone2271 closed 9 months ago

nextone2271 commented 9 months ago

Steps to reproduce:

  1. Clone ai-chatbot
  2. pnpm install
  3. pnpm add langchain youtube-transcript youtubei.js (as per langchain docs)
  4. In app/api/route.ts add these lines:
    import { YoutubeLoader } from 'langchain/document_loaders/web/youtube'
    console.log(YoutubeLoader)
  5. pnpm dev
  6. Open app on localhost:3000 and submit a prompt
  7. See error: hmr error - node_modules/.pnpm/centra@2.6.0/node_modules/centra/model/CentraRequest.js:2:13 Module not found: Can't resolve 'http' image

Note: it does appear to work with a regular create-next-app project. Please advise. Thanks in advance!

nextone2271 commented 9 months ago

Apparently the error comes from having the line:

export const runtime = 'edge'

Removing this line to switch to the Node.js runtime resolved the issue.