quivr/frontend/lib/context/BrainConfigProvider/helpers/brainConfigLocalStorage.ts
Mamadou DICKO 6ff9309082
Feat/model config (#223)
* feat(axios): add global manager

* feat: add config page

* feat(axios): add backendUrl overwrite

* feat(brainConfig): add supabase url overwrite

* feat(chat): change model config logic + add more model

* feat: add openai and anthropic api key overwrite

* feat(config): save config in local storage

* feat(config): add reset button

* feat: move vertexai to config page

* ui: add brain config icon
2023-06-02 17:01:49 +02:00

18 lines
544 B
TypeScript

import { BrainConfig } from "../types";
const BRAIN_CONFIG_LOCAL_STORAGE_KEY = "userBrainConfig";
export const saveBrainConfigInLocalStorage = (updatedConfig: BrainConfig) => {
localStorage.setItem(
BRAIN_CONFIG_LOCAL_STORAGE_KEY,
JSON.stringify(updatedConfig)
);
};
export const getBrainConfigFromLocalStorage = (): BrainConfig | undefined => {
const persistedBrainConfig = localStorage.getItem(
BRAIN_CONFIG_LOCAL_STORAGE_KEY
);
if (persistedBrainConfig === null) return;
return JSON.parse(persistedBrainConfig);
};