Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions static/app/components/core/badge/tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,7 @@ const Text = styled('div')`
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;

/* @TODO(jonasbadalic): Some occurrences pass other things than strings into the children prop. */
Comment thread
obostjancic marked this conversation as resolved.
display: flex;
align-items: center;
gap: ${p => p.theme.space.xs};
min-width: 0;
`;

const IconWrapper = styled('span')`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,38 @@ export function ConversationAggregatesBar({
<Text size="sm" bold variant="muted" wrap="nowrap">
{t('Used Tools')}
</Text>
{aggregates.toolNames.slice(0, VISIBLE_TOOL_COUNT).map(name => (
<Tag key={name} variant="info">
{name}
</Tag>
{aggregates.toolNames.slice(0, VISIBLE_TOOL_COUNT).map((name, index, arr) => (
<Tooltip key={name} title={name} showOnlyOnOverflow skipWrapper>
<Tag
variant="info"
style={
index === arr.length - 1
? {flexShrink: 1, minWidth: 0}
: {flexShrink: 0}
}
>
{name}
</Tag>
</Tooltip>
Comment thread
obostjancic marked this conversation as resolved.
Outdated
))}
{aggregates.toolNames.length > VISIBLE_TOOL_COUNT && (
<DropdownMenu
size="sm"
triggerLabel={
<Text size="sm" variant="muted">
{t('+%s more', aggregates.toolNames.length - VISIBLE_TOOL_COUNT)}
</Text>
<Tooltip
title={
<MoreToolsTooltip>
{aggregates.toolNames.slice(VISIBLE_TOOL_COUNT).map(name => (
<Tag key={name} variant="info">
{name}
</Tag>
))}
</MoreToolsTooltip>
}
triggerProps={{
size: 'zero',
variant: 'transparent',
showChevron: false,
}}
items={aggregates.toolNames.slice(VISIBLE_TOOL_COUNT).map(name => ({
key: name,
label: <Tag variant="info">{name}</Tag>,
textValue: name,
}))}
/>
isHoverable
skipWrapper
>
<Text size="sm" variant="muted" wrap="nowrap">
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use <InfoText> here instead of Text with a tooltip ?

{t('+%s more', aggregates.toolNames.length - VISIBLE_TOOL_COUNT)}
</Text>
</Tooltip>
)}
</ToolTagsRow>
)
Expand Down Expand Up @@ -405,3 +413,10 @@ function ToolTagsRow({children}: {children: React.ReactNode}) {
</Flex>
);
}

const MoreToolsTooltip = styled('div')`
display: flex;
flex-wrap: wrap;
gap: ${p => p.theme.space.xs};
padding: ${p => p.theme.space.xs} 0;
`;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should please be the Flex primitive component - no more styled divs if possible.

Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export function MessageToolCalls({
radius="sm"
padding="xs sm"
cursor="pointer"
hasError={tool.hasError}
isSelected={isToolSelected}
onClick={(e: React.MouseEvent) => {
e.stopPropagation();
trackAnalytics('conversations.message.click-tool-call', {organization});
Expand All @@ -52,14 +54,12 @@ export function MessageToolCalls({
{t('Called tool')}
</Text>
</Container>
<ClickableTag
<Tag
variant={tool.hasError ? 'danger' : 'info'}
icon={tool.hasError ? <IconFire /> : undefined}
hasError={tool.hasError}
isSelected={isToolSelected}
>
{tool.name}
</ClickableTag>
</Tag>
{toolNode && <ToolInputPreview node={toolNode} />}
</Flex>
</ToolCallLine>
Expand All @@ -81,15 +81,10 @@ function ToolInputPreview({node}: {node: AITraceSpanNode}) {
);
}

const ToolCallLine = styled(Container)`
const ToolCallLine = styled(Container)<{hasError?: boolean; isSelected?: boolean}>`
&:hover {
opacity: 0.85;
}
`;

const ClickableTag = styled(Tag)<{hasError?: boolean; isSelected?: boolean}>`
cursor: pointer;
padding: 0 ${p => p.theme.space.xs};
${p =>
p.isSelected &&
`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export function ToolTags({toolNames}: ToolTagsProps) {
}
}}
variant="info"
style={{maxWidth: '100%', minWidth: 0}}
>
{toolName}
</Tag>
Expand Down
Loading