Skip to main content

IPFS 数据存储聊天内存

¥IPFS Datastore Chat Memory

对于存储后端,你可以使用 IPFS 数据存储聊天内存来封装 IPFS 数据存储,从而允许你使用任何与 IPFS 兼容的数据存储。

¥For a storage backend you can use the IPFS Datastore Chat Memory to wrap an IPFS Datastore allowing you to use any IPFS compatible datastore.

设置

¥Setup

首先,安装集成依赖:

¥First, install the integration dependencies:

npm install cborg interface-datastore it-all @langchain/community @langchain/core

现在你可以安装并使用你选择的 IPFS 数据存储。以下是一些选项:

¥Now you can install and use an IPFS Datastore of your choice. Here are some options:

用法

¥Usage

// Replace FsDatastore with the IPFS Datastore of your choice.
import { FsDatastore } from "datastore-fs";
import { IPFSDatastoreChatMessageHistory } from "@langchain/community/stores/message/ipfs_datastore";

const datastore = new FsDatastore("path/to/store");
const sessionId = "my-session";

const history = new IPFSDatastoreChatMessageHistory({ datastore, sessionId });