mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
💬 feat: move Temporary Chat to the Header (#6646)
* 🚀 feat: Add Temporary Chat feature with badge toggle functionality
* style: update header button
* fix: Integrate resetChatBadges functionality into useNewConvo hook following rules of react
* fix: Adjust margin logic in ChatForm for better layout handling on existing conversations
* fix: Refine margin logic in ChatForm to improve layout during message submission
* fix: Update TemporaryChat component to not render when message is submitting
---------
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
a5154e1349
commit
cd7cdaa703
7 changed files with 111 additions and 21 deletions
|
|
@ -5,21 +5,22 @@ import type { BadgeItem } from '~/common';
|
|||
import { useLocalize } from '~/hooks';
|
||||
import store from '~/store';
|
||||
|
||||
const badgeConfig = [
|
||||
{
|
||||
id: '1',
|
||||
icon: MessageCircleDashed,
|
||||
label: 'com_ui_temporary',
|
||||
atom: store.isTemporary,
|
||||
},
|
||||
interface ChatBadgeConfig {
|
||||
id: string;
|
||||
icon: typeof Box;
|
||||
label: string;
|
||||
atom?: any;
|
||||
}
|
||||
|
||||
const badgeConfig: ReadonlyArray<ChatBadgeConfig> = [
|
||||
// {
|
||||
// id: '2',
|
||||
// id: '1',
|
||||
// icon: Box,
|
||||
// label: 'com_ui_artifacts',
|
||||
// atom: store.codeArtifacts,
|
||||
// },
|
||||
// TODO: add more badges here (missing store atoms)
|
||||
] as const;
|
||||
];
|
||||
|
||||
export default function useChatBadges(): BadgeItem[] {
|
||||
const localize = useLocalize();
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ const useNewConvo = (index = 0) => {
|
|||
const assistantsListMap = useAssistantListMap();
|
||||
const { pauseGlobalAudio } = usePauseGlobalAudio(index);
|
||||
const saveDrafts = useRecoilValue<boolean>(store.saveDrafts);
|
||||
const resetBadges = useResetChatBadges();
|
||||
|
||||
const { mutateAsync } = useDeleteFilesMutation({
|
||||
onSuccess: () => {
|
||||
|
|
@ -198,7 +199,7 @@ const useNewConvo = (index = 0) => {
|
|||
} = {}) {
|
||||
pauseGlobalAudio();
|
||||
if (!saveBadgesState) {
|
||||
useResetChatBadges();
|
||||
resetBadges();
|
||||
}
|
||||
|
||||
const templateConvoId = _template.conversationId ?? '';
|
||||
|
|
@ -278,6 +279,7 @@ const useNewConvo = (index = 0) => {
|
|||
files,
|
||||
setFiles,
|
||||
mutateAsync,
|
||||
resetBadges,
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue