Skip to main content

Figma

本例演示如何从Figma文件加载数据。 您需要Figma访问令牌才能开始使用。

import { FigmaFileLoader } from "langchain/document_loaders/web/figma";

const loader = new FigmaFileLoader({
accessToken: "FIGMA_ACCESS_TOKEN", // or load it from process.env.FIGMA_ACCESS_TOKEN
nodeIds: ["id1", "id2", "id3"],
fileKey: "key",
});
const docs = await loader.load();

console.log({ docs });

您可以通过在浏览器中打开文件并从URL中提取它们来找到Figma文件的密钥和节点ID:


https://www.figma.com/file/<YOUR FILE KEY HERE>/LangChainJS-Test?type=whiteboard&node-id=<YOUR NODE ID HERE>&t=e6lqWkKecuYQRyRg-0