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
- Yarn
- pnpm
npm install cborg interface-datastore it-all @langchain/community @langchain/core
yarn add cborg interface-datastore it-all @langchain/community @langchain/core
pnpm add 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:
datastore-core 数据存储在内存中实现。
¥datastore-core Datastore in-memory implementation.
datastore-fs 使用文件系统后端的数据存储实现。
¥datastore-fs Datastore implementation with file system backend.
datastore-idb 使用 IndexedDB 后端的数据存储实现。
¥datastore-idb Datastore implementation with IndexedDB backend.
datastore-level 使用级别(上|下)后端的数据存储实现
¥datastore-level Datastore implementation with level(up|down) backend
datastore-s3 由 S3 支持的数据存储实现。
¥datastore-s3 Datastore implementation backed by s3.
用法
¥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 });