Skip to content

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

fix(playground): scroll variables if many are present (#7946)

Nimar5bb1b6de54b3
diff --git a/web/src/features/playground/page/components/MessagePlaceholders.tsx b/web/src/features/playground/page/components/MessagePlaceholders.tsx
index 87dbe664f8..30c58249df 100644
--- a/web/src/features/playground/page/components/MessagePlaceholders.tsx
+++ b/web/src/features/playground/page/components/MessagePlaceholders.tsx
@@ -9,33 +9,37 @@ export const MessagePlaceholders = () => {
return (
<div className="flex h-full flex-col">
<p className="font-semibold">Message Placeholders</p>
- {messagePlaceholders.length === 0 ? (
- <div className="mt-4 text-xs">
- <p className="mb-2">No message placeholders defined.</p>
- <p>
- Placeholders can be used to e.g. inject message histories into
- prompts.
- </p>
- </div>
- ) : (
- <div className="h-full overflow-auto">
- {messagePlaceholders
- .slice()
- .sort((a, b) => {
- if (a.isUsed && !b.isUsed) return -1;
- if (!a.isUsed && b.isUsed) return 1;
- return a.name.localeCompare(b.name);
- })
- .map((placeholder, index) => (
- <div key={placeholder.name}>
- <MessagePlaceholderComponent messagePlaceholder={placeholder} />
- {index !== messagePlaceholders.length - 1 && (
- <Divider className="my-2 text-muted-foreground" />
- )}
- </div>
- ))}
- </div>
- )}
+ <div className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden">
+ {messagePlaceholders.length === 0 ? (
+ <div className="mt-4 text-xs">
+ <p className="mb-2">No message placeholders defined.</p>
+ <p>
+ Placeholders can be used to e.g. inject message histories into
+ prompts.
+ </p>
+ </div>
+ ) : (
+ <>
+ {messagePlaceholders
+ .slice()
+ .sort((a, b) => {
+ if (a.isUsed && !b.isUsed) return -1;
+ if (!a.isUsed && b.isUsed) return 1;
+ return a.name.localeCompare(b.name);
+ })
+ .map((placeholder, index) => (
+ <div key={placeholder.name}>
+ <MessagePlaceholderComponent
+ messagePlaceholder={placeholder}
+ />
+ {index !== messagePlaceholders.length - 1 && (
+ <Divider className="my-2 text-muted-foreground" />
+ )}
+ </div>
+ ))}
+ </>
+ )}
+ </div>
</div>
);
};
diff --git a/web/src/features/playground/page/components/Variables.tsx b/web/src/features/playground/page/components/Variables.tsx
index e2f3de4374..33628df528 100644
--- a/web/src/features/playground/page/components/Variables.tsx
+++ b/web/src/features/playground/page/components/Variables.tsx
@@ -15,27 +15,22 @@ export const Variables = () => {
</div>
);
const renderVariables = () => (
- <div className="h-full overflow-auto">
+ <div className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden">
{promptVariables
+ .slice()
.sort((a, b) => {
if (a.isUsed && !b.isUsed) return -1;
if (!a.isUsed && b.isUsed) return 1;
-
return a.name.localeCompare(b.name);
})
- .map((promptVariable, index) => {
- return (
- <>
- <PromptVariableComponent
- promptVariable={promptVariable}
- key={promptVariable.name}
- />
- {index !== promptVariables.length - 1 ? (
- <Divider className="my-2 text-muted-foreground" />
- ) : null}
- </>
- );
- })}
+ .map((promptVariable, index) => (
+ <div key={promptVariable.name}>
+ <PromptVariableComponent promptVariable={promptVariable} />
+ {index !== promptVariables.length - 1 && (
+ <Divider className="my-2 text-muted-foreground" />
+ )}
+ </div>
+ ))}
</div>
);
diff --git a/web/src/features/playground/page/playground.tsx b/web/src/features/playground/page/playground.tsx
index 4f8c202871..c376265a09 100644
--- a/web/src/features/playground/page/playground.tsx
+++ b/web/src/features/playground/page/playground.tsx
@@ -15,7 +15,7 @@ export default function Playground() {
<Messages {...playgroundContext} />
</div>
<div className="max-h-full min-h-0 basis-1/4 pr-2">
- <div className="flex h-full flex-col gap-4 overflow-auto">
+ <div className="flex h-full flex-col gap-4">
<div className="mb-4 flex-shrink-0 overflow-y-auto">
<ModelParameters {...playgroundContext} />
</div>
@@ -25,9 +25,11 @@ export default function Playground() {
<div className="mb-4 flex-shrink-0">
<StructuredOutputSchemaSection />
</div>
- <div className="flex-grow overflow-y-auto">
- <div className="space-y-6">
+ <div className="flex min-h-0 flex-1 flex-col gap-6">
+ <div className="min-h-0 flex-1">
<Variables />
+ </div>
+ <div className="min-h-0 flex-1">
<MessagePlaceholders />
</div>
</div>