Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Library: equal size chat cards and no loading placeholders (#12221)
Michael Han6c20f0fac752
diff --git a/studio/frontend/src/features/library/chats/chats-library.tsx b/studio/frontend/src/features/library/chats/chats-library.tsxindex 42c5b1a5cc8..5f6615a363e 100644--- a/studio/frontend/src/features/library/chats/chats-library.tsx+++ b/studio/frontend/src/features/library/chats/chats-library.tsx@@ -18,7 +18,6 @@ import {DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";-import { Skeleton } from "@/components/ui/skeleton";import {exportConversationByFormat,DeleteChatFilesSwitch,@@ -237,17 +236,6 @@ function EmptyState({);}-function LoadingRows() {- return (- <div className="mt-6 flex flex-col gap-2">- {Array.from({ length: 8 }, (_, index) => (- // biome-ignore lint/suspicious/noArrayIndexKey: fixed placeholders with no identity- <Skeleton key={index} className="h-12 rounded-[14px]" />- ))}- </div>- );-}-function errorDescription(err: unknown): string | undefined {return err instanceof Error ? err.message : undefined;}@@ -993,7 +981,7 @@ export function ChatsLibrary({}function renderChats() {- if (!loaded) return <LoadingRows />;+ if (!loaded) return null;const filedProjects = renderSectionProjects();if (visibleChats.length === 0 && filedProjects) return filedProjects;if (visibleChats.length === 0) {@@ -1131,7 +1119,7 @@ export function ChatsLibrary({list ? (<div className={cn("mt-1 flex flex-col", LIST_ROW_GAP)}>{shownEntries.map(entryRow)}</div>) : (- <CardGrid>{shownEntries.map(entryRow)}</CardGrid>+ <CardGrid equalRows>{shownEntries.map(entryRow)}</CardGrid>)) : (groups.map((group) => (@@ -1146,7 +1134,7 @@ export function ChatsLibrary({{group.items.map((chat) => chatRow(chat, group.bucket?.kind))}</div>) : (- <CardGrid>{group.items.map((chat) => chatRow(chat, group.bucket?.kind))}</CardGrid>+ <CardGrid equalRows>{group.items.map((chat) => chatRow(chat, group.bucket?.kind))}</CardGrid>)}</section>))@@ -1167,7 +1155,7 @@ export function ChatsLibrary({}function renderSections() {- if (!loaded) return <LoadingRows />;+ if (!loaded) return null;if (visibleSections.length === 0) {return query.trim() ? (<EmptyState@@ -1209,11 +1197,11 @@ export function ChatsLibrary({);}return (- <CardGrid>+ <CardGrid equalRows><buttontype="button"onClick={() => setMovingIntoNew({ kind: "section", chats: [] })}- className="flex min-h-40 flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-ui-14 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground"+ className="flex aspect-[8/7] flex-col self-stretch items-center justify-center gap-2 rounded-xl border border-dashed border-border text-ui-14 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground"><HugeiconsIcon icon={PlusSignIcon} strokeWidth={1.5} className="size-6" />{t("shell.sections.newSection")}@@ -1226,7 +1214,7 @@ export function ChatsLibrary({}function renderAll() {- if (!loaded || !projectsLoaded) return <LoadingRows />;+ if (!loaded || !projectsLoaded) return null;const nothing =visibleProjects.length === 0 && visibleSections.length === 0 && visibleChats.length === 0;if (nothing) return renderChats();@@ -1255,7 +1243,7 @@ export function ChatsLibrary({))}</div>) : (- <CardGrid>+ <CardGrid equalRows>{sectionProjects.map((project) => (<ProjectCard key={project.id} project={project} stats={stats.get(project.id)} />))}@@ -1266,7 +1254,7 @@ export function ChatsLibrary({}function renderProjects() {- if (!projectsLoaded || !loaded) return <LoadingRows />;+ if (!projectsLoaded || !loaded) return null;if (visibleProjects.length === 0) {return query.trim() ? (<EmptyState@@ -1304,12 +1292,12 @@ export function ChatsLibrary({);}return (- <CardGrid>+ <CardGrid equalRows>{!embedded && (<buttontype="button"onClick={() => setCreatingProject(true)}- className="flex min-h-44 flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-ui-14 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground"+ className="flex aspect-[8/7] flex-col self-stretch items-center justify-center gap-2 rounded-xl border border-dashed border-border text-ui-14 text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground"><HugeiconsIcon icon={FolderAddIcon} strokeWidth={1.5} className="size-6" />{t("library.chats.toolbar.newProject")}diff --git a/studio/frontend/src/features/library/components/library-cards.tsx b/studio/frontend/src/features/library/components/library-cards.tsxindex efff5792e08..26951ad558a 100644--- a/studio/frontend/src/features/library/components/library-cards.tsx+++ b/studio/frontend/src/features/library/components/library-cards.tsx@@ -289,14 +289,24 @@ export function Masonry<T>({);}-export function CardGrid({ children }: { children: ReactNode }) {+export function CardGrid({+ children,+ equalRows = false,+}: {+ children: ReactNode;+ /** Size every row to the tallest card, so all cards match. */+ equalRows?: boolean;+}) {const container = useRef<HTMLDivElement>(null);const columns = useCardColumns(container);return (<divref={container}className={cn("grid gap-x-5", CARD_ROW_GAP)}- style={{ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` }}+ style={{+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`,+ gridAutoRows: equalRows ? "1fr" : undefined,+ }}>{children}</div>