Skip to content

Commit

Permalink
πŸ› fix: remove the 'resetConversation' hot key (lobehub#4526)
Browse files Browse the repository at this point in the history
* ✨ feat: remove the 'resetConversation' hot key

* πŸ”¨ chore: clean up unused methods
  • Loading branch information
mushan0x0 authored Oct 28, 2024
1 parent 1707d4d commit 653e694
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
18 changes: 1 addition & 17 deletions src/app/(main)/chat/(workspace)/_layout/Desktop/HotKeys.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
'use client';

import isEqual from 'fast-deep-equal';
import { useCallback } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';

import { HOTKEYS } from '@/const/hotkeys';
import { useChatStore } from '@/store/chat';
import { chatSelectors } from '@/store/chat/selectors';
import { useFileStore } from '@/store/file';
import { useGlobalStore } from '@/store/global';

const HotKeys = () => {
const [regenerateMessage, clearMessage] = useChatStore((s) => [
s.regenerateMessage,
s.clearMessage,
]);
const [regenerateMessage] = useChatStore((s) => [s.regenerateMessage]);
const lastMessage = useChatStore(chatSelectors.latestMessage, isEqual);

const [clearImageList] = useFileStore((s) => [s.clearChatUploadFileList]);
const toggleZenMode = useGlobalStore((s) => s.toggleZenMode);

const resetConversation = useCallback(() => {
clearMessage();
clearImageList();
}, []);

useHotkeys(HOTKEYS.clear, resetConversation, {
enableOnFormTags: true,
preventDefault: true,
});

useHotkeys(HOTKEYS.zenMode, toggleZenMode, {
enableOnFormTags: true,
preventDefault: true,
Expand Down
1 change: 0 additions & 1 deletion src/const/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const SAVE_TOPIC_KEY = 'n';
export const CLEAN_MESSAGE_KEY = 'backspace';

export const HOTKEYS = {
clear: 'mod+alt+backspace',
regenerate: 'alt+r',
saveTopic: 'alt+n',
zenMode: 'mod+\\',
Expand Down

0 comments on commit 653e694

Please sign in to comment.