feat: add copy last message shortcuts
This commit is contained in:
parent
15539a5609
commit
ff935a656e
@ -481,7 +481,8 @@
|
||||
"reset_to_default": "Reset to Default",
|
||||
"clear_shortcut": "Clear Shortcut",
|
||||
"toggle_show_assistants": "Toggle Assistants",
|
||||
"toggle_show_topics": "Toggle Topics"
|
||||
"toggle_show_topics": "Toggle Topics",
|
||||
"copy_last_message": "Copy Last Message"
|
||||
},
|
||||
"theme.auto": "Auto",
|
||||
"theme.dark": "Dark",
|
||||
|
||||
@ -481,7 +481,8 @@
|
||||
"reset_to_default": "Сбросить настройки по умолчанию",
|
||||
"clear_shortcut": "Очистить сочетание клавиш",
|
||||
"toggle_show_assistants": "Переключить отображение ассистентов",
|
||||
"toggle_show_topics": "Переключить отображение топиков"
|
||||
"toggle_show_topics": "Переключить отображение топиков",
|
||||
"copy_last_message": "Копировать последнее сообщение"
|
||||
},
|
||||
"theme.auto": "Автоматически",
|
||||
"theme.dark": "Темная",
|
||||
|
||||
@ -469,7 +469,8 @@
|
||||
"reset_to_default": "重置为默认",
|
||||
"clear_shortcut": "清除快捷键",
|
||||
"toggle_show_assistants": "切换助手显示",
|
||||
"toggle_show_topics": "切换话题显示"
|
||||
"toggle_show_topics": "切换话题显示",
|
||||
"copy_last_message": "复制上一条消息"
|
||||
},
|
||||
"theme.auto": "跟随系统",
|
||||
"theme.dark": "深色主题",
|
||||
|
||||
@ -469,7 +469,8 @@
|
||||
"reset_to_default": "重置為預設",
|
||||
"clear_shortcut": "清除快捷鍵",
|
||||
"toggle_show_assistants": "切換助手顯示",
|
||||
"toggle_show_topics": "切換話題顯示"
|
||||
"toggle_show_topics": "切換話題顯示",
|
||||
"copy_last_message": "複製上一条消息"
|
||||
},
|
||||
"theme.auto": "自動",
|
||||
"theme.dark": "深色主題",
|
||||
|
||||
@ -74,8 +74,8 @@ const ContentContainer = styled.div`
|
||||
|
||||
const AppsContainer = styled.div`
|
||||
display: flex;
|
||||
min-width: 900px;
|
||||
max-width: 900px;
|
||||
min-width: 950px;
|
||||
max-width: 950px;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-content: flex-start;
|
||||
|
||||
@ -2,6 +2,7 @@ import Scrollbar from '@renderer/components/Scrollbar'
|
||||
import db from '@renderer/databases'
|
||||
import { useAssistant } from '@renderer/hooks/useAssistant'
|
||||
import { useSettings } from '@renderer/hooks/useSettings'
|
||||
import { useShortcut } from '@renderer/hooks/useShortcuts'
|
||||
import { getTopic, TopicManager } from '@renderer/hooks/useTopic'
|
||||
import { fetchMessagesSummary } from '@renderer/services/ApiService'
|
||||
import { getDefaultTopic } from '@renderer/services/AssistantService'
|
||||
@ -266,6 +267,14 @@ const Messages: FC<Props> = ({ assistant, topic, setActiveTopic }) => {
|
||||
}, 300)
|
||||
}, [displayMessages, hasMore, isLoadingMore, messages])
|
||||
|
||||
useShortcut('copy_last_message', () => {
|
||||
const lastMessage = last(messages)
|
||||
if (lastMessage) {
|
||||
navigator.clipboard.writeText(lastMessage.content)
|
||||
window.message.success(t('message.copy.success'))
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<Container
|
||||
id="messages"
|
||||
|
||||
@ -753,6 +753,15 @@ const migrateConfig = {
|
||||
'49': (state: RootState) => {
|
||||
state.settings.showMinappIcon = true
|
||||
state.settings.showFilesIcon = true
|
||||
if (state.shortcuts) {
|
||||
state.shortcuts.shortcuts.push({
|
||||
key: 'copy_last_message',
|
||||
shortcut: [isMac ? 'Command' : 'Ctrl', 'Shift', 'C'],
|
||||
editable: true,
|
||||
enabled: false,
|
||||
system: false
|
||||
})
|
||||
}
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,6 +37,13 @@ const initialState: ShortcutsState = {
|
||||
editable: true,
|
||||
enabled: true,
|
||||
system: false
|
||||
},
|
||||
{
|
||||
key: 'copy_last_message',
|
||||
shortcut: [isMac ? 'Command' : 'Ctrl', 'Shift', 'C'],
|
||||
editable: true,
|
||||
enabled: false,
|
||||
system: false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user