feat: 🎸 add shortcut for command + enter (#443)

* feat: 🎸 add shortcut for command

* feat: 🎸 only command

---------

Co-authored-by: duanyongcheng77 <duanyongcheng77@gmail.com>
This commit is contained in:
Shelly 2024-12-12 14:22:41 +08:00 committed by GitHub
parent afa96549a3
commit f312c5fc40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -188,6 +188,11 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
sendMessage()
return event.preventDefault()
}
if (sendMessageShortcut === 'Command+Enter' && isEnterPressed && event.metaKey) {
sendMessage()
return event.preventDefault()
}
}
const addNewTopic = useCallback(async () => {

View File

@ -352,7 +352,8 @@ const SettingsTab: FC<Props> = (props) => {
options={[
{ value: 'Enter', label: 'Enter' },
{ value: 'Shift+Enter', label: `Shift + Enter` },
{ value: 'Ctrl+Enter', label: `Ctrl + Enter` }
{ value: 'Ctrl+Enter', label: `Ctrl + Enter` },
{ value: 'Command+Enter', label: `CommandOrControl + Enter` }
]}
onChange={(value) => setSendMessageShortcut(value)}
style={{ width: 135 }}

View File

@ -2,7 +2,7 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { TRANSLATE_PROMPT } from '@renderer/config/prompts'
import { CodeStyleVarious, LanguageVarious, ThemeMode } from '@renderer/types'
export type SendMessageShortcut = 'Enter' | 'Shift+Enter' | 'Ctrl+Enter'
export type SendMessageShortcut = 'Enter' | 'Shift+Enter' | 'Ctrl+Enter' | 'Command+Enter'
export interface SettingsState {
showAssistants: boolean