mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-13 05:58:51 +01:00
* fix: load all existing conversation settings on refresh * refactor(buildDefaultConvo): use `lastConversationSetup.endpointType` before `conversation.endpointType` * refactor(TMessage/messageSchema): add `endpoint` field to messages to differentiate generation origin * feat(useNewConvo): `keepLatestMessage` param to prevent reseting the `latestMessage` mid-conversation * style(Settings): adjust height styling to allow more space in dialog for additional settings * feat: Modular Chat: experimental setting to Enable switching Endpoints mid-conversation * fix(ChatRoute): fix potential parsing issue with tPresetSchema
81 lines
1.7 KiB
TypeScript
81 lines
1.7 KiB
TypeScript
import { atom } from 'recoil';
|
|
import type { TOptionSettings } from '~/common';
|
|
|
|
const abortScroll = atom<boolean>({
|
|
key: 'abortScroll',
|
|
default: false,
|
|
});
|
|
|
|
const optionSettings = atom<TOptionSettings>({
|
|
key: 'optionSettings',
|
|
default: {},
|
|
});
|
|
|
|
const showPluginStoreDialog = atom<boolean>({
|
|
key: 'showPluginStoreDialog',
|
|
default: false,
|
|
});
|
|
|
|
const showAgentSettings = atom<boolean>({
|
|
key: 'showAgentSettings',
|
|
default: false,
|
|
});
|
|
|
|
const showBingToneSetting = atom<boolean>({
|
|
key: 'showBingToneSetting',
|
|
default: false,
|
|
});
|
|
|
|
const showPopover = atom<boolean>({
|
|
key: 'showPopover',
|
|
default: false,
|
|
});
|
|
|
|
const autoScroll = atom<boolean>({
|
|
key: 'autoScroll',
|
|
default: localStorage.getItem('autoScroll') === 'true',
|
|
effects: [
|
|
({ setSelf, onSet }) => {
|
|
const savedValue = localStorage.getItem('autoScroll');
|
|
if (savedValue != null) {
|
|
setSelf(savedValue === 'true');
|
|
}
|
|
|
|
onSet((newValue: unknown) => {
|
|
if (typeof newValue === 'boolean') {
|
|
localStorage.setItem('autoScroll', newValue.toString());
|
|
}
|
|
});
|
|
},
|
|
] as const,
|
|
});
|
|
|
|
const modularChat = atom<boolean>({
|
|
key: 'modularChat',
|
|
default: localStorage.getItem('modularChat') === 'true',
|
|
effects: [
|
|
({ setSelf, onSet }) => {
|
|
const savedValue = localStorage.getItem('modularChat');
|
|
if (savedValue != null) {
|
|
setSelf(savedValue === 'true');
|
|
}
|
|
|
|
onSet((newValue: unknown) => {
|
|
if (typeof newValue === 'boolean') {
|
|
localStorage.setItem('modularChat', newValue.toString());
|
|
}
|
|
});
|
|
},
|
|
] as const,
|
|
});
|
|
|
|
export default {
|
|
abortScroll,
|
|
optionSettings,
|
|
showPluginStoreDialog,
|
|
showAgentSettings,
|
|
showBingToneSetting,
|
|
showPopover,
|
|
autoScroll,
|
|
modularChat,
|
|
};
|