🪢 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
fix(web): collapse the corrected output section behind a button (#17534)
Trang Nguyen2992ca23e643
diff --git a/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx b/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsxindex 109efa7320..4fc4718b0c 100644--- a/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx+++ b/web/src/features/traces/components/IOPreview/components/CorrectedOutputField.tsx@@ -8,6 +8,7 @@ import { useCorrectionEditor } from "../hooks/useCorrectionEditor";import { useMemo, useState } from "react";import { CodeMirrorEditor } from "@/src/components/editor/CodeMirrorEditor";import { useHasProjectAccess } from "@/src/features/rbac";+import { usePostHogClientCapture } from "@/src/features/posthog-analytics";import { Switch } from "@/src/components/design-system/Switch/Switch";import useLocalStorage from "@/src/components/useLocalStorage";import { CorrectedOutputDiffDialog } from "./CorrectedOutputDiffDialog";@@ -46,6 +47,7 @@ export function CorrectedOutputField({compact = false,}: CorrectedOutputFieldProps) {const hasAccess = useHasProjectAccess({ projectId, scope: "scores:CUD" });+ const capture = usePostHogClientCapture();// JSON validation toggle (persisted in localStorage)const [strictJsonMode, setStrictJsonMode] = useLocalStorage(@@ -56,6 +58,9 @@ export function CorrectedOutputField({// Diff dialog stateconst [isDiffDialogOpen, setIsDiffDialogOpen] = useState(false);+ // One-line link by default; the full section renders on demand.+ const [isExpanded, setIsExpanded] = useState(false);+// Merge cache + server dataconst { effectiveCorrection, correctionValue } = useCorrectionData(existingCorrection,@@ -155,6 +160,29 @@ export function CorrectedOutputField({setIsEditing(false);};+ // Collapsed to a one-line link by default: corrections are used by a small+ // share of users, so the full editor UI only takes space once asked for.+ if (!isExpanded) {+ return (+ <div className="px-2 py-2">+ <button+ type="button"+ onClick={() => {+ capture("trace_detail:io_section_collapse_toggle", {+ section: "corrected_output",+ collapsed: false,+ });+ setIsExpanded(true);+ }}+ className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs hover:underline"+ >+ <Pencil className="size-3 shrink-0" aria-hidden />+ {hasContent ? "Corrected output" : "Correct output"}+ </button>+ </div>+ );+ }+return (<><CorrectedOutputDiffDialog