import React from "react"; import { Button } from "@/src/components/ui/button"; import { Badge } from "@/src/components/ui/badge"; import { ChevronDown, Wrench, Braces, Variable } from "lucide-react"; import { Popover, PopoverContent, PopoverTrigger, } from "@/src/components/ui/popover"; import { usePlaygroundContext } from "../context"; import { usePlaygroundWindowSize } from "../hooks/usePlaygroundWindowSize"; import { PlaygroundTools, PlaygroundToolsPopover } from "./PlaygroundTools"; import { StructuredOutputSchemaSection, StructuredOutputSchemaPopover, } from "./StructuredOutputSchemaSection"; import { Variables } from "./Variables"; import { MessagePlaceholders } from "./MessagePlaceholders"; export const ConfigurationDropdowns: React.FC = () => { const { containerRef, isVeryCompact, isCompact } = usePlaygroundWindowSize(); const { tools, structuredOutputSchema, promptVariables, messagePlaceholders, } = usePlaygroundContext(); const toolsCount = tools.length; const hasSchema = structuredOutputSchema ? 1 : 0; const variablesCount = promptVariables.length + messagePlaceholders.length; // Helper function to get responsive content (text or icon) const getResponsiveContent = ( fullText: string, IconComponent: React.ComponentType<{ className?: string }>, abbreviation?: string, ) => { if (isVeryCompact) { return ; } if (isCompact) { return ( <> {abbreviation ?? fullText} ); } return ( <> {fullText} ); }; return (
{/* Tools Dropdown */}

Tools

Configure tools for your model to use.

{toolsCount > 0 ? (
) : (

No tools attached.

)}
{/* Structured Output Dropdown */}

Structured Output

Configure JSON schema for structured output.

{structuredOutputSchema ? (
) : (

No schema provided.

)}
{/* Variables & Placeholders Dropdown */}

Variables & Message Placeholders

Configure variables and message placeholders for your prompts.

{variablesCount > 0 ? (
Variables
Message Placeholders
) : (

No variables or message placeholders defined.

)}
); };