mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
🚀 feat: enhance UI components and refactor settings (#6625)
* 🚀 feat: Add Save Badges State functionality to chat settings * 🚀 feat: Remove individual chat setting components and introduce a reusable ToggleSwitch component * 🚀 feat: Replace Switches with reusable ToggleSwitch component in General settings; style: improved HoverCard * 🚀 feat: Refactor ChatForm and Footer components for improved layout and state management * 🚀 feat: Add deprecation warning for GPT Plugins endpoint --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
14ff66b2c3
commit
a5154e1349
20 changed files with 227 additions and 350 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { useRecoilCallback } from 'recoil';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { MessageCircleDashed, Box } from 'lucide-react';
|
||||
import type { BadgeItem } from '~/common';
|
||||
|
|
@ -33,3 +34,14 @@ export default function useChatBadges(): BadgeItem[] {
|
|||
isAvailable: activeBadgeIds.has(cfg.id),
|
||||
}));
|
||||
}
|
||||
|
||||
export function useResetChatBadges() {
|
||||
return useRecoilCallback(
|
||||
({ reset }) =>
|
||||
() => {
|
||||
badgeConfig.forEach(({ atom }) => reset(atom));
|
||||
reset(store.chatBadges);
|
||||
},
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import {
|
|||
} from '~/utils';
|
||||
import { useDeleteFilesMutation, useGetEndpointsQuery, useGetStartupConfig } from '~/data-provider';
|
||||
import useAssistantListMap from './Assistants/useAssistantListMap';
|
||||
import { useResetChatBadges } from './useChatBadges';
|
||||
import { usePauseGlobalAudio } from './Audio';
|
||||
import { mainTextareaId } from '~/common';
|
||||
import store from '~/store';
|
||||
|
|
@ -38,8 +39,8 @@ const useNewConvo = (index = 0) => {
|
|||
const clearAllConversations = store.useClearConvoState();
|
||||
const defaultPreset = useRecoilValue(store.defaultPreset);
|
||||
const { setConversation } = store.useCreateConversationAtom(index);
|
||||
const [isTemporary, setIsTemporary] = useRecoilState(store.isTemporary);
|
||||
const [files, setFiles] = useRecoilState(store.filesByIndex(index));
|
||||
const saveBadgesState = useRecoilValue<boolean>(store.saveBadgesState);
|
||||
const clearAllLatestMessages = store.useClearLatestMessages(`useNewConvo ${index}`);
|
||||
const setSubmission = useSetRecoilState<TSubmission | null>(store.submissionByIndex(index));
|
||||
const { data: endpointsConfig = {} as TEndpointsConfig } = useGetEndpointsQuery();
|
||||
|
|
@ -196,8 +197,8 @@ const useNewConvo = (index = 0) => {
|
|||
keepAddedConvos?: boolean;
|
||||
} = {}) {
|
||||
pauseGlobalAudio();
|
||||
if (isTemporary) {
|
||||
setIsTemporary(false);
|
||||
if (!saveBadgesState) {
|
||||
useResetChatBadges();
|
||||
}
|
||||
|
||||
const templateConvoId = _template.conversationId ?? '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue