Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: conditionally display re-ranker queries in span details #4263

Merged
merged 2 commits into from
Aug 16, 2024
Merged
Changes from all 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
17 changes: 10 additions & 7 deletions app/src/pages/trace/SpanDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,11 @@ function RerankerSpanInfo(props: {
() => spanAttributes[SemanticAttributePrefixes.reranker] || null,
[spanAttributes]
);
const query = useMemo<string>(() => {
const query = useMemo<string | null>(() => {
if (rerankerAttributes == null) {
return "";
return null;
}
return (rerankerAttributes[RerankerAttributePostfixes.query] ||
"") as string;
return rerankerAttributes[RerankerAttributePostfixes.query] || null;
}, [rerankerAttributes]);
const input_documents = useMemo<AttributeDocument[]>(() => {
if (rerankerAttributes == null) {
Expand All @@ -845,15 +844,18 @@ function RerankerSpanInfo(props: {
return (
<Flex direction="column" gap="size-200">
<MarkdownDisplayProvider>
<Card title="Query" {...defaultCardProps}>
<ConnectedMarkdownBlock>{query}</ConnectedMarkdownBlock>
</Card>
{query && (
<Card title="Query" {...defaultCardProps}>
<ConnectedMarkdownBlock>{query}</ConnectedMarkdownBlock>
</Card>
)}
</MarkdownDisplayProvider>
<Card
title={"Input Documents"}
titleExtra={<Counter variant="light">{numInputDocuments}</Counter>}
{...defaultCardProps}
defaultOpen={false}
bodyStyle={{ padding: 0 }}
>
{
<ul
Expand Down Expand Up @@ -883,6 +885,7 @@ function RerankerSpanInfo(props: {
title={"Output Documents"}
titleExtra={<Counter variant="light">{numOutputDocuments}</Counter>}
{...defaultCardProps}
bodyStyle={{ padding: 0 }}
>
{
<ul
Expand Down
Loading