跳到主要内容
本示例演示如何从 Notion 仪表板导出的 Notion 页面加载数据。 首先,按照官方说明此处,将 Notion 页面导出为 Markdown 和 CSV。请务必选择 包含子页面为子页面创建文件夹 然后,解压下载的文件并将解压后的文件夹移动到您的存储库中。它应该包含您页面的 Markdown 文件。 一旦文件夹在您的存储库中,只需运行以下示例:
import { NotionLoader } from "@langchain/community/document_loaders/fs/notion";

export const run = async () => {
  /** Provide the directory path of your notion folder */
  const directoryPath = "Notion_DB";
  const loader = new NotionLoader(directoryPath);
  const docs = await loader.load();
  console.log({ docs });
};

以编程方式连接这些文档到 Claude、VSCode 等,通过 MCP 获取实时答案。
© . This site is unofficial and not affiliated with LangChain, Inc.