quivr/frontend/lib/api/chat/chat.local.ts
Mamadou DICKO edcbb30e97
fix: bugs (#818)
* feat: add chat config modal

* feat: save chat config in localStorage

* feat: remove <ConfigPage/>

* feat: overwrite chat config with brain

* fix(SettingsPage): upload payload keys

* fix: update default brain marker logic

* feat: set new created brain as current selected brain
2023-08-01 16:25:02 +02:00

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;
};