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",
|
"reset_to_default": "Reset to Default",
|
||||||
"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"
|
||||||
},
|
},
|
||||||
"theme.auto": "Auto",
|
"theme.auto": "Auto",
|
||||||
"theme.dark": "Dark",
|
"theme.dark": "Dark",
|
||||||
|
|||||||
@ -481,7 +481,8 @@
|
|||||||
"reset_to_default": "Сбросить настройки по умолчанию",
|
"reset_to_default": "Сбросить настройки по умолчанию",
|
||||||
"clear_shortcut": "Очистить сочетание клавиш",
|
"clear_shortcut": "Очистить сочетание клавиш",
|
||||||
"toggle_show_assistants": "Переключить отображение ассистентов",
|
"toggle_show_assistants": "Переключить отображение ассистентов",
|
||||||
"toggle_show_topics": "Переключить отображение топиков"
|
"toggle_show_topics": "Переключить отображение топиков",
|
||||||
|
"copy_last_message": "Копировать последнее сообщение"
|
||||||
},
|
},
|
||||||
"theme.auto": "Автоматически",
|
"theme.auto": "Автоматически",
|
||||||
"theme.dark": "Темная",
|
"theme.dark": "Темная",
|
||||||
|
|||||||
@ -469,7 +469,8 @@
|
|||||||
"reset_to_default": "重置为默认",
|
"reset_to_default": "重置为默认",
|
||||||
"clear_shortcut": "清除快捷键",
|
"clear_shortcut": "清除快捷键",
|
||||||
"toggle_show_assistants": "切换助手显示",
|
"toggle_show_assistants": "切换助手显示",
|
||||||
"toggle_show_topics": "切换话题显示"
|
"toggle_show_topics": "切换话题显示",
|
||||||
|
"copy_last_message": "复制上一条消息"
|
||||||
},
|
},
|
||||||
"theme.auto": "跟随系统",
|
"theme.auto": "跟随系统",
|
||||||
"theme.dark": "深色主题",
|
"theme.dark": "深色主题",
|
||||||
|
|||||||
@ -469,7 +469,8 @@
|
|||||||
"reset_to_default": "重置為預設",
|
"reset_to_default": "重置為預設",
|
||||||
"clear_shortcut": "清除快捷鍵",
|
"clear_shortcut": "清除快捷鍵",
|
||||||
"toggle_show_assistants": "切換助手顯示",
|
"toggle_show_assistants": "切換助手顯示",
|
||||||
"toggle_show_topics": "切換話題顯示"
|
"toggle_show_topics": "切換話題顯示",
|
||||||
|
"copy_last_message": "複製上一条消息"
|
||||||
},
|
},
|
||||||
"theme.auto": "自動",
|
"theme.auto": "自動",
|
||||||
"theme.dark": "深色主題",
|
"theme.dark": "深色主題",
|
||||||
|
|||||||
@ -74,8 +74,8 @@ const ContentContainer = styled.div`
|
|||||||
|
|
||||||
const AppsContainer = styled.div`
|
const AppsContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 900px;
|
min-width: 950px;
|
||||||
max-width: 900px;
|
max-width: 950px;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-content: flex-start;
|
align-content: flex-start;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import Scrollbar from '@renderer/components/Scrollbar'
|
|||||||
import db from '@renderer/databases'
|
import db from '@renderer/databases'
|
||||||
import { useAssistant } from '@renderer/hooks/useAssistant'
|
import { useAssistant } from '@renderer/hooks/useAssistant'
|
||||||
import { useSettings } from '@renderer/hooks/useSettings'
|
import { useSettings } from '@renderer/hooks/useSettings'
|
||||||
|
import { useShortcut } from '@renderer/hooks/useShortcuts'
|
||||||
import { getTopic, TopicManager } from '@renderer/hooks/useTopic'
|
import { getTopic, TopicManager } from '@renderer/hooks/useTopic'
|
||||||
import { fetchMessagesSummary } from '@renderer/services/ApiService'
|
import { fetchMessagesSummary } from '@renderer/services/ApiService'
|
||||||
import { getDefaultTopic } from '@renderer/services/AssistantService'
|
import { getDefaultTopic } from '@renderer/services/AssistantService'
|
||||||
@ -266,6 +267,14 @@ const Messages: FC<Props> = ({ assistant, topic, setActiveTopic }) => {
|
|||||||
}, 300)
|
}, 300)
|
||||||
}, [displayMessages, hasMore, isLoadingMore, messages])
|
}, [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 (
|
return (
|
||||||
<Container
|
<Container
|
||||||
id="messages"
|
id="messages"
|
||||||
|
|||||||
@ -753,6 +753,15 @@ const migrateConfig = {
|
|||||||
'49': (state: RootState) => {
|
'49': (state: RootState) => {
|
||||||
state.settings.showMinappIcon = true
|
state.settings.showMinappIcon = true
|
||||||
state.settings.showFilesIcon = 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
|
return state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,13 @@ const initialState: ShortcutsState = {
|
|||||||
editable: true,
|
editable: true,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
system: false
|
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