Persistent Storage
By default, history is stored in memory. For production, you can persist conversations to disk or a database.
File Storage
Meloqui includes a simple file-based storage system:
typescript
import { FileStorage } from 'meloqui';
const storage = new FileStorage('./conversations');
const client = new ChatClient({
conversationId: 'user-1',
storage
});Custom Storage
Implement IStorage to save to Redis, Postgres, or MongoDB:
typescript
interface IStorage {
get(key: string): Promise<Message[]>;
set(key: string, messages: Message[]): Promise<void>;
delete(key: string): Promise<void>;
}