mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-17 11:21:35 +03:00
21 lines
505 B
TypeScript
21 lines
505 B
TypeScript
|
import { ChatConfig } from "@/lib/context/ChatProvider/types";
|
||
|
|
||
|
export const saveChatConfigInLocalStorage = (
|
||
|
chatId: string,
|
||
|
chatConfig: ChatConfig
|
||
|
): void => {
|
||
|
localStorage.setItem(`chat-config-${chatId}`, JSON.stringify(chatConfig));
|
||
|
};
|
||
|
|
||
|
export const getChatConfigFromLocalStorage = (
|
||
|
chatId: string
|
||
|
): ChatConfig | undefined => {
|
||
|
const config = localStorage.getItem(`chat-config-${chatId}`);
|
||
|
|
||
|
if (config === null) {
|
||
|
return undefined;
|
||
|
}
|
||
|
|
||
|
return JSON.parse(config) as ChatConfig;
|
||
|
};
|