🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(playground): dont cut off selected tools/schemas (#12593)
Nimarfa3afb4bd89c
diff --git a/web/src/features/playground/page/components/ConfigurationDropdowns.tsx b/web/src/features/playground/page/components/ConfigurationDropdowns.tsxindex 09ff0c286c..3033e2aa9b 100644--- a/web/src/features/playground/page/components/ConfigurationDropdowns.tsx+++ b/web/src/features/playground/page/components/ConfigurationDropdowns.tsx@@ -18,7 +18,8 @@ import { Variables } from "./Variables";import { MessagePlaceholders } from "./MessagePlaceholders";export const ConfigurationDropdowns: React.FC = () => {- const { containerRef, isVeryCompact, isCompact } = usePlaygroundWindowSize();+ const { containerRef, width, isVeryCompact, isCompact } =+ usePlaygroundWindowSize();const {tools,structuredOutputSchema,@@ -29,6 +30,8 @@ export const ConfigurationDropdowns: React.FC = () => {const toolsCount = tools.length;const hasSchema = structuredOutputSchema ? 1 : 0;const variablesCount = promptVariables.length + messagePlaceholders.length;+ const toolsPopoverWidth =+ width > 0 ? Math.min(Math.max(width - 24, 0), 320) : undefined;// Helper function to get responsive content (text or icon)const getResponsiveContent = (@@ -71,7 +74,11 @@ export const ConfigurationDropdowns: React.FC = () => {<ChevronDown className="h-3 w-3" /></Button></PopoverTrigger>- <PopoverContent className="w-80 p-4" align="start">+ <PopoverContent+ className="w-80 max-w-[calc(100vw-1rem)] min-w-0 overflow-hidden p-4"+ align="start"+ style={toolsPopoverWidth ? { width: toolsPopoverWidth } : undefined}+ ><div className="mb-3"><h4 className="mb-1 text-sm font-medium">Tools</h4><p className="text-muted-foreground text-xs">diff --git a/web/src/features/playground/page/components/PlaygroundTools/index.tsx b/web/src/features/playground/page/components/PlaygroundTools/index.tsxindex 158fa84d57..b1e1645361 100644--- a/web/src/features/playground/page/components/PlaygroundTools/index.tsx+++ b/web/src/features/playground/page/components/PlaygroundTools/index.tsx@@ -229,7 +229,7 @@ export const PlaygroundTools = () => {};return (- <ScrollArea className="h-full">+ <ScrollArea className="max-h-[min(45vh,18rem)]">{tools.length === 0 ? (<div className="flex h-16 flex-col items-center justify-center p-4 text-center"><p className="text-muted-foreground text-xs">No tools attached.</p>@@ -253,10 +253,23 @@ export const PlaygroundTools = () => {: undefined}>- <div className="bg-background hover:bg-accent/50 cursor-pointer overflow-hidden rounded-md border p-2 transition-colors duration-200">- <div className="mb-1 flex items-center justify-between">- <div className="flex min-w-0 items-center gap-1">- <WrenchIcon className="text-muted-foreground h-4 w-4 shrink-0" />+ <div className="bg-background hover:bg-accent/50 relative cursor-pointer rounded-md border p-2 pr-10 transition-colors duration-200">+ <Button+ variant="ghost"+ size="sm"+ className="absolute top-2 right-3 h-6 w-6 p-0"+ aria-label={`Remove tool ${tool.name}`}+ onClick={(e) => {+ e.stopPropagation();+ e.preventDefault();+ handleRemoveTool(tool.id);+ }}+ >+ <MinusCircle className="h-4 w-4" />+ </Button>+ <div className="grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1">+ <WrenchIcon className="text-muted-foreground mt-0.5 h-4 w-4 shrink-0" />+ <div className="min-w-0"><h3className="truncate text-sm font-medium"title={tool.name}@@ -264,32 +277,18 @@ export const PlaygroundTools = () => {{tool.name}</h3>{!isToolSaved(tool) ? (- <span className="bg-muted text-muted-foreground shrink-0 rounded px-1 py-0.5 text-xs">+ <span className="bg-muted text-muted-foreground mt-1 inline-flex rounded px-1 py-0.5 text-xs">Unsaved</span>) : null}</div>- <div className="flex shrink-0 items-center gap-1">- <Button- variant="ghost"- size="sm"- className="h-6 w-6 p-0"- onClick={(e) => {- e.stopPropagation();- e.preventDefault();- handleRemoveTool(tool.id);- }}- >- <MinusCircle className="h-4 w-4" />- </Button>- </div>+ <p+ className="text-muted-foreground col-start-2 line-clamp-2 text-xs break-words"+ title={tool.description}+ >+ {tool.description}+ </p></div>- <p- className="text-muted-foreground line-clamp-2 text-xs break-all"- title={tool.description}- >- {tool.description}- </p></div></CreateOrEditLLMToolDialog>))}diff --git a/web/src/features/playground/page/components/StructuredOutputSchemaSection.tsx b/web/src/features/playground/page/components/StructuredOutputSchemaSection.tsxindex a30cf8b400..917039fbe9 100644--- a/web/src/features/playground/page/components/StructuredOutputSchemaSection.tsx+++ b/web/src/features/playground/page/components/StructuredOutputSchemaSection.tsx@@ -238,7 +238,7 @@ export const StructuredOutputSchemaSection = () => {};return (- <ScrollArea className="h-full">+ <ScrollArea className="max-h-[min(45vh,18rem)]">{!structuredOutputSchema ? (<div className="flex h-16 flex-col items-center justify-center p-4 text-center"><p className="text-muted-foreground text-xs">No schema provided.</p>@@ -264,10 +264,23 @@ export const StructuredOutputSchemaSection = () => {: undefined}>- <div className="bg-background hover:bg-accent/50 cursor-pointer overflow-hidden rounded-md border p-2 transition-colors duration-200">- <div className="mb-1 flex items-center justify-between">- <div className="flex min-w-0 items-center gap-1">- <BoxIcon className="text-muted-foreground h-4 w-4 shrink-0" />+ <div className="bg-background hover:bg-accent/50 relative cursor-pointer rounded-md border p-2 pr-10 transition-colors duration-200">+ <Button+ variant="ghost"+ size="sm"+ className="absolute top-2 right-3 h-6 w-6 p-0"+ aria-label={`Remove schema ${structuredOutputSchema.name}`}+ onClick={(e) => {+ e.stopPropagation();+ e.preventDefault();+ handleRemoveSchema();+ }}+ >+ <MinusCircle className="h-4 w-4" />+ </Button>+ <div className="grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-2 gap-y-1">+ <BoxIcon className="text-muted-foreground mt-0.5 h-4 w-4 shrink-0" />+ <div className="min-w-0"><h3className="truncate text-sm font-medium"title={structuredOutputSchema.name}@@ -275,32 +288,18 @@ export const StructuredOutputSchemaSection = () => {{structuredOutputSchema.name}</h3>{!isSchemaSaved(structuredOutputSchema) ? (- <span className="bg-muted text-muted-foreground shrink-0 rounded px-1 py-0.5 text-xs">+ <span className="bg-muted text-muted-foreground mt-1 inline-flex rounded px-1 py-0.5 text-xs">Unsaved</span>) : null}</div>- <div className="flex shrink-0 items-center gap-1">- <Button- variant="ghost"- size="sm"- className="h-6 w-6 p-0"- onClick={(e) => {- e.stopPropagation();- e.preventDefault();- handleRemoveSchema();- }}- >- <MinusCircle className="h-4 w-4" />- </Button>- </div>+ <p+ className="text-muted-foreground col-start-2 line-clamp-2 text-xs break-words"+ title={structuredOutputSchema.description}+ >+ {structuredOutputSchema.description}+ </p></div>- <p- className="text-muted-foreground line-clamp-2 text-xs break-all"- title={structuredOutputSchema.description}- >- {structuredOutputSchema.description}- </p></div></CreateOrEditLLMSchemaDialog></div>