Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style: reformat conversation and thread list components

Steven Enamakel5cb212d1273c
diff --git a/app/src/components/assistant-ui/elements/agent-plan.tsx b/app/src/components/assistant-ui/elements/agent-plan.tsx
index 602e1d864f..e1529d8958 100644
--- a/app/src/components/assistant-ui/elements/agent-plan.tsx
+++ b/app/src/components/assistant-ui/elements/agent-plan.tsx
@@ -43,7 +43,9 @@ export function AgentPlan({
stepTestId?: string;
}) {
const total = steps.length;
- const completed = statuses ? statuses.filter(status => status === 'done').length : progressOf(activeIndex, total);
+ const completed = statuses
+ ? statuses.filter(status => status === 'done').length
+ : progressOf(activeIndex, total);
const allDone = completed >= total;
const progress = pct(completed, total);
@@ -52,12 +54,14 @@ export function AgentPlan({
data-slot="agent-plan"
className={cn('flex w-full max-w-sm flex-col', compact ? 'gap-1.5' : 'gap-3', className)}
{...props}>
- {showHeader && <div className="flex items-center justify-between">
- <span className="text-[13.5px] font-medium">{title}</span>
- <span className={cn(mono, 'text-foreground/35 tabular-nums')}>
- {countLabel ?? `${completed} of ${total}`}
- </span>
- </div>}
+ {showHeader && (
+ <div className="flex items-center justify-between">
+ <span className="text-[13.5px] font-medium">{title}</span>
+ <span className={cn(mono, 'text-foreground/35 tabular-nums')}>
+ {countLabel ?? `${completed} of ${total}`}
+ </span>
+ </div>
+ )}
<div className="bg-foreground/[0.06] h-[3px] w-full overflow-hidden rounded-full">
<span
className="bg-foreground/80 block h-full rounded-full transition-[width] duration-500"
@@ -66,12 +70,21 @@ export function AgentPlan({
</div>
<ul className={cn('flex flex-col', compact ? 'gap-1' : 'gap-2.5')}>
{steps.map((step, i) => {
- const status = statuses?.[i] ?? (allDone || i < completed ? 'done' : i === completed ? 'active' : 'pending');
+ const status =
+ statuses?.[i] ??
+ (allDone || i < completed ? 'done' : i === completed ? 'active' : 'pending');
const done = status === 'done';
const active = status === 'active';
const failed = status === 'failed';
return (
- <li key={`${i}:${step}`} data-testid={stepTestId} data-status={status} className={cn('flex items-start gap-2.5', compact ? 'text-xs leading-4' : 'text-[13.5px]')}>
+ <li
+ key={`${i}:${step}`}
+ data-testid={stepTestId}
+ data-status={status}
+ className={cn(
+ 'flex items-start gap-2.5',
+ compact ? 'text-xs leading-4' : 'text-[13.5px]'
+ )}>
<span className="flex size-4 shrink-0 items-center justify-center">
{done ? (
<CheckIcon className="text-foreground/35 size-3.5" />
diff --git a/app/src/components/assistant-ui/elements/context-breakdown.tsx b/app/src/components/assistant-ui/elements/context-breakdown.tsx
index 88afad77ca..dbe0855552 100644
--- a/app/src/components/assistant-ui/elements/context-breakdown.tsx
+++ b/app/src/components/assistant-ui/elements/context-breakdown.tsx
@@ -17,8 +17,8 @@ import { cn } from '@/components/assistant-ui/lib/utils';
import type { ComponentProps } from 'react';
import { announced, pct } from '../utils/range';
-import { mono, paper } from './surfaces';
import { formatTokenCount } from './context-display';
+import { mono, paper } from './surfaces';
const fmt = (n: number) => n.toLocaleString('en-US');
diff --git a/app/src/components/assistant-ui/elements/context-display.tsx b/app/src/components/assistant-ui/elements/context-display.tsx
index fc693beac3..8ee9e9c9b2 100644
--- a/app/src/components/assistant-ui/elements/context-display.tsx
+++ b/app/src/components/assistant-ui/elements/context-display.tsx
@@ -190,8 +190,21 @@ function ContextDisplayRoot({
</ContextDisplayContext.Provider>
);
}
-function ContextDisplayTrigger({ className, children, showTooltip = true, ...props }: React.ComponentProps<'button'> & { showTooltip?: boolean }) {
- const trigger = <button type="button" data-slot="context-display-trigger" className={cn('inline-flex items-center rounded-md transition-colors', className)} {...props}>{children}</button>;
+function ContextDisplayTrigger({
+ className,
+ children,
+ showTooltip = true,
+ ...props
+}: React.ComponentProps<'button'> & { showTooltip?: boolean }) {
+ const trigger = (
+ <button
+ type="button"
+ data-slot="context-display-trigger"
+ className={cn('inline-flex items-center rounded-md transition-colors', className)}
+ {...props}>
+ {children}
+ </button>
+ );
return showTooltip ? <TooltipTrigger render={trigger} /> : trigger;
}
diff --git a/app/src/components/assistant-ui/thread-list.tsx b/app/src/components/assistant-ui/thread-list.tsx
index b3571a10eb..703bcd39f7 100644
--- a/app/src/components/assistant-ui/thread-list.tsx
+++ b/app/src/components/assistant-ui/thread-list.tsx
@@ -28,9 +28,9 @@ import {
import {
type ComponentPropsWithoutRef,
type FC,
- type ReactNode,
forwardRef,
Fragment,
+ type ReactNode,
useEffect,
useMemo,
useRef,
@@ -276,7 +276,10 @@ export const ThreadListItem: FC<{
return (
<ThreadListItemPrimitive.Root
data-slot="aui_thread-list-item"
- className={cn('group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none', className)}>
+ className={cn(
+ 'group hover:bg-muted focus-visible:bg-muted data-active:bg-muted has-focus-visible:bg-muted has-data-[state=open]:bg-muted relative flex h-8 items-center rounded-md transition-colors focus-visible:outline-none',
+ className
+ )}>
{isRenaming ? (
<ThreadListItemRename
onDone={restoreFocus => {
@@ -297,7 +300,11 @@ export const ThreadListItem: FC<{
className="text-muted-foreground me-1.5 size-3.5 shrink-0 animate-spin"
/>
)}
- <span data-slot="aui_thread-list-item-title" data-running={isRunning ? 'true' : undefined} aria-busy={isRunning || undefined} className="min-w-0 flex-1 truncate">
+ <span
+ data-slot="aui_thread-list-item-title"
+ data-running={isRunning ? 'true' : undefined}
+ aria-busy={isRunning || undefined}
+ className="min-w-0 flex-1 truncate">
<ThreadListItemPrimitive.Title fallback={t('chat.untitledThread')} />
</span>
{trailing}
@@ -308,7 +315,11 @@ export const ThreadListItem: FC<{
)}
</ThreadListItemPrimitive.Trigger>
)}
- <ThreadListItemMore onRename={() => setIsRenaming(true)} showArchive={showArchive} extras={menuExtras} />
+ <ThreadListItemMore
+ onRename={() => setIsRenaming(true)}
+ showArchive={showArchive}
+ extras={menuExtras}
+ />
</ThreadListItemPrimitive.Root>
);
};
@@ -378,7 +389,11 @@ const ThreadListItemRename: FC<{ onDone: (restoreFocus: boolean) => void }> = ({
);
};
-const ThreadListItemMore: FC<{ onRename: () => void; showArchive: boolean; extras?: ReactNode }> = ({ onRename, showArchive, extras }) => {
+const ThreadListItemMore: FC<{
+ onRename: () => void;
+ showArchive: boolean;
+ extras?: ReactNode;
+}> = ({ onRename, showArchive, extras }) => {
const { t } = useT();
return (
<ThreadListItemMorePrimitive.Root sharedFocusGroup>
@@ -408,16 +423,18 @@ const ThreadListItemMore: FC<{ onRename: () => void; showArchive: boolean; extra
{t('assistantUi.threadList.rename', 'Rename')}
</ThreadListItemMorePrimitive.Item>
{extras}
- {showArchive && <ThreadListItemPrimitive.Archive
- render={
- <ThreadListItemMorePrimitive.Item
- data-slot="aui_thread-list-item-more-item"
- className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none"
- />
- }>
- <ArchiveIcon className="size-4" />
- {t('assistantUi.threadList.archive', 'Archive')}
- </ThreadListItemPrimitive.Archive>}
+ {showArchive && (
+ <ThreadListItemPrimitive.Archive
+ render={
+ <ThreadListItemMorePrimitive.Item
+ data-slot="aui_thread-list-item-more-item"
+ className="hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none"
+ />
+ }>
+ <ArchiveIcon className="size-4" />
+ {t('assistantUi.threadList.archive', 'Archive')}
+ </ThreadListItemPrimitive.Archive>
+ )}
<ThreadListItemPrimitive.Delete
render={
<ThreadListItemMorePrimitive.Item
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index c803324006..6ccbf0b95e 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -459,7 +459,6 @@ const Conversations = ({
// Inline thread-title rename in the sidebar thread list — keyed by the
// thread id being edited (null = none) so any row can rename in place.
-
const {
isAtLimit,
// #3767: gate on the tier for the selected chat mode — Quick runs on the
diff --git a/app/src/features/conversations/aui/ContextUsage.test.tsx b/app/src/features/conversations/aui/ContextUsage.test.tsx
index 6f966055a2..ea72768b18 100644
--- a/app/src/features/conversations/aui/ContextUsage.test.tsx
+++ b/app/src/features/conversations/aui/ContextUsage.test.tsx
@@ -140,7 +140,15 @@ describe('ContextUsage', () => {
it('uses compact counts for the context window', async () => {
mockCall.mockResolvedValue({ ...BREAKDOWN, context_window: 1_048_576 });
- renderUsage({}, { lastTurnInputTokens: 8_511, lastTurnOutputTokens: 0, lastTurnContextTokens: 8_511, contextWindow: 1_048_576 });
+ renderUsage(
+ {},
+ {
+ lastTurnInputTokens: 8_511,
+ lastTurnOutputTokens: 0,
+ lastTurnContextTokens: 8_511,
+ contextWindow: 1_048_576,
+ }
+ );
await userEvent.hover(screen.getByTestId('composer-context-usage'));
const breakdown = await screen.findByTestId('composer-token-breakdown');
await waitFor(() => expect(breakdown).toHaveTextContent('8.5k / 1.0mn'));
diff --git a/app/src/features/conversations/aui/PinnedTodoCard.tsx b/app/src/features/conversations/aui/PinnedTodoCard.tsx
index 2bd2ffc518..7c862e55c1 100644
--- a/app/src/features/conversations/aui/PinnedTodoCard.tsx
+++ b/app/src/features/conversations/aui/PinnedTodoCard.tsx
@@ -7,17 +7,18 @@
* `userScopedStorage` and wins from then on.
*/
import debugFactory from 'debug';
+import { ChevronRightIcon, ListChecksIcon } from 'lucide-react';
import { useCallback, useEffect, useState } from 'react';
-import {
- type TodoItem,
- todoProgress,
-} from '../../../components/assistant-ui/elements/todo-list';
import { AgentPlan } from '../../../components/assistant-ui/elements/agent-plan';
-import { Button } from '../../../components/assistant-ui/ui/button';
-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../../../components/assistant-ui/ui/collapsible';
-import { ChevronRightIcon, ListChecksIcon } from 'lucide-react';
+import { type TodoItem, todoProgress } from '../../../components/assistant-ui/elements/todo-list';
import { cn } from '../../../components/assistant-ui/lib/utils';
+import { Button } from '../../../components/assistant-ui/ui/button';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '../../../components/assistant-ui/ui/collapsible';
import { useT } from '../../../lib/i18n/I18nContext';
import { userScopedStorage } from '../../../store/userScopedStorage';
@@ -95,22 +96,42 @@ export function PinnedTodoCard({
const { t } = useT();
const progress = todoProgress(items);
const [open, setOpen] = useTodoCardOpen(threadId, progress.anyActive);
- const countLabel = t('chat.todos.ofTotal').replace('{done}', String(progress.done)).replace('{total}', String(progress.total));
+ const countLabel = t('chat.todos.ofTotal')
+ .replace('{done}', String(progress.done))
+ .replace('{total}', String(progress.total));
return (
<Collapsible open={open} onOpenChange={setOpen} asChild>
- <div data-testid="todo-checklist" data-open={open ? 'true' : 'false'} data-todo-completed={progress.done} data-todo-total={progress.total} className={cn('bg-background flex w-full flex-col gap-1 rounded-lg px-2 py-1', className)}>
+ <div
+ data-testid="todo-checklist"
+ data-open={open ? 'true' : 'false'}
+ data-todo-completed={progress.done}
+ data-todo-total={progress.total}
+ className={cn('bg-background flex w-full flex-col gap-1 rounded-lg px-2 py-1', className)}>
<CollapsibleTrigger asChild>
- <Button variant="ghost" size="sm" aria-label={t('conversations.runMode.plan')} className="h-auto w-full justify-start gap-2 px-0 py-1 text-xs">
+ <Button
+ variant="ghost"
+ size="sm"
+ aria-label={t('conversations.runMode.plan')}
+ className="h-auto w-full justify-start gap-2 px-0 py-1 text-xs">
<ListChecksIcon aria-hidden className="text-muted-foreground size-3.5" />
<span className="flex-1 text-start">{t('conversations.runMode.plan')}</span>
- <span className="text-muted-foreground font-mono text-[11px]">{progress.allDone ? t('chat.todos.completed') : countLabel}</span>
- <ChevronRightIcon aria-hidden className={cn('size-3 transition-transform', open && 'rotate-90')} />
+ <span className="text-muted-foreground font-mono text-[11px]">
+ {progress.allDone ? t('chat.todos.completed') : countLabel}
+ </span>
+ <ChevronRightIcon
+ aria-hidden
+ className={cn('size-3 transition-transform', open && 'rotate-90')}
+ />
</Button>
</CollapsibleTrigger>
<CollapsibleContent forceMount asChild>
<div hidden={!open} className="max-h-[min(160px,24dvh)] overflow-y-auto pb-1">
<AgentPlan
- steps={items.map(item => item.reason && item.status === 'failed' ? `${item.text} — ${item.reason}` : item.text)}
+ steps={items.map(item =>
+ item.reason && item.status === 'failed'
+ ? `${item.text} — ${item.reason}`
+ : item.text
+ )}
statuses={items.map(item => item.status)}
activeIndex={progress.done}
compact
diff --git a/app/src/features/conversations/threadList/ThreadList.test.tsx b/app/src/features/conversations/threadList/ThreadList.test.tsx
index ec6a267887..c984ee2a4d 100644
--- a/app/src/features/conversations/threadList/ThreadList.test.tsx
+++ b/app/src/features/conversations/threadList/ThreadList.test.tsx
@@ -1,7 +1,6 @@
-import { fireEvent, render, screen, within, waitFor } from '@testing-library/react';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-
+import { fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { Thread } from '../../../types/thread';
import { PINNED_THREAD_LABEL } from './groupThreads';
@@ -83,10 +82,18 @@ describe('ThreadList', () => {
const onTogglePin = vi.fn();
const onSelectThread = vi.fn();
renderList({ onTogglePin, onSelectThread });
- await userEvent.click(within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', { name: 'assistantUi.threadList.moreOptions' }));
+ await userEvent.click(
+ within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', {
+ name: 'assistantUi.threadList.moreOptions',
+ })
+ );
await userEvent.click(await screen.findByTestId('thread-pin-t1'));
expect(onTogglePin).toHaveBeenCalledWith(expect.objectContaining({ id: 't1' }), true);
- await userEvent.click(within(screen.getByTestId('thread-row-t3').parentElement!).getByRole('button', { name: 'assistantUi.threadList.moreOptions' }));
+ await userEvent.click(
+ within(screen.getByTestId('thread-row-t3').parentElement!).getByRole('button', {
+ name: 'assistantUi.threadList.moreOptions',
+ })
+ );
await userEvent.click(await screen.findByTestId('thread-pin-t3'));
expect(onTogglePin).toHaveBeenCalledWith(expect.objectContaining({ id: 't3' }), false);
expect(onSelectThread).not.toHaveBeenCalled();
@@ -103,7 +110,11 @@ describe('ThreadList', () => {
expect(screen.queryByTestId('thread-unread-t2')).not.toBeInTheDocument();
const running = within(screen.getByTestId('thread-row-t2')).getByText('Plan trip');
expect(running).toHaveAttribute('data-running', 'true');
- expect(screen.getByTestId('thread-row-t2').querySelector('[data-slot="aui_thread-list-item-running"]')).toBeInTheDocument();
+ expect(
+ screen
+ .getByTestId('thread-row-t2')
+ .querySelector('[data-slot="aui_thread-list-item-running"]')
+ ).toBeInTheDocument();
});
it('creates and switches conversations through the runtime adapter', async () => {
@@ -120,13 +131,23 @@ describe('ThreadList', () => {
const onRenameThread = vi.fn(async () => {});
const onRequestDelete = vi.fn();
renderList({ onRenameThread, onRequestDelete });
- await userEvent.click(within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', { name: 'assistantUi.threadList.moreOptions' }));
- await userEvent.click(await screen.findByRole('menuitem', { name: 'assistantUi.threadList.rename' }));
+ await userEvent.click(
+ within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', {
+ name: 'assistantUi.threadList.moreOptions',
+ })
+ );
+ await userEvent.click(
+ await screen.findByRole('menuitem', { name: 'assistantUi.threadList.rename' })
+ );
const input = screen.getByTestId('thread-title-input-t1');
fireEvent.change(input, { target: { value: 'Updated title' } });
await userEvent.keyboard('{Enter}');
await waitFor(() => expect(onRenameThread).toHaveBeenCalledWith('t1', 'Updated title'));
- await userEvent.click(within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', { name: 'assistantUi.threadList.moreOptions' }));
+ await userEvent.click(
+ within(screen.getByTestId('thread-row-t1').parentElement!).getByRole('button', {
+ name: 'assistantUi.threadList.moreOptions',
+ })
+ );
await userEvent.click(await screen.findByRole('menuitem', { name: 'common.delete' }));
expect(onRequestDelete).toHaveBeenCalledWith(expect.objectContaining({ id: 't1' }));
});
diff --git a/app/src/features/conversations/threadList/ThreadList.tsx b/app/src/features/conversations/threadList/ThreadList.tsx
index 78889fc7c0..6154cce83e 100644
--- a/app/src/features/conversations/threadList/ThreadList.tsx
+++ b/app/src/features/conversations/threadList/ThreadList.tsx
@@ -6,9 +6,9 @@ import {
} from '@/components/assistant-ui/thread-list';
import {
AssistantRuntimeProvider,
- type ThreadMessageLike,
ThreadListItemMorePrimitive,
ThreadListPrimitive,
+ type ThreadMessageLike,
useAuiState,
useExternalStoreRuntime,
} from '@assistant-ui/react';
@@ -58,25 +58,36 @@ function ThreadRow() {
className="flex-none"
running={running}
showArchive={false}
- triggerProps={{
- 'data-testid': `thread-row-${id}`,
- 'data-analytics-id': 'chat-sidebar-thread-row',
- title: thread.actionDir
- ? t('chat.sidebar.workingFolder').replace('{folder}', folderBasename(thread.actionDir))
- : undefined,
- } as React.ComponentPropsWithoutRef<'button'>}
- trailing={!running && host.unreadThreadIds?.has(id) ? (
- <span data-testid={`thread-unread-${id}`} role="img" aria-label={t('chat.sidebar.unread')} className="bg-primary size-1.5 shrink-0 rounded-full" />
- ) : null}
- menuExtras={host.onTogglePin ? (
- <ThreadListItemMorePrimitive.Item
- data-testid={`thread-pin-${id}`}
- onSelect={() => host.onTogglePin?.(thread, !pinned)}
- className="hover:bg-accent focus:bg-accent flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none">
- <PinIcon aria-hidden className="size-4" />
- {t(pinned ? 'chat.sidebar.unpinThread' : 'chat.sidebar.pinThread')}
- </ThreadListItemMorePrimitive.Item>
- ) : null}
+ triggerProps={
+ {
+ 'data-testid': `thread-row-${id}`,
+ 'data-analytics-id': 'chat-sidebar-thread-row',
+ title: thread.actionDir
+ ? t('chat.sidebar.workingFolder').replace('{folder}', folderBasename(thread.actionDir))
+ : undefined,
+ } as React.ComponentPropsWithoutRef<'button'>
+ }
+ trailing={
+ !running && host.unreadThreadIds?.has(id) ? (
+ <span
+ data-testid={`thread-unread-${id}`}
+ role="img"
+ aria-label={t('chat.sidebar.unread')}
+ className="bg-primary size-1.5 shrink-0 rounded-full"
+ />
+ ) : null
+ }
+ menuExtras={
+ host.onTogglePin ? (
+ <ThreadListItemMorePrimitive.Item
+ data-testid={`thread-pin-${id}`}
+ onSelect={() => host.onTogglePin?.(thread, !pinned)}
+ className="hover:bg-accent focus:bg-accent flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none">
+ <PinIcon aria-hidden className="size-4" />
+ {t(pinned ? 'chat.sidebar.unpinThread' : 'chat.sidebar.pinThread')}
+ </ThreadListItemMorePrimitive.Item>
+ ) : null
+ }
/>
);
}
@@ -85,48 +96,82 @@ function ThreadRow() {
export function ThreadList(props: ThreadListProps) {
const { t } = useT();
const [search, setSearch] = useState('');
- const adapterThreads = useMemo(() => props.threads.map(thread => ({
- id: thread.id,
- remoteId: thread.id,
- status: 'regular' as const,
- title: props.resolveTitle(thread.id),
- })), [props.threads, props.resolveTitle]);
+ const adapterThreads = useMemo(
+ () =>
+ props.threads.map(thread => ({
+ id: thread.id,
+ remoteId: thread.id,
+ status: 'regular' as const,
+ title: props.resolveTitle(thread.id),
+ })),
+ [props.threads, props.resolveTitle]
+ );
const runtime = useExternalStoreRuntime({
messages: EMPTY_MESSAGES,
isRunning: false,
onNew: async () => {},
- adapters: { threadList: {
- threads: adapterThreads,
- threadId: props.selectedThreadId ?? undefined,
- onSwitchToNewThread: props.onCreateThread,
- onSwitchToThread: props.onSelectThread,
- onRename: props.onRenameThread,
- onDelete: id => {
- const thread = props.threads.find(item => item.id === id);
- if (thread) props.onRequestDelete(thread);
+ adapters: {
+ threadList: {
+ threads: adapterThreads,
+ threadId: props.selectedThreadId ?? undefined,
+ onSwitchToNewThread: props.onCreateThread,
+ onSwitchToThread: props.onSelectThread,
+ onRename: props.onRenameThread,
+ onDelete: id => {
+ const thread = props.threads.find(item => item.id === id);
+ if (thread) props.onRequestDelete(thread);
+ },
},
- } },
+ },
});
- const filtered = props.threads.filter(thread => props.resolveTitle(thread.id).toLowerCase().includes(search.trim().toLowerCase()));
+ const filtered = props.threads.filter(thread =>
+ props.resolveTitle(thread.id).toLowerCase().includes(search.trim().toLowerCase())
+ );
const groups = groupThreads(filtered, new Date(), props.isPinned ?? isThreadPinned);
return (
<AssistantRuntimeProvider runtime={runtime}>
<ThreadListHostContext.Provider value={props}>
<ThreadListRoot className="h-full min-h-0">
<div className="flex-none px-2 pb-2">
- <ThreadListNew data-testid="new-thread-button" data-analytics-id="chat-sidebar-new-thread" className="w-full" title={t('chat.newThreadShortcut')}>
+ <ThreadListNew
+ data-testid="new-thread-button"
+ data-analytics-id="chat-sidebar-new-thread"
+ className="w-full"
+ title={t('chat.newThreadShortcut')}>
{t('chat.newConversation')}
</ThreadListNew>
- {props.threads.length > 0 && <ThreadListSearch value={search} onValueChange={setSearch} />}
+ {props.threads.length > 0 && (
+ <ThreadListSearch value={search} onValueChange={setSearch} />
+ )}
</div>
- <div data-slot="aui_thread-list-items" className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-3 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
+ <div
+ data-slot="aui_thread-list-items"
+ className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pb-3 [scrollbar-gutter:stable_both-edges] [scrollbar-width:thin]">
{groups.map(group => (
- <section key={group.key} data-testid={`thread-group-${group.key}`} aria-label={t(GROUP_LABEL_KEYS[group.key])} className="flex flex-col gap-0.5">
- <h3 data-slot="aui_thread-list-group-label" className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium">{t(GROUP_LABEL_KEYS[group.key])}</h3>
- {group.threads.map(thread => <ThreadListPrimitive.ItemByIndex key={thread.id} index={props.threads.indexOf(thread)} components={{ ThreadListItem: ThreadRow }} />)}
+ <section
+ key={group.key}
+ data-testid={`thread-group-${group.key}`}
+ aria-label={t(GROUP_LABEL_KEYS[group.key])}
+ className="flex flex-col gap-0.5">
+ <h3
+ data-slot="aui_thread-list-group-label"
+ className="text-muted-foreground px-2.5 pt-3 pb-1 text-xs font-medium">
+ {t(GROUP_LABEL_KEYS[group.key])}
+ </h3>
+ {group.threads.map(thread => (
+ <ThreadListPrimitive.ItemByIndex
+ key={thread.id}
+ index={props.threads.indexOf(thread)}
+ components={{ ThreadListItem: ThreadRow }}
+ />
+ ))}
</section>
))}
- {groups.length === 0 && <p className="text-muted-foreground px-2.5 py-4 text-center text-xs">{t(search ? 'assistantUi.threadList.noThreadsFound' : 'chat.noThreads')}</p>}
+ {groups.length === 0 && (
+ <p className="text-muted-foreground px-2.5 py-4 text-center text-xs">
+ {t(search ? 'assistantUi.threadList.noThreadsFound' : 'chat.noThreads')}
+ </p>
+ )}
</div>
</ThreadListRoot>
</ThreadListHostContext.Provider>