UNPKG

@prexo/ai-chat-sdk

Version:

AI Chat Component with Persistent History

20 lines (19 loc) 448 B
"use client"; import { InMemoryHistory } from "./in-memory.js"; import { InRedisHistory } from "./in-redis.js"; const getHistoryClient = (params) => { const redisUrl = params?.redis?.url; const redisToken = params?.redis?.token; if (redisUrl && redisToken) { return new InRedisHistory({ config: { url: redisUrl, token: redisToken } }); } return new InMemoryHistory(); }; export { getHistoryClient };