diff --git a/desktop/src/components/chat/AssistantOutputTargetCard.test.tsx b/desktop/src/components/chat/AssistantOutputTargetCard.test.tsx index 73aeac3a..2fd7b836 100644 --- a/desktop/src/components/chat/AssistantOutputTargetCard.test.tsx +++ b/desktop/src/components/chat/AssistantOutputTargetCard.test.tsx @@ -74,10 +74,10 @@ describe('AssistantOutputTargetCard', () => { expect(screen.getByText('docs/readme.md')).toBeInTheDocument() }) - it('renders a localhost target title + Localhost badge', () => { + it('renders a localhost target title + Localhost badge (URL not duplicated)', () => { render() - // Title + subtitle both fall back to href, so it appears twice. - expect(screen.getAllByText('http://localhost:5173/').length).toBeGreaterThan(0) + // subtitle equals the title for localhost, so the URL renders exactly once. + expect(screen.getAllByText('http://localhost:5173/')).toHaveLength(1) expect(screen.getByText('assistantOutputs.kind.localhost')).toBeInTheDocument() }) diff --git a/desktop/src/components/chat/AssistantOutputTargetCard.tsx b/desktop/src/components/chat/AssistantOutputTargetCard.tsx index aefb944b..a627c232 100644 --- a/desktop/src/components/chat/AssistantOutputTargetCard.tsx +++ b/desktop/src/components/chat/AssistantOutputTargetCard.tsx @@ -34,6 +34,7 @@ export function AssistantOutputTargetCard({ target, sessionId, workDir }: Props) ? t('assistantOutputs.kind.markdown') : t('assistantOutputs.kind.image') const subtitle = target.subtitle ?? target.normalizedPath ?? target.href + const showSubtitle = subtitle !== target.title const handleOpen = useCallback((event: ReactMouseEvent) => { event.stopPropagation() @@ -99,9 +100,11 @@ export function AssistantOutputTargetCard({ target, sessionId, workDir }: Props) {badge} -
- {subtitle} -
+ {showSubtitle && ( +
+ {subtitle} +
+ )}