mirror of
https://github.com/StanGirard/quivr.git
synced 2024-12-12 11:26:07 +03:00
68da22aa1d
- The frontend no longer sets a default model - Either a model is chosen by the user, or it will be done by the backend Issue: https://github.com/StanGirard/quivr/issues/1747
27 lines
662 B
TypeScript
27 lines
662 B
TypeScript
import { ChatConfig } from "@/lib/context/ChatProvider/types";
|
|
const chatConfigLocalStorageKey = "chat-config";
|
|
|
|
type PartialChatConfig = Partial<ChatConfig>;
|
|
|
|
export const saveChatsConfigInLocalStorage = (
|
|
chatConfig: PartialChatConfig
|
|
): void => {
|
|
localStorage.setItem(chatConfigLocalStorageKey, JSON.stringify(chatConfig));
|
|
};
|
|
|
|
export const getChatsConfigFromLocalStorage = ():
|
|
| PartialChatConfig
|
|
| undefined => {
|
|
try {
|
|
const config = localStorage.getItem(chatConfigLocalStorageKey);
|
|
|
|
if (config === null) {
|
|
return undefined;
|
|
}
|
|
|
|
return JSON.parse(config) as PartialChatConfig;
|
|
} catch (error) {
|
|
return undefined;
|
|
}
|
|
};
|