The platform for continuously improving AI agents.
import type { ComponentProps, ReactNode } from "react";
import { ComposerPrimitive, ThreadPrimitive } from "@assistant-ui/react";
import { PromptInput } from "@/components/ai-components/prompt-input";
import { Card } from "@/components/ui/card";
import { cn } from "@/lib/utils";
export function WorkshopPrompt({
children,
dragging = false,
formProps,
inputProps,
}: {
children: ReactNode;
dragging?: boolean;
formProps: Omit<ComponentProps<typeof ComposerPrimitive.Root>, "children" | "className">;
inputProps: Omit<
ComponentProps<typeof ComposerPrimitive.Input>,
"className" | "submitMode" | "submitOnEnter"
>;
}) {
return (
<ThreadPrimitive.Root asChild>
<Card
className={cn(
"workshop-chat-surface w-full p-0 transition-colors focus-within:border-input",
dragging && "border-ring"
)}
>
<PromptInput
asChild
className="workshop-chat-inner grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-2 border-0 p-2"
>
<ComposerPrimitive.Root {...formProps}>
<ComposerPrimitive.Input
addAttachmentOnPaste={false}
cancelOnEscape={false}
maxLength={16000}
{...inputProps}
className="workshop-chat-input col-start-2 row-start-1 block min-h-7 max-h-52 w-full resize-none border-0 bg-transparent px-1 py-1.5 text-xs leading-4 outline-none focus-visible:ring-0"
rows={1}
/>
{children}
</ComposerPrimitive.Root>
</PromptInput>
</Card>
</ThreadPrimitive.Root>
);
}