🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(web): add copy-session-id button to session detail header (#14996)
Caleb819b91544cc8
diff --git a/web/src/components/session/index.tsx b/web/src/components/session/index.tsxindex a4d5a1ea01..cfafad5805 100644--- a/web/src/components/session/index.tsx+++ b/web/src/components/session/index.tsx@@ -18,7 +18,8 @@ import { AnnotateDrawer } from "@/src/features/scores/components/AnnotateDrawer"import { Button } from "@/src/components/ui/button";import { CommentDrawerButton } from "@/src/features/comments/CommentDrawerButton";import { useSession } from "next-auth/react";-import { Download, ExternalLinkIcon } from "lucide-react";+import { CheckIcon, CopyIcon, Download, ExternalLinkIcon } from "lucide-react";+import { useCopyToClipboard } from "@/src/hooks/useCopyToClipboard";import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";import Page from "@/src/components/layouts/page";import {@@ -213,6 +214,32 @@ const SessionScores = ({</div>);};+const CopySessionIdButton: React.FC<{+ sessionId: string;+}> = ({ sessionId }) => {+ const capture = usePostHogClientCapture();+ const { copy, isCopied } = useCopyToClipboard();++ return (+ <Button+ variant="ghost"+ size="icon-xs"+ title="Copy session ID"+ aria-label="Copy session ID"+ onClick={async () => {+ capture("session_detail:copy_session_id_click");+ await copy(sessionId);+ }}+ >+ {isCopied ? (+ <CheckIcon className="text-muted-green h-4 w-4" />+ ) : (+ <CopyIcon className="h-4 w-4" />+ )}+ </Button>+ );+};+export const SessionPage: React.FC<{sessionId: string;projectId: string;@@ -382,6 +409,7 @@ export const SessionPage: React.FC<{key="publish"size="icon-xs"/>+ <CopySessionIdButton key="copy-id" sessionId={sessionId} /></div>),actionButtonsRight: (@@ -1089,6 +1117,7 @@ const LoadedSessionEventsPage: React.FC<{key="publish"size="icon-xs"/>+ <CopySessionIdButton key="copy-id" sessionId={sessionId} /></div>),actionButtonsRight: (diff --git a/web/src/features/posthog-analytics/usePostHogClientCapture.ts b/web/src/features/posthog-analytics/usePostHogClientCapture.tsindex 501f28b884..13103179da 100644--- a/web/src/features/posthog-analytics/usePostHogClientCapture.ts+++ b/web/src/features/posthog-analytics/usePostHogClientCapture.ts@@ -108,7 +108,11 @@ export const events = {"duplicate_button_click","duplicate_form_submit",],- session_detail: ["publish_button_click", "download_button_click"],+ session_detail: [+ "publish_button_click",+ "download_button_click",+ "copy_session_id_click",+ ],eval_config: ["new_form_submit","new_form_open",