Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

1.4 KB
Raw Blame
import type { ReactNode } from "react";
import { FlaskConical, PanelRightClose, PanelRightOpen } from "@langfuse/icons";

import { Button } from "@/src/components/ui/button";

export function EvaluatorTestPanel({
  open,
  onOpenChange,
  sampleSelector,
  testSection,
}: {
  open: boolean;
  onOpenChange: (open: boolean) => void;
  sampleSelector: ReactNode;
  testSection: ReactNode;
}) {
  return (
    <aside className="flex h-full min-h-0 flex-col overflow-hidden">
      <div className="flex h-12 shrink-0 items-center justify-between border-b px-6">
        {open ? (
          <div className="flex items-center gap-2">
            <FlaskConical size="base" />
            <h2 className="font-bold">Test with sample observations</h2>
          </div>
        ) : null}
        <Button
          type="button"
          variant="ghost"
          size="icon"
          aria-label={open ? "Collapse test panel" : "Expand test panel"}
          title={open ? "Collapse test panel" : "Expand test panel"}
          onClick={() => onOpenChange(!open)}
        >
          {open ? (
            <PanelRightClose size="base" color="default" />
          ) : (
            <PanelRightOpen size="base" color="default" />
          )}
        </Button>
      </div>
      {open ? (
        <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-6">
          {sampleSelector}
          {testSection}
        </div>
      ) : null}
    </aside>
  );
}