Skip to content

The platform for continuously improving AI agents.

833 B
Raw Blame
// Adapted from the AI SDK Agents Prompt Input frame; source access is recorded in NOTICE.md.
import type { ComponentProps } from "react";

import { Slot } from "radix-ui";

import { cn } from "@/lib/utils";

// The editor and controls are slots so persisted drafts, uploads and queued messages
// remain owned by the shared conversation runtime rather than a second local store.
export function PromptInput({
  asChild = false,
  className,
  ...props
}: ComponentProps<"form"> & { asChild?: boolean }) {
  const Root = asChild ? Slot.Root : "form";
  return (
    <Root
      {...props}
      className={cn(
        "relative flex min-w-0 flex-col overflow-hidden rounded-md border border-border bg-popover transition-colors focus-within:border-input",
        className
      )}
      data-slot="prompt-input-frame"
    />
  );
}