import { Trace } from "@/src/components/trace"; import { ObservationPreview } from "@/src/components/trace/ObservationPreview"; import { TracePreview } from "@/src/components/trace/TracePreview"; import { type AnnotationQueueItem, AnnotationQueueObjectType, type ValidatedScoreConfig, } from "@langfuse/shared"; import { useEffect } from "react"; import { StringParam, useQueryParam } from "use-query-params"; import { AnnotationDrawerSection } from "../shared/AnnotationDrawerSection"; import { AnnotationProcessingLayout } from "../shared/AnnotationProcessingLayout"; interface TraceAnnotationProcessorProps { item: AnnotationQueueItem & { parentTraceId?: string | null; lockedByUser: { name: string | null | undefined } | null; }; data: any; // Trace data with observations and scores view: "showTree" | "hideTree"; configs: ValidatedScoreConfig[]; projectId: string; onHasCommentDraftChange?: (hasDraft: boolean) => void; } export const TraceAnnotationProcessor: React.FC< TraceAnnotationProcessorProps > = ({ item, data, view, configs, projectId, onHasCommentDraftChange }) => { const traceId = item.parentTraceId ?? item.objectId; const [currentObservationId, setCurrentObservationId] = useQueryParam( "observation", StringParam, ); useEffect(() => { if ( view === "showTree" && item.objectType === AnnotationQueueObjectType.OBSERVATION ) { setCurrentObservationId(item.objectId); } else setCurrentObservationId(undefined); }, [view, item, setCurrentObservationId]); if (!data) return