mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-01 03:27:01 +00:00
* refactor: optimize backend operations for client requests * fix: message styling * refactor: Improve handleKeyUp logic in StreamRunManager.js and handleText.js * refactor: Improve handleKeyUp logic in StreamRunManager.js and handleText.js * fix: clear new convo messages on clear all convos * fix: forgot to pass userId to getConvo * refactor: update getPartialText to send basePayload.text
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { useState } from 'react';
|
|
import { useClearConversationsMutation } from 'librechat-data-provider/react-query';
|
|
import { useLocalize, useConversation, useConversations } from '~/hooks';
|
|
import DialogTemplate from '~/components/ui/DialogTemplate';
|
|
import { ClearChatsButton } from './SettingsTabs';
|
|
import { Dialog } from '~/components/ui';
|
|
|
|
const ClearConvos = ({ open, onOpenChange }) => {
|
|
const { newConversation } = useConversation();
|
|
const { refreshConversations } = useConversations();
|
|
const clearConvosMutation = useClearConversationsMutation();
|
|
const [confirmClear, setConfirmClear] = useState(false);
|
|
const localize = useLocalize();
|
|
|
|
// Clear all conversations
|
|
const clearConvos = () => {
|
|
if (confirmClear) {
|
|
clearConvosMutation.mutate(
|
|
{},
|
|
{
|
|
onSuccess: () => {
|
|
newConversation();
|
|
refreshConversations();
|
|
},
|
|
},
|
|
);
|
|
setConfirmClear(false);
|
|
} else {
|
|
setConfirmClear(true);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogTemplate
|
|
title={localize('com_nav_clear_conversation')}
|
|
className="w-11/12 max-w-[650px] sm:w-3/4 md:w-3/4 lg:w-3/4"
|
|
headerClassName="border-none"
|
|
description={localize('com_nav_clear_conversation_confirm_message')}
|
|
buttons={
|
|
<ClearChatsButton
|
|
showText={false}
|
|
confirmClear={confirmClear}
|
|
onClick={clearConvos}
|
|
className="w-[77px]"
|
|
/>
|
|
}
|
|
/>
|
|
</Dialog>
|
|
);
|
|
};
|
|
|
|
export default ClearConvos;
|