Skip to content

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

fix(playground): properly handle non-streaming on RunAll playground windows (#12636)

Thorsten Spieker907b6582cc30
diff --git a/web/src/features/playground/page/components/Messages.tsx b/web/src/features/playground/page/components/Messages.tsx
index 9cdd203ac8..256f9832f8 100644
--- a/web/src/features/playground/page/components/Messages.tsx
+++ b/web/src/features/playground/page/components/Messages.tsx
@@ -10,6 +10,7 @@ import { Switch } from "@/src/components/ui/switch";
import { Settings } from "lucide-react";
import useLocalStorage from "@/src/components/useLocalStorage";
import { env } from "@/src/env.mjs";
+import { STREAMING_PREF_KEY } from "@/src/features/playground/page/storage/keys";
import { GenerationOutput } from "./GenerationOutput";
import { ChatMessages } from "@/src/components/ChatMessages";
@@ -46,7 +47,7 @@ const SubmitButton = () => {
const defaultStreamingEnabled =
env.NEXT_PUBLIC_LANGFUSE_PLAYGROUND_STREAMING_ENABLED_DEFAULT === "true";
const [streamingEnabled, setStreamingEnabled] = useLocalStorage(
- "langfuse-playground-streaming",
+ STREAMING_PREF_KEY,
defaultStreamingEnabled,
);
diff --git a/web/src/features/playground/page/context/index.tsx b/web/src/features/playground/page/context/index.tsx
index eef3c4e7f9..b79b6f252e 100644
--- a/web/src/features/playground/page/context/index.tsx
+++ b/web/src/features/playground/page/context/index.tsx
@@ -49,6 +49,7 @@ import {
} from "@/src/features/playground/page/hooks/useWindowCoordination";
import { useSyncMessageSearchMessages } from "@/src/components/ChatMessages/MessageSearch";
import { getFinalModelParams } from "@/src/utils/getFinalModelParams";
+import { STREAMING_PREF_KEY } from "@/src/features/playground/page/storage/keys";
type PlaygroundContextType = {
windowId: string;
@@ -589,8 +590,19 @@ export const PlaygroundProvider: React.FC<PlaygroundProviderProps> = ({
});
if (hasAnyContent) {
- // Window has content - let it execute and show any validation errors
- handleSubmit(true).catch((err) => console.error(err));
+ // Read streaming preference from localStorage (same key as SubmitButton in Messages.tsx)
+ const defaultStreaming =
+ env.NEXT_PUBLIC_LANGFUSE_PLAYGROUND_STREAMING_ENABLED_DEFAULT ===
+ "true";
+ let streaming = defaultStreaming;
+ try {
+ const raw = localStorage.getItem(STREAMING_PREF_KEY);
+ if (raw !== null) streaming = JSON.parse(raw);
+ } catch {
+ // malformed localStorage value — fall back to default
+ }
+
+ handleSubmit(streaming).catch((err) => console.error(err));
}
// If no content, skip silently
}
diff --git a/web/src/features/playground/page/storage/keys.ts b/web/src/features/playground/page/storage/keys.ts
index dc7bcb0f5f..4485f39e9e 100644
--- a/web/src/features/playground/page/storage/keys.ts
+++ b/web/src/features/playground/page/storage/keys.ts
@@ -1,6 +1,7 @@
import { MULTI_WINDOW_CONFIG } from "../types";
export const WINDOW_IDS_KEY = "playgroundWindowIds";
+export const STREAMING_PREF_KEY = "langfuse-playground-streaming";
const getPrefixedKey = (prefix: string, windowId: string) => {
const effectiveWindowId = windowId || MULTI_WINDOW_CONFIG.DEFAULT_WINDOW_ID;