Skip to main content

Documentation Index

Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt

Use this file to discover all available pages before exploring further.

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

用法:提取所有日志

示例代码:
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);

用法:提取单个日志

示例代码:
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);