From 51e162970e1c2d786627803e9fb37006c39768a1 Mon Sep 17 00:00:00 2001 From: josc146 Date: Fri, 8 Dec 2023 17:10:23 +0800 Subject: [PATCH] always reset to activePreset --- frontend/src/pages/Chat.tsx | 5 +-- .../pages/PresetsManager/PresetsButton.tsx | 35 ++++------------- frontend/src/stores/commonStore.ts | 10 +++-- frontend/src/utils/index.tsx | 39 +++++++++++++++++-- 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/frontend/src/pages/Chat.tsx b/frontend/src/pages/Chat.tsx index 6fed0ce..a1c030f 100644 --- a/frontend/src/pages/Chat.tsx +++ b/frontend/src/pages/Chat.tsx @@ -28,7 +28,7 @@ import { toast } from 'react-toastify'; import { WorkHeader } from '../components/WorkHeader'; import { DialogButton } from '../components/DialogButton'; import { OpenFileFolder, OpenOpenFileDialog, OpenSaveFileDialog } from '../../wailsjs/go/backend_golang/App'; -import { absPathAsset, bytesToReadable, getServerRoot, toastWithButton } from '../utils'; +import { absPathAsset, bytesToReadable, getServerRoot, setActivePreset, toastWithButton } from '../utils'; import { useMediaQuery } from 'usehooks-ts'; import { botName, ConversationMessage, MessageType, userName, welcomeUuid } from '../types/chat'; import { Labeled } from '../components/Labeled'; @@ -536,8 +536,7 @@ const ChatPanel: FC = observer(() => { } chatSseControllers = {}; } - commonStore.setConversation({}); - commonStore.setConversationOrder([]); + setActivePreset(commonStore.activePreset); }} />