mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
5a7a925983
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chat-adapter/state-memory
In-memory state adapter for the chat SDK.
Note: This adapter is intended for development and testing only. For production, use @chat-adapter/state-redis or @chat-adapter/state-ioredis.
Installation
npm install chat @chat-adapter/state-memory
Usage
import { Chat } from "chat";
import { createMemoryState } from "@chat-adapter/state-memory";
const chat = new Chat({
userName: "mybot",
adapters: { /* ... */ },
state: createMemoryState(),
});
Features
- Thread subscriptions (in-memory storage)
- Distributed locking (single-process only)
- Zero configuration required
Limitations
- Not suitable for production: State is lost on restart
- Single process only: Locks don't work across multiple instances
- No persistence: Subscriptions reset when process restarts
When to Use
- Local development
- Unit testing
- Single-instance deployments (not recommended for production)
License
MIT