diff --git a/src/store/chat.ts b/src/store/chat.ts index 6d6f1e3..6fe3744 100644 --- a/src/store/chat.ts +++ b/src/store/chat.ts @@ -184,6 +184,15 @@ export const useChatStore = defineStore(ID, { this.reloadRoute(id); }, + async copyChatSetting(id: number) { + const index = this.getChatSettingIndex(id); + const chatSetting = this.chatSetting[index]; + const newChatSetting = { ...chatSetting, id: new Date().getTime() }; + this.chatSetting.unshift(newChatSetting); + this.current = newChatSetting.id; + this.reloadRoute(newChatSetting.id); + }, + async reloadRoute(id?: number | null) { setState(this.$state); await router.push({ name: 'chat', params: { id } }); diff --git a/src/views/siderbar/List.vue b/src/views/siderbar/List.vue index 8fbc366..cf1e1d4 100644 --- a/src/views/siderbar/List.vue +++ b/src/views/siderbar/List.vue @@ -75,6 +75,10 @@ }); } + async function copySelect(id: number) { + await chatStore.copyChatSetting(id); + } + async function clearSelect(id: number) { await chatStore.clearCache(id); } @@ -109,6 +113,13 @@ }), onClick: () => clearSelect(id), }, + { + label: t('common.copy'), + icon: h('i', { + class: 'fa-solid fa-copy', + }), + onClick: () => copySelect(id), + }, ], zIndex: 60, minWidth: 100,