mirror of
https://github.com/open-webui/open-webui
synced 2025-02-20 12:00:22 +00:00
refac
This commit is contained in:
parent
a084938d9c
commit
49677e9c9d
@ -45,7 +45,7 @@ router = APIRouter()
|
||||
async def get_session_user_chat_list(
|
||||
user=Depends(get_verified_user), page: Optional[int] = None
|
||||
):
|
||||
if page:
|
||||
if page is not None:
|
||||
limit = 20
|
||||
skip = (page - 1) * limit
|
||||
|
||||
|
@ -423,7 +423,7 @@
|
||||
files: chatFiles
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
@ -471,7 +471,7 @@
|
||||
files: chatFiles
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
@ -633,7 +633,7 @@
|
||||
timestamp: Date.now()
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await chatId.set(chat.id);
|
||||
} else {
|
||||
@ -710,7 +710,7 @@
|
||||
})
|
||||
);
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
|
||||
return _responses;
|
||||
@ -959,7 +959,7 @@
|
||||
files: chatFiles
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
@ -1228,7 +1228,7 @@
|
||||
files: chatFiles
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
}
|
||||
@ -1395,7 +1395,7 @@
|
||||
if ($settings.saveChatHistory ?? true) {
|
||||
chat = await updateChatById(localStorage.token, _chatId, { title: _title });
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}
|
||||
};
|
||||
|
@ -90,7 +90,7 @@
|
||||
history: history
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
||||
} else {
|
||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||
enablePagination();
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
}
|
||||
|
@ -209,7 +209,7 @@
|
||||
}
|
||||
|
||||
allChatsLoaded = false;
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
@ -453,6 +453,7 @@
|
||||
on:click={async () => {
|
||||
enablePagination();
|
||||
allChatsLoaded = false;
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
}}
|
||||
>
|
||||
{$i18n.t('all')}
|
||||
@ -469,6 +470,7 @@
|
||||
// if the tag we deleted is no longer a valid tag, return to main chat list view
|
||||
enablePagination();
|
||||
allChatsLoaded = false;
|
||||
chatIds = await getChatList(localStorage.token, $currentChatPage);
|
||||
}
|
||||
await chats.set(chatIds);
|
||||
}}
|
||||
|
@ -41,7 +41,7 @@
|
||||
title: _title
|
||||
});
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
}
|
||||
@ -56,7 +56,7 @@
|
||||
if (res) {
|
||||
goto(`/c/${res.id}`);
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
}
|
||||
@ -65,7 +65,7 @@
|
||||
const archiveChatHandler = async (id) => {
|
||||
await archiveChatById(localStorage.token, id);
|
||||
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
await chats.set(await getChatList(localStorage.token, $currentChatPage));
|
||||
await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
|
||||
};
|
||||
|
@ -784,7 +784,7 @@ export const bestMatchingLanguage = (supportedLanguages, preferredLanguages, def
|
||||
export const enablePagination = () => {
|
||||
// Enable infinite scroll pagination
|
||||
chats.set([]);
|
||||
currentChatPage.set(0);
|
||||
currentChatPage.set(1);
|
||||
scrollPaginationEnabled.set(true);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user