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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: inline message actions, matching response editor (#13615)
Michael Han274b534958e7
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex 6d792fc8261..39606d72d04 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -8261,29 +8261,28 @@ const AssistantMessage: FC = () => {><div className="aui-assistant-message-content wrap-break-word min-w-0 text-[#0d0d0d] dark:text-foreground leading-relaxed">{isEditing ? (- <div className="flex flex-col gap-2 w-full">- {/* Borderless textarea, so auto-grow fits with no scrollbar; the wrapper keeps corners round. */}- <div className="overflow-hidden rounded-xl border-[0.5px] border-border bg-muted focus-within:border-ring">- <textarea- ref={textareaRef}- defaultValue={extractTaggedText(messageContent ?? [])}- className="block w-full p-3 bg-transparent text-foreground outline-none overflow-y-auto resize-none font-mono text-sm max-h-[70dvh]"- autoFocus- onInput={adjustHeight}- onKeyDown={(e) => {- e.stopPropagation();- if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {- handleSave();- }- if (e.key === 'Escape') {- setEditingId(null); // UX: Close editor on Escape- }- }}- />- </div>- <div className="flex justify-end gap-2">- <Button size="sm" variant="ghost" onClick={() => setEditingId(null)} className="h-8 text-xs">Cancel</Button>- <Button size="sm" onClick={handleSave} className="h-8 text-xs">Save</Button>+ // Same surface as a prompt's EditComposer, at the reply's full width. Bottom gap is padding:+ // index.css zeroes the margin-bottom of the reply's last descendants.+ <div className="aui-assistant-edit-root flex w-full flex-col overflow-hidden rounded-2xl bg-muted pb-3">+ <textarea+ ref={textareaRef}+ defaultValue={extractTaggedText(messageContent ?? [])}+ className="block min-h-14 w-full max-h-[70dvh] resize-none overflow-y-auto bg-transparent p-4 text-foreground text-sm font-[450] outline-none"+ autoFocus+ onInput={adjustHeight}+ onKeyDown={(e) => {+ e.stopPropagation();+ if (e.key === 'Enter' && (e.ctrlKey || e.metaKey)) {+ handleSave();+ }+ if (e.key === 'Escape') {+ setEditingId(null); // UX: Close editor on Escape+ }+ }}+ />+ <div className="mx-3 flex items-center gap-2 self-end">+ <Button type="button" size="sm" variant="ghost" onClick={() => setEditingId(null)}>Cancel</Button>+ <Button type="button" size="sm" onClick={handleSave}>Save</Button></div></div>) : (@@ -8316,7 +8315,7 @@ const AssistantMessage: FC = () => {)}</div>- <div className="aui-assistant-message-footer mt-1.5 -ml-[var(--icon-btn-inset)] flex min-h-8">+ <div className="aui-assistant-message-footer mt-1.5 -ml-[var(--icon-btn-inset)] flex min-h-8 min-w-0 flex-wrap items-center gap-y-1"><BranchPicker className="mr-0.5" /><AssistantActionBar /></div>@@ -8629,41 +8628,26 @@ function useDeleteMessage() {return { handleDelete, isRunning, hidden: Boolean(researchRunId || ownsResearchMessage) };}-// The More menu's Delete, last and in red.-const DeleteMessageMenuItem: FC = () => {+const DeleteMessageButton: FC = () => {const { handleDelete, isRunning, hidden } = useDeleteMessage();if (hidden) {return null;}return (- <ActionBarMorePrimitive.Item+ <TooltipIconButton+ tooltip="Delete"disabled={isRunning}- onSelect={() => void handleDelete()}- className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-[12px] px-3 py-2 text-sm text-destructive outline-none hover:bg-destructive/10 focus:bg-destructive/10 data-[disabled]:pointer-events-none data-[disabled]:opacity-50"+ onClick={() => void handleDelete()}+ className="hover:!text-destructive"><HugeiconsIcon icon={Delete02Icon} strokeWidth={1.75} className="size-icon" />- Delete- </ActionBarMorePrimitive.Item>+ </TooltipIconButton>);};const MORE_MENU_CONTENT_CLASS ="aui-action-bar-more-content dropdown-surface z-50 min-w-32 max-h-(--radix-dropdown-menu-content-available-height) flex flex-col overflow-hidden rounded-[21px] bg-popover px-[calc(9px*var(--ui-space-scale,1))] py-2 text-popover-foreground shadow-[0_2px_8px_-2px_rgba(0,0,0,0.16)]";-const ForkMessageMenuItem: FC = () => {- const { forkMessage, forkDisabled } = useForkMessageAction();- return (- <ActionBarMorePrimitive.Item- disabled={forkDisabled}- onSelect={() => void forkMessage()}- className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-[12px] px-3 py-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"- >- <HugeiconsIcon icon={ForkIcon} strokeWidth={1.75} className="size-icon" />- Fork in new chat- </ActionBarMorePrimitive.Item>- );-};-// Loaded on first use: the dialog is not part of the first screen.const LazyRewindDialog = lazy(() =>import("@/components/assistant-ui/rewind-dialog").then((module) => ({@@ -8685,54 +8669,24 @@ const RewindDialogMount: FC = () => {) : null;};-const RewindMessageMenuItem: FC = () => {+const RewindMessageButton: FC = () => {const aui = useAui();const t = useT();const messageId = useAuiState(({ message }) => message.id);const isRunning = useAuiState(({ thread }) => thread.isRunning);return (- <ActionBarMorePrimitive.Item+ <TooltipIconButton+ tooltip={t("rewind.title")}disabled={isRunning}- onSelect={() =>+ onClick={() =>useRewindDialogStore.getState().openRewind({threadKey: aui.threadListItem().getState().id,messageId,})}- className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-[12px] px-3 py-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"><HugeiconsIcon icon={UndoIcon} strokeWidth={1.75} className="size-icon" />- {t("rewind.menuItem")}- </ActionBarMorePrimitive.Item>- );-};--// A prompt's More menu: Fork, Rewind, then Delete.-const UserMoreMenu: FC = () => {- const triggerRef = useRef<HTMLButtonElement>(null);- const collisionPadding = useWindowChromeCollisionPadding(undefined);- return (- <ActionBarMorePrimitive.Root modal={false}>- <ActionBarMorePrimitive.Trigger asChild={true}>- <TooltipIconButton ref={triggerRef} tooltip="More" className="data-[state=open]:bg-accent">- <MoreHorizontalIcon strokeWidth={1.75} className="size-icon" />- </TooltipIconButton>- </ActionBarMorePrimitive.Trigger>- <ActionBarMorePrimitive.Content- side="bottom"- align="end"- collisionPadding={collisionPadding}- onCloseAutoFocus={(e) => e.preventDefault()}- className={MORE_MENU_CONTENT_CLASS}- >- <div className="min-h-0 flex-1 overflow-x-hidden overflow-y-auto">- <MenuDismissGuard triggerRef={triggerRef} />- <ForkMessageMenuItem />- <RewindMessageMenuItem />- <DeleteMessageMenuItem />- </div>- </ActionBarMorePrimitive.Content>- </ActionBarMorePrimitive.Root>+ </TooltipIconButton>);};@@ -8879,7 +8833,7 @@ const AssistantActionBar: FC = () => {const activeProjectId = useChatRuntimeStore((s) => s.activeProjectId);const [detailsOpen, setDetailsOpen] = useState(false);const ttsEnabled = useVoiceSettingsStore((s) => s.ttsEnabled);- // Off by default: Edit response lives in the More menu.+ // On by default; off moves Edit response into the More menu.const inlineEdit = useChatPreferencesStore((s) => s.showInlineEditResponse);// hideWhenRunning is thread-level, so a new run would hide this bar and its// only Stop reading control while read-aloud keeps playing; keep it shown.@@ -8904,12 +8858,17 @@ const AssistantActionBar: FC = () => {// remounts a bar when focus enters that message, so tabbing brings back what hovering// brings back and the controls return to the accessibility tree with it.autohide={speaking ? "never" : "not-last"}- className="aui-assistant-action-bar-root col-start-3 row-start-2 flex items-center gap-1 text-chat-icon-fg [&_button:not([data-slot=message-timing-trigger])]:size-8 [&_button]:!rounded-full [&_button:hover]:bg-chat-icon-bg-hover [&_button:hover]:text-chat-icon-fg-hover"+ className="aui-assistant-action-bar-root col-start-3 row-start-2 flex min-w-0 flex-wrap items-center gap-1 text-chat-icon-fg [&_button:not([data-slot=message-timing-trigger])]:size-8 [&_button]:!rounded-full [&_button:hover]:bg-chat-icon-bg-hover [&_button:hover]:text-chat-icon-fg-hover"><CopyButton />{inlineEdit && <EditAssistantMessageButton />}- <ForkCountBadge />- <ForkMessageButton />+ {!researchRunId && !researchActive && (+ <ActionBarPrimitive.Reload asChild={true}>+ <TooltipIconButton tooltip="Refresh">+ <RefreshGlyph strokeWidth={1.75} className="size-icon" />+ </TooltipIconButton>+ </ActionBarPrimitive.Reload>+ )}{ttsEnabled && (<MessagePrimitive.If speaking={false}><ActionBarPrimitive.Speak asChild={true}>@@ -8932,13 +8891,9 @@ const AssistantActionBar: FC = () => {</TooltipIconButton></ActionBarPrimitive.StopSpeaking></MessagePrimitive.If>- {!researchRunId && !researchActive && (- <ActionBarPrimitive.Reload asChild={true}>- <TooltipIconButton tooltip="Refresh">- <RefreshGlyph strokeWidth={1.75} className="size-icon" />- </TooltipIconButton>- </ActionBarPrimitive.Reload>- )}+ <ForkCountBadge />+ <ForkMessageButton />+ <DeleteMessageButton />{/* Non-modal: a modal Radix menu writes `pointer-events: none` on <body>, andthat is an INHERITED property, so every open invalidates style for the wholedocument. On a long thread that recalc is the bulk of the open+close cost. */}@@ -9033,7 +8988,6 @@ const AssistantActionBar: FC = () => {Save to project sources</ActionBarMorePrimitive.Item>)}- <DeleteMessageMenuItem /></div></ActionBarMorePrimitive.Content></ActionBarMorePrimitive.Root>@@ -9097,7 +9051,7 @@ const UserMessage: FC = () => {<ForkChatShortcut /></MessagePrimitive.If>{/* Reverse traversal reaches a trailing stop before the root. Focusing it- mounts the autohidden controls, so the next Shift+Tab enters More+ mounts the autohidden controls, so the next Shift+Tab enters its controlsinstead of skipping the action bar and leaving the message. */}<spanclassName="aui-user-reveal-sentinel"@@ -9125,8 +9079,10 @@ const UserActionBar: FC = () => {</TooltipIconButton></ActionBarPrimitive.Edit>)}+ <RewindMessageButton /><ForkCountBadge />- <UserMoreMenu />+ <ForkMessageButton />+ <DeleteMessageButton /></UserMessageActionBar>);};diff --git a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts b/studio/frontend/src/features/chat/stores/chat-preferences-store.tsindex b676aff35c9..b3241081af8 100644--- a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts+++ b/studio/frontend/src/features/chat/stores/chat-preferences-store.ts@@ -94,7 +94,7 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(set({ showModelDisclaimer }),showResponseModel: false,setShowResponseModel: (showResponseModel) => set({ showResponseModel }),- showInlineEditResponse: false,+ showInlineEditResponse: true,setShowInlineEditResponse: (showInlineEditResponse) =>set({ showInlineEditResponse }),thinkingVisibility: DEFAULT_THINKING_VISIBILITY,@@ -122,6 +122,12 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(}),{name: "unsloth_chat_preferences",+ // v0 stored the old off default for everyone, so it cannot tell a choice from the default.+ version: 1,+ migrate: (persisted, version) =>+ version < 1 && persisted && typeof persisted === "object"+ ? { ...persisted, showInlineEditResponse: true }+ : persisted,merge: (persisted, current) => {const saved = persisted as Partial<ChatPreferencesState> | undefined;// Records written before the three-state settings carry the two booleans instead.@@ -138,7 +144,7 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(alwaysDeleteChatFiles: saved?.alwaysDeleteChatFiles ?? false,showModelDisclaimer: saved?.showModelDisclaimer ?? false,showResponseModel: saved?.showResponseModel ?? false,- showInlineEditResponse: saved?.showInlineEditResponse ?? false,+ showInlineEditResponse: saved?.showInlineEditResponse ?? true,thinkingVisibility: migrateVisibility(saved?.thinkingVisibility,legacy?.collapseThinkingByDefault,diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex 1d0d7bfd7bf..054ce29725a 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -554,7 +554,6 @@ export const ar = {queueingHintShared: "يبقى الطابور كما هو.",},rewind: {- menuItem: "إرجاع…",title: "إرجاع",pickDescription: "اختر رسالة للرجوع إليها.",pickEmpty: "لا توجد رسائل للرجوع إليها بعد.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 90f1ee89d01..f291e48ba93 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -554,7 +554,6 @@ export const de = {queueingHintShared: "Die Warteschlange bleibt erhalten.",},rewind: {- menuItem: "Zurückspulen…",title: "Zurückspulen",pickDescription: "Wähle eine Nachricht, zu der zurückgespult werden soll.",pickEmpty: "Es gibt noch keine Nachrichten zum Zurückspulen.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 86c4aa22d8e..6943a3c4204 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -597,7 +597,6 @@ export const en = {},// /rewind and the prompt More menu's Rewind item.rewind: {- menuItem: "Rewind…",title: "Rewind",pickDescription: "Choose a message to rewind to.",pickEmpty: "There are no messages to rewind to yet.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 94171dbf11e..8ec2311438b 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -554,7 +554,6 @@ export const es = {queueingHintShared: "La cola se conserva.",},rewind: {- menuItem: "Rebobinar…",title: "Rebobinar",pickDescription: "Elige un mensaje al que volver.",pickEmpty: "Todavía no hay mensajes a los que volver.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex e2497591384..75c408ae609 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -554,7 +554,6 @@ export const fr = {queueingHintShared: "La file d’attente est conservée.",},rewind: {- menuItem: "Revenir en arrière…",title: "Revenir en arrière",pickDescription: "Choisissez un message auquel revenir.",pickEmpty: "Il n'y a pas encore de message auquel revenir.",diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.tsindex 48ab8dc76cd..60c61f0980e 100644--- a/studio/frontend/src/i18n/locales/he.ts+++ b/studio/frontend/src/i18n/locales/he.ts@@ -630,7 +630,6 @@ export const he = {queueingHintShared: "התור נשמר.",},rewind: {- menuItem: "החזרה לאחור…",title: "החזרה לאחור",pickDescription: "בחרו הודעה לחזור אליה.",pickEmpty: "עדיין אין הודעות לחזור אליהן.",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 03f1a8d42ca..28b760fe2f7 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -554,7 +554,6 @@ export const hi = {queueingHintShared: "कतार बनी रहती है।",},rewind: {- menuItem: "रिवाइंड करें…",title: "रिवाइंड करें",pickDescription: "वह संदेश चुनें जिस पर वापस जाना है।",pickEmpty: "अभी वापस जाने के लिए कोई संदेश नहीं है।",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 2074631f921..fde773c0fad 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -3114,7 +3114,6 @@ export const it = {},},rewind: {- menuItem: "Riavvolgi…",title: "Riavvolgi",pickDescription: "Scegli un messaggio a cui tornare.",pickEmpty: "Non ci sono ancora messaggi a cui tornare.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 7831ca21022..4a84b16e713 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -555,7 +555,6 @@ export const ja = {queueingHintShared: "キューは保持されます。",},rewind: {- menuItem: "巻き戻す…",title: "巻き戻す",pickDescription: "巻き戻す先のメッセージを選択してください。",pickEmpty: "巻き戻せるメッセージはまだありません。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex b13c04cc37c..c43eb0c7a6f 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -554,7 +554,6 @@ export const ko = {queueingHintShared: "대기열은 유지됩니다.",},rewind: {- menuItem: "되감기…",title: "되감기",pickDescription: "되돌아갈 메시지를 선택하세요.",pickEmpty: "아직 되돌아갈 메시지가 없습니다.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex fea5524ade7..204c70278fe 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -554,7 +554,6 @@ export const ptBR = {queueingHintShared: "A fila é mantida.",},rewind: {- menuItem: "Voltar no tempo…",title: "Voltar no tempo",pickDescription: "Escolha uma mensagem para a qual voltar.",pickEmpty: "Ainda não há mensagens para as quais voltar.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex aff6d718c9c..07284b6f6ca 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -554,7 +554,6 @@ export const ru = {queueingHintShared: "Очередь сохраняется.",},rewind: {- menuItem: "Откатить…",title: "Откатить",pickDescription: "Выберите сообщение, к которому нужно вернуться.",pickEmpty: "Пока нет сообщений, к которым можно вернуться.",diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.tsindex c0bfd1c4b95..c3a30589a4d 100644--- a/studio/frontend/src/i18n/locales/sv.ts+++ b/studio/frontend/src/i18n/locales/sv.ts@@ -645,7 +645,6 @@ export const sv = {queueingHintShared: "Kön behålls.",},rewind: {- menuItem: "Spola tillbaka…",title: "Spola tillbaka",pickDescription: "Välj ett meddelande att spola tillbaka till.",pickEmpty: "Det finns inga meddelanden att spola tillbaka till än.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex c16cb6fd19e..a2e6aeff663 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -554,7 +554,6 @@ export const zhCN = {queueingHintShared: "队列会保留。",},rewind: {- menuItem: "回退…",title: "回退",pickDescription: "选择要回退到的消息。",pickEmpty: "还没有可以回退到的消息。",diff --git a/studio/frontend/tests/chat-rewind.test.ts b/studio/frontend/tests/chat-rewind.test.tsindex cbcc0b1fc02..be365921ed3 100644--- a/studio/frontend/tests/chat-rewind.test.ts+++ b/studio/frontend/tests/chat-rewind.test.ts@@ -96,5 +96,5 @@ test("the composer opens the rewind picker instead of sending /rewind", () => {assert.ok(intercept > 0);assert.ok(intercept < submit.indexOf("if (disabled || shouldBlockSend())"));assert.ok(intercept < submit.indexOf("interceptSend(event)"));- assert.match(thread, /<RewindMessageMenuItem \/>\s*<DeleteMessageMenuItem \/>/);+ assert.match(thread, /<RewindMessageButton \/>\s*<ForkCountBadge \/>\s*<ForkMessageButton \/>/);});diff --git a/studio/frontend/tests/chat-thought-continuation.test.ts b/studio/frontend/tests/chat-thought-continuation.test.tsindex 9ac3a5a600a..b381dcc80f2 100644--- a/studio/frontend/tests/chat-thought-continuation.test.ts+++ b/studio/frontend/tests/chat-thought-continuation.test.ts@@ -300,13 +300,11 @@ test("Continue response leads the More menu and yields to the Resume bar", () =>thread,/<ContinueResponseMenuItem \/>\n\s*\{!inlineEdit && <EditAssistantMessageMenuItem \/>\}/,);- // Bar order: Edit, Fork, Read aloud (or Stop reading), Refresh.+ // Bar order: Edit, Refresh, Read aloud (or Stop reading), Fork, Delete.assert.match(thread,- /\{inlineEdit && <EditAssistantMessageButton \/>\}\n\s*<ForkCountBadge \/>\n\s*<ForkMessageButton \/>\n\s*\{ttsEnabled && \(\n\s*<MessagePrimitive\.If speaking=\{false\}>\n\s*<ActionBarPrimitive\.Speak[\s\S]*?<\/ActionBarPrimitive\.StopSpeaking>\n\s*<\/MessagePrimitive\.If>\n\s*\{!researchRunId && !researchActive && \(\n\s*<ActionBarPrimitive\.Reload/,+ /\{inlineEdit && <EditAssistantMessageButton \/>\}\n\s*\{!researchRunId && !researchActive && \(\n\s*<ActionBarPrimitive\.Reload[\s\S]*?<\/ActionBarPrimitive\.Reload>\n\s*\)\}\n\s*\{ttsEnabled && \(\n\s*<MessagePrimitive\.If speaking=\{false\}>\n\s*<ActionBarPrimitive\.Speak[\s\S]*?<\/ActionBarPrimitive\.StopSpeaking>\n\s*<\/MessagePrimitive\.If>\n\s*<ForkCountBadge \/>\n\s*<ForkMessageButton \/>\n\s*<DeleteMessageButton \/>/,);- // Delete is the More menu's last item, not a bar button.- assert.match(thread, /<DeleteMessageMenuItem \/>\n\s*<\/div>\n\s*<\/ActionBarMorePrimitive\.Content>/);// A stopped reply already offers Resume; a reply being edited continues from the saved text;// a cited reply would lose its sources in the sibling.assert.match(diff --git a/studio/frontend/tests/message-action-bar-defaults.test.ts b/studio/frontend/tests/message-action-bar-defaults.test.tsnew file mode 100644index 00000000000..3bc16294beb--- /dev/null+++ b/studio/frontend/tests/message-action-bar-defaults.test.ts@@ -0,0 +1,75 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import {+ installLocalStorageFake,+ readSrc,+ registerBundlerResolver,+} from "./helpers/kit.ts";++registerBundlerResolver();+const { store } = installLocalStorageFake();+const { useChatPreferencesStore } = await import(+ "../src/features/chat/stores/chat-preferences-store.ts"+);++const KEY = "unsloth_chat_preferences";+const THREAD = readSrc("components/assistant-ui/thread.tsx");++function component(name: string): string {+ const start = THREAD.indexOf(`const ${name}: FC = () => {`);+ assert.notEqual(start, -1, `${name} is gone; this test needs rewriting`);+ return THREAD.slice(start, THREAD.indexOf("\n};", start));+}++test("Edit response is inline by default", () => {+ assert.equal(+ useChatPreferencesStore.getInitialState().showInlineEditResponse,+ true,+ );+});++test("a pre-version record carrying the old off default is moved to on", async () => {+ store.set(+ KEY,+ JSON.stringify({ state: { showInlineEditResponse: false }, version: 0 }),+ );+ await useChatPreferencesStore.persist.rehydrate();+ assert.equal(useChatPreferencesStore.getState().showInlineEditResponse, true);+});++test("an off choice saved after the migration is kept", async () => {+ store.set(+ KEY,+ JSON.stringify({ state: { showInlineEditResponse: false }, version: 1 }),+ );+ await useChatPreferencesStore.persist.rehydrate();+ assert.equal(+ useChatPreferencesStore.getState().showInlineEditResponse,+ false,+ );+});++test("a reply's bar ends in Delete then More; its More menu has no Delete", () => {+ const bar = component("AssistantActionBar");+ const menuAt = bar.indexOf("<ActionBarMorePrimitive.Root");+ assert.ok(bar.slice(0, menuAt).includes("<DeleteMessageButton />"));+ assert.ok(!bar.slice(menuAt).includes("Delete"));+});++test("a prompt's bar is Copy, Edit, Rewind, Fork and Delete, with no More menu", () => {+ const bar = component("UserActionBar");+ assert.match(+ bar,+ /<RewindMessageButton \/>\s*<ForkCountBadge \/>\s*<ForkMessageButton \/>\s*<DeleteMessageButton \/>\s*<\/UserMessageActionBar>/,+ );+ assert.ok(!THREAD.includes("UserMoreMenu"));+});++test("the reply footer and bar wrap, so the wider bar never scrolls a narrow thread", () => {+ assert.match(THREAD, /"aui-assistant-message-footer [^"]*\bflex-wrap\b/);+ assert.match(THREAD, /"aui-assistant-action-bar-root [^"]*\bflex-wrap\b/);+});