mirror of
https://github.com/open-webui/open-webui
synced 2024-11-25 21:38:43 +00:00
refac
This commit is contained in:
parent
4eeb669ac3
commit
78d6647885
@ -14,7 +14,15 @@
|
|||||||
getChatListByTagName,
|
getChatListByTagName,
|
||||||
updateChatById
|
updateChatById
|
||||||
} from '$lib/apis/chats';
|
} from '$lib/apis/chats';
|
||||||
import { chatId, chats, mobile, pinnedChats, showSidebar, currentChatPage } from '$lib/stores';
|
import {
|
||||||
|
chatId,
|
||||||
|
chatTitle as _chatTitle,
|
||||||
|
chats,
|
||||||
|
mobile,
|
||||||
|
pinnedChats,
|
||||||
|
showSidebar,
|
||||||
|
currentChatPage
|
||||||
|
} from '$lib/stores';
|
||||||
|
|
||||||
import ChatMenu from './ChatMenu.svelte';
|
import ChatMenu from './ChatMenu.svelte';
|
||||||
import ShareChatModal from '$lib/components/chat/ShareChatModal.svelte';
|
import ShareChatModal from '$lib/components/chat/ShareChatModal.svelte';
|
||||||
@ -33,14 +41,18 @@
|
|||||||
|
|
||||||
let chatTitle = chat.title;
|
let chatTitle = chat.title;
|
||||||
|
|
||||||
const editChatTitle = async (id, _title) => {
|
const editChatTitle = async (id, title) => {
|
||||||
if (_title === '') {
|
if (title === '') {
|
||||||
toast.error($i18n.t('Title cannot be an empty string.'));
|
toast.error($i18n.t('Title cannot be an empty string.'));
|
||||||
} else {
|
} else {
|
||||||
await updateChatById(localStorage.token, id, {
|
await updateChatById(localStorage.token, id, {
|
||||||
title: _title
|
title: title
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (id === $chatId) {
|
||||||
|
_chatTitle.set(title);
|
||||||
|
}
|
||||||
|
|
||||||
currentChatPage.set(1);
|
currentChatPage.set(1);
|
||||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||||
|
Loading…
Reference in New Issue
Block a user