Skip to content

Commit e4f256c

Browse files
Add tool count to details card header
1 parent 8f66fb8 commit e4f256c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/web/src/features/chat/components/chatThread/detailsCard.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import useCaptureEvent from '@/hooks/useCaptureEvent';
99
import { cn, getShortenedNumberDisplayString } from '@/lib/utils';
1010
import isEqual from "fast-deep-equal/react";
1111
import { useStickToBottom } from 'use-stick-to-bottom';
12-
import { Brain, ChevronDown, ChevronRight, Clock, InfoIcon, Loader2, ScanSearchIcon, Zap } from 'lucide-react';
13-
import { memo, useCallback, useEffect, useState } from 'react';
12+
import { Brain, ChevronDown, ChevronRight, Clock, InfoIcon, Loader2, ScanSearchIcon, Wrench, Zap } from 'lucide-react';
13+
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
1414
import { usePrevious } from '@uidotdev/usehooks';
1515
import { SBChatMessageMetadata, SBChatMessagePart } from '../../types';
1616
import { SearchScopeIcon } from '../searchScopeIcon';
@@ -46,6 +46,8 @@ const DetailsCardComponent = ({
4646
}: DetailsCardProps) => {
4747
const captureEvent = useCaptureEvent();
4848

49+
const toolCallCount = useMemo(() => thinkingSteps.flat().filter(part => part.type.startsWith('tool-')).length, [thinkingSteps]);
50+
4951
const handleExpandedChanged = useCallback((next: boolean) => {
5052
captureEvent('wa_chat_details_card_toggled', { chatId, isExpanded: next });
5153
onExpandedChanged(next);
@@ -140,6 +142,12 @@ const DetailsCardComponent = ({
140142
{Math.round(metadata.totalResponseTimeMs / 1000)} seconds
141143
</div>
142144
)}
145+
{toolCallCount > 0 && (
146+
<div className="flex items-center text-xs">
147+
<Wrench className="w-3 h-3 mr-1 flex-shrink-0" />
148+
{toolCallCount} tool call{toolCallCount === 1 ? '' : 's'}
149+
</div>
150+
)}
143151
</>
144152
)}
145153
</div>

0 commit comments

Comments
 (0)