Skip to content
Merged
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions apps/webapp/app/components/primitives/CopyTextLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { ClipboardCheckIcon, ClipboardIcon } from "lucide-react";
import { useCopy } from "~/hooks/useCopy";
import { cn } from "~/utils/cn";

type CopyTextLinkProps = {
value: string;
className?: string;
};

export function CopyTextLink({ value, className }: CopyTextLinkProps) {
const { copy, copied } = useCopy(value);

return (
<button
type="button"
onClick={copy}
className={cn(
"inline-flex cursor-pointer items-center gap-1 text-xs transition-colors",
copied
? "text-success"
: "text-text-dimmed hover:text-text-bright",
className
)}
>
{copied ? "Copied" : "Copy"}
{copied ? (
<ClipboardCheckIcon className="size-3" />
) : (
<ClipboardIcon className="size-3" />
)}
</button>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { MachineTooltipInfo } from "~/components/MachineTooltipInfo";
import { Button, LinkButton } from "~/components/primitives/Buttons";
import { Callout } from "~/components/primitives/Callout";
import { CopyableText } from "~/components/primitives/CopyableText";
import { CopyTextLink } from "~/components/primitives/CopyTextLink";
import { DateTime, DateTimeAccurate } from "~/components/primitives/DateTime";
import { Header2, Header3 } from "~/components/primitives/Headers";
import { Paragraph } from "~/components/primitives/Paragraph";
Expand Down Expand Up @@ -263,19 +264,21 @@ function SpanBody({
span.entity?.type === "prompt";

return (
<div className={cn(
"grid h-full max-h-full overflow-hidden bg-background-bright",
isAiInspector ? "grid-rows-[auto_1fr]" : "grid-rows-[2.5rem_1fr]"
)}>
<div
className={cn(
"grid h-full max-h-full overflow-hidden bg-background-bright",
isAiInspector ? "grid-rows-[auto_1fr]" : "grid-rows-[2.5rem_1fr]"
)}
>
<div className="border-b border-grid-bright px-3 pr-2">
<div className="flex h-10 items-center justify-between gap-2 overflow-x-hidden">
<div className="flex items-center gap-1 overflow-x-hidden">
<div className="grid h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-2">
<div className="flex min-w-0 items-center gap-1">
<RunIcon
name={span.style?.icon}
spanName={span.message}
className="size-5 min-h-5 min-w-5"
/>
<Header2 className={cn("overflow-x-hidden")}>
<Header2 className="min-w-0">
<SpanTitle {...span} size="large" hideAccessory overrideDimmed />
</Header2>
</div>
Expand Down Expand Up @@ -311,7 +314,6 @@ function formatSpanDuration(nanoseconds: number): string {
return `${mins}m ${secs}s`;
}


function applySpanOverrides(span: Span, spanOverrides?: SpanOverride): Span {
if (!spanOverrides) {
return span;
Expand Down Expand Up @@ -1259,8 +1261,13 @@ function SpanEntity({ span }: { span: Span }) {
)}
<Property.Table>
<Property.Item>
<Property.Label>Message</Property.Label>
<Property.Value className="whitespace-pre-wrap">{span.message}</Property.Value>
<Property.Label className="flex items-center justify-between">
<span>Message</span>
<CopyTextLink value={span.message} />
</Property.Label>
<Property.Value className="whitespace-pre-wrap [overflow-wrap:break-word]">
{span.message}
</Property.Value>
</Property.Item>
</Property.Table>
{span.events.length > 0 && <SpanEvents spanEvents={span.events} />}
Expand Down Expand Up @@ -1416,7 +1423,13 @@ function SpanEntity({ span }: { span: Span }) {
<AISpanDetails
aiData={span.entity.object}
promptVersionData={span.entity.promptVersionData}
rawProperties={typeof span.properties === "string" ? span.properties : span.properties != null ? JSON.stringify(span.properties, null, 2) : undefined}
rawProperties={
typeof span.properties === "string"
? span.properties
: span.properties != null
? JSON.stringify(span.properties, null, 2)
: undefined
}
startTime={span.startTime}
duration={span.duration}
/>
Expand Down Expand Up @@ -1456,4 +1469,3 @@ function SpanEntity({ span }: { span: Span }) {
}
}
}

Loading