> ## Documentation Index
> Fetch the complete documentation index at: https://cndoc-langchain.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ChatGPT 文件 - 集成

> 使用 LangChain JavaScript 与 ChatGPT 文件 - 文档加载器进行集成。

本示例介绍如何从您的 ChatGPT 数据导出文件夹中加载 conversations.json。您可以通过以下步骤获取数据导出邮件：ChatGPT -> (个人资料) - 设置 -> 导出数据 -> 确认导出 -> 查看邮件。

## 用法：提取所有日志

示例代码：

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatGPTLoader } from "@langchain/community/document_loaders/fs/chatgpt";

const loader = new ChatGPTLoader("./example_data/example_conversations.json");

const docs = await loader.load();

console.log(docs);
```

## 用法：提取单条日志

示例代码：

```typescript theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
import { ChatGPTLoader } from "@langchain/community/document_loaders/fs/chatgpt";

const loader = new ChatGPTLoader(
  "./example_data/example_conversations.json",
  1
);

const docs = await loader.load();

console.log(docs);
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [连接这些文档](/use-these-docs) 到 Claude、VSCode 等，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/file_loaders/chatgpt.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
