此示例介绍如何从 Notion 仪表板导出的 Notion 页面加载数据。 首先,根据此处的官方说明,将您的 Notion 页面导出为 Markdown & CSV。确保选择 include subpagesCreate folders for subpages. 然后,解压下载的文件并将解压的文件夹移动到您的存储库中。它应包含您页面的 markdown 文件。 一旦文件夹在您的存储库中,只需运行以下示例:
import { NotionLoader } from "@langchain/community/document_loaders/fs/notion";

export const run = async () => {
  /** 提供您的 notion 文件夹的目录路径 */
  const directoryPath = "Notion_DB";
  const loader = new NotionLoader(directoryPath);
  const docs = await loader.load();
  console.log({ docs });
};

Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.