Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: keep indentation in sent messages (#16495)

Nilaye2c7f2dcb013
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index c9a5a606d85..e291c9d5e3d 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -9049,7 +9049,7 @@ const UserMessage: FC = () => {
{hasContent ? (
<div
dir="auto"
- className="aui-user-message-content wrap-break-word w-fit max-w-[80%] rounded-xl bg-[#f5f5f5] px-4 py-2.5 text-[#0f1114] dark:text-foreground dark:bg-card">
+ className="aui-user-message-content wrap-break-word [&_p]:whitespace-pre-wrap! w-fit max-w-[80%] rounded-xl bg-[#f5f5f5] px-4 py-2.5 text-[#0f1114] dark:text-foreground dark:bg-card">
<MessagePrimitive.Parts />
</div>
) : null}
diff --git a/tests/studio/test_user_message_bubble_whitespace.py b/tests/studio/test_user_message_bubble_whitespace.py
new file mode 100644
index 00000000000..94e44f0e34f
--- /dev/null
+++ b/tests/studio/test_user_message_bubble_whitespace.py
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+from pathlib import Path
+
+
+REPO = Path(__file__).resolve().parents[2]
+THREAD = REPO / "studio/frontend/src/components/assistant-ui/thread.tsx"
+
+
+def _bubble_classes() -> set[str]:
+ source = THREAD.read_text(encoding = "utf-8")
+ start = source.index('className="aui-user-message-content ') + len('className="')
+ return set(source[start : source.index('"', start)].split())
+
+
+def test_user_message_bubble_keeps_indentation():
+ # assistant-ui sets `pre-line` inline on the text, so only an important rule can override it.
+ assert "[&_p]:whitespace-pre-wrap!" in _bubble_classes()