Sort chat recents by last activity (#6844)
* show chat by by last activity * Update chat thread updated_at logic and enhance sidebar chat item handling * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Lee Jackson <130007945+Imagineer99@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
37075c5422
commit
07ecdb34c0
9 changed files with 252 additions and 13 deletions
|
|
@ -359,7 +359,11 @@ export function AppSidebar() {
|
|||
const activeProjectId = isChatRoute
|
||||
? ((search.project as string | undefined) ?? null)
|
||||
: null;
|
||||
const { items: allChatItems } = useChatSidebarItems({
|
||||
const {
|
||||
items: allChatItems,
|
||||
archivedItems: archivedChatItems,
|
||||
loaded: chatItemsLoaded,
|
||||
} = useChatSidebarItems({
|
||||
enabled: !isStudioRoute,
|
||||
requireMessages: false,
|
||||
});
|
||||
|
|
@ -1306,6 +1310,16 @@ export function AppSidebar() {
|
|||
renderChatSidebarItem(item, "recent"),
|
||||
)}
|
||||
</SidebarMenu>
|
||||
{/* "No chats yet" only when there is truly no history:
|
||||
project-scoped and archived threads leave Recents empty
|
||||
but still count as existing chats. */}
|
||||
{chatItemsLoaded &&
|
||||
allChatItems.length === 0 &&
|
||||
archivedChatItems.length === 0 && (
|
||||
<p className="px-3 py-2 text-xs text-muted-foreground">
|
||||
{t("shell.navigation.noChatsYet")}
|
||||
</p>
|
||||
)}
|
||||
</SidebarGroupContent>
|
||||
</CollapsibleContent>
|
||||
</SidebarGroup>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue