feat: add search message shortcut #366

This commit is contained in:
kangfenmao 2025-01-06 16:29:39 +08:00
parent 3f44e1e4ac
commit c2d5d54922
9 changed files with 34 additions and 6 deletions

View File

@ -501,7 +501,8 @@
"clear_shortcut": "Clear Shortcut", "clear_shortcut": "Clear Shortcut",
"toggle_show_assistants": "Toggle Assistants", "toggle_show_assistants": "Toggle Assistants",
"toggle_show_topics": "Toggle Topics", "toggle_show_topics": "Toggle Topics",
"copy_last_message": "Copy Last Message" "copy_last_message": "Copy Last Message",
"search_message": "Search Message"
}, },
"theme.auto": "Auto", "theme.auto": "Auto",
"theme.dark": "Dark", "theme.dark": "Dark",

View File

@ -487,7 +487,8 @@
"clear_shortcut": "ショートカットをクリア", "clear_shortcut": "ショートカットをクリア",
"toggle_show_assistants": "アシスタントの表示を切り替え", "toggle_show_assistants": "アシスタントの表示を切り替え",
"toggle_show_topics": "トピックの表示を切り替え", "toggle_show_topics": "トピックの表示を切り替え",
"copy_last_message": "最後のメッセージをコピー" "copy_last_message": "最後のメッセージをコピー",
"search_message": "メッセージを検索"
}, },
"theme.auto": "自動", "theme.auto": "自動",
"theme.dark": "ダークテーマ", "theme.dark": "ダークテーマ",

View File

@ -501,7 +501,8 @@
"clear_shortcut": "Очистить сочетание клавиш", "clear_shortcut": "Очистить сочетание клавиш",
"toggle_show_assistants": "Переключить отображение ассистентов", "toggle_show_assistants": "Переключить отображение ассистентов",
"toggle_show_topics": "Переключить отображение топиков", "toggle_show_topics": "Переключить отображение топиков",
"copy_last_message": "Копировать последнее сообщение" "copy_last_message": "Копировать последнее сообщение",
"search_message": "Поиск сообщения"
}, },
"theme.auto": "Автоматически", "theme.auto": "Автоматически",
"theme.dark": "Темная", "theme.dark": "Темная",

View File

@ -490,7 +490,8 @@
"clear_shortcut": "清除快捷键", "clear_shortcut": "清除快捷键",
"toggle_show_assistants": "切换助手显示", "toggle_show_assistants": "切换助手显示",
"toggle_show_topics": "切换话题显示", "toggle_show_topics": "切换话题显示",
"copy_last_message": "复制上一条消息" "copy_last_message": "复制上一条消息",
"search_message": "搜索消息"
}, },
"theme.auto": "跟随系统", "theme.auto": "跟随系统",
"theme.dark": "深色主题", "theme.dark": "深色主题",

View File

@ -489,7 +489,8 @@
"clear_shortcut": "清除快捷鍵", "clear_shortcut": "清除快捷鍵",
"toggle_show_assistants": "切換助手顯示", "toggle_show_assistants": "切換助手顯示",
"toggle_show_topics": "切換話題顯示", "toggle_show_topics": "切換話題顯示",
"copy_last_message": "複製上一条消息" "copy_last_message": "複製上一条消息",
"search_message": "搜索消息"
}, },
"theme.auto": "自動", "theme.auto": "自動",
"theme.dark": "深色主題", "theme.dark": "深色主題",

View File

@ -40,6 +40,10 @@ const HeaderNavbar: FC<Props> = ({ activeAssistant }) => {
} }
}) })
useShortcut('search_message', () => {
SearchPopup.show()
})
return ( return (
<Navbar className="home-navbar"> <Navbar className="home-navbar">
{showAssistants && ( {showAssistants && (

View File

@ -28,7 +28,7 @@ const persistedReducer = persistReducer(
{ {
key: 'cherry-studio', key: 'cherry-studio',
storage, storage,
version: 51, version: 52,
blacklist: ['runtime'], blacklist: ['runtime'],
migrate migrate
}, },

View File

@ -775,6 +775,18 @@ const migrateConfig = {
'51': (state: RootState) => { '51': (state: RootState) => {
state.settings.topicNamingPrompt = '' state.settings.topicNamingPrompt = ''
return state return state
},
'52': (state: RootState) => {
if (state.shortcuts) {
state.shortcuts.shortcuts.push({
key: 'search_message',
shortcut: [isMac ? 'Command' : 'Ctrl', 'F'],
editable: true,
enabled: true,
system: false
})
}
return state
} }
} }

View File

@ -44,6 +44,13 @@ const initialState: ShortcutsState = {
editable: true, editable: true,
enabled: false, enabled: false,
system: false system: false
},
{
key: 'search_message',
shortcut: [isMac ? 'Command' : 'Ctrl', 'F'],
editable: true,
enabled: true,
system: false
} }
] ]
} }