mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
feat: chat clone
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
getChatListByTagName,
|
||||
updateChatById,
|
||||
getAllChatTags,
|
||||
archiveChatById
|
||||
archiveChatById,
|
||||
cloneChatById
|
||||
} from '$lib/apis/chats';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { fade, slide } from 'svelte/transition';
|
||||
@@ -182,6 +183,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
const cloneChatHandler = async (id) => {
|
||||
const res = await cloneChatById(localStorage.token, id).catch((error) => {
|
||||
toast.error(error);
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
goto(`/c/${res.id}`);
|
||||
await chats.set(await getChatList(localStorage.token));
|
||||
}
|
||||
};
|
||||
|
||||
const saveSettings = async (updated) => {
|
||||
await settings.set({ ...$settings, ...updated });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
@@ -601,6 +614,9 @@
|
||||
<div class="flex self-center space-x-1 z-10">
|
||||
<ChatMenu
|
||||
chatId={chat.id}
|
||||
cloneChatHandler={() => {
|
||||
cloneChatHandler(chat.id);
|
||||
}}
|
||||
shareHandler={() => {
|
||||
shareChatId = selectedChatId;
|
||||
showShareChatModal = true;
|
||||
|
||||
Reference in New Issue
Block a user