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: add a multiline send shortcut and spell out what each one does (#11927)
Michael Han967b8ce9718f
diff --git a/studio/frontend/smoke-composer-settings-main.tsx b/studio/frontend/smoke-composer-settings-main.tsxindex ca2fb3e57e4..6a4c5a977ec 100644--- a/studio/frontend/smoke-composer-settings-main.tsx+++ b/studio/frontend/smoke-composer-settings-main.tsx@@ -42,6 +42,7 @@ function Draft() {const intent = composerSubmitIntent({ ...e, isComposing: e.nativeEvent.isComposing },prefs.sendShortcut,+ text,);if (!intent) return;e.preventDefault();diff --git a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsxindex 6fdc14cbce1..e6d247f302a 100644--- a/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx+++ b/studio/frontend/src/components/assistant-ui/prompt-queue-list.tsx@@ -258,6 +258,7 @@ export function PromptQueueList({keyCode: event.nativeEvent.keyCode,},sendShortcut,+ event.currentTarget.value,)) {event.preventDefault();diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex f6b7208963d..a2738a39c67 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -58,6 +58,7 @@ import {composerSubmitIntent,composerFollowUpBehavior,composerShortcutLabels,+ effectiveSendShortcut,followUpSubmitIntent,steeringInsertionIndex,cancelPreStreamRunForThreadIds,@@ -5668,7 +5669,7 @@ function useImeComposerInputHandlers({setCompositionState(false);}if (submitOnEnter && !skipEnterRef?.current) {- const intent = composerSubmitIntent(e, sendShortcut);+ const intent = composerSubmitIntent(e, sendShortcut, e.currentTarget?.value);if (intent) {e.preventDefault();if (onSubmitKey) onSubmitKey(e, intent);@@ -6906,7 +6907,13 @@ const ComposerRightControls: FC<{const t = useT();const followUpBehavior = useChatPreferencesStore((s) => s.followUpBehavior);const sendShortcut = useChatPreferencesStore((s) => s.sendShortcut);- const shortcutLabels = composerShortcutLabels(sendShortcut, isMacPlatform());+ // A boolean, so typing re-renders this only when a line break comes or goes.+ const multiline = useAuiState(({ composer }) => composer.text.includes("\n"));+ const shortcutLabels = composerShortcutLabels(+ sendShortcut,+ isMacPlatform(),+ multiline ? "\n" : "",+ );const followUpLabel = t(followUpBehavior === "queue"? "promptQueue.queueButton"@@ -8629,6 +8636,7 @@ const UserActionBar: FC = () => {const EditComposer: FC = () => {const aui = useAui();const sendShortcut = useChatPreferencesStore((s) => s.sendShortcut);+ const editMultiline = useAuiState(({ composer }) => composer.text.includes("\n"));const { inputProps, isComposingRef } = useImeComposerInputHandlers();const resendAfterCancelRef = useRef(false);const researchActive = useThreadResearchActive();@@ -8665,7 +8673,11 @@ const EditComposer: FC = () => {}}><ComposerPrimitive.Input- submitMode={sendShortcut === "mod-enter" ? "ctrlEnter" : "enter"}+ submitMode={+ effectiveSendShortcut(sendShortcut, editMultiline ? "\n" : "") === "mod-enter"+ ? "ctrlEnter"+ : "enter"+ }className="aui-edit-composer-input min-h-14 w-full resize-none bg-transparent p-4 text-foreground text-sm font-[450] outline-none"autoFocus={true}// See main composer above for the dir="auto" rationale.diff --git a/studio/frontend/src/features/chat/index.ts b/studio/frontend/src/features/chat/index.tsindex 8351afc646f..a843ab06770 100644--- a/studio/frontend/src/features/chat/index.ts+++ b/studio/frontend/src/features/chat/index.ts@@ -472,6 +472,7 @@ export {composerSubmitIntent,composerFollowUpBehavior,composerShortcutLabels,+ effectiveSendShortcut,followUpSubmitIntent,steeringInsertionIndex,type ComposerSendShortcut,diff --git a/studio/frontend/src/features/chat/shared-composer.tsx b/studio/frontend/src/features/chat/shared-composer.tsxindex 708fd3e9eb0..fea9295f214 100644--- a/studio/frontend/src/features/chat/shared-composer.tsx+++ b/studio/frontend/src/features/chat/shared-composer.tsx@@ -573,7 +573,6 @@ export function SharedComposer({}): ReactElement {const t = useT();const sendShortcut = useChatPreferencesStore((s) => s.sendShortcut);- const shortcutLabels = composerShortcutLabels(sendShortcut, isMacPlatform());const navigate = useNavigate();// Exit compare: parent's restore handler, or fresh chat if opened by URL.const handleExitCompare = useCallback(() => {@@ -584,6 +583,7 @@ export function SharedComposer({navigate({ to: "/chat" });}, [navigate, onExitCompare]);const [text, setText] = useState("");+ const shortcutLabels = composerShortcutLabels(sendShortcut, isMacPlatform(), text);const [running, setRunning] = useState(false);const [comparing, setComparing] = useState(false);const [pendingImages, setPendingImages] = useState<PendingImage[]>([]);@@ -1981,7 +1981,7 @@ export function SharedComposer({}setCompositionState(false);}- if (composerSubmitIntent(e, sendShortcut)) {+ if (composerSubmitIntent(e, sendShortcut, text)) {e.preventDefault();if (!busy && !isDictating) {send();diff --git a/studio/frontend/src/features/chat/utils/composer-preferences.ts b/studio/frontend/src/features/chat/utils/composer-preferences.tsindex e9165079685..75508f71f2e 100644--- a/studio/frontend/src/features/chat/utils/composer-preferences.ts+++ b/studio/frontend/src/features/chat/utils/composer-preferences.ts@@ -1,7 +1,8 @@// SPDX-License-Identifier: AGPL-3.0-only// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-export type ComposerSendShortcut = "enter" | "mod-enter";+// "mod-enter-multiline" is Enter until the draft has a line break, then "mod-enter".+export type ComposerSendShortcut = "enter" | "mod-enter-multiline" | "mod-enter";export type ComposerFollowUpBehavior = "queue" | "steer";export type ComposerSubmitIntent = "default" | "opposite";@@ -16,11 +17,22 @@ export type ComposerKeyEvent = {keyCode?: number;};+/** The rule in force for `draft`. */+export function effectiveSendShortcut(+ shortcut: ComposerSendShortcut,+ draft?: string | null,+): "enter" | "mod-enter" {+ if (shortcut !== "mod-enter-multiline") return shortcut;+ return draft?.includes("\n") ? "mod-enter" : "enter";+}+/** Only called for the focused composer, after its IME and mention-picker guards. */export function composerSubmitIntent(event: ComposerKeyEvent,- shortcut: ComposerSendShortcut,+ preference: ComposerSendShortcut,+ draft?: string | null,): ComposerSubmitIntent | null {+ const shortcut = effectiveSendShortcut(preference, draft);if (event.key !== "Enter" ||event.altKey ||@@ -55,9 +67,11 @@ export function followUpSubmitIntent(}export function composerShortcutLabels(- shortcut: ComposerSendShortcut,+ preference: ComposerSendShortcut,mac: boolean,+ draft?: string | null,) {+ const shortcut = effectiveSendShortcut(preference, draft);const mod = mac ? "⌘" : "Ctrl+";return {send: shortcut === "enter" ? "Enter" : `${mod}Enter`,@@ -81,10 +95,10 @@ export function normalizeComposerPreferences(value: unknown) {typeof saved?.showContextWindowUsage === "boolean"? saved.showContextWindowUsage: true,- sendShortcut:- saved?.sendShortcut === "mod-enter"- ? ("mod-enter" as const)- : ("enter" as const),+ sendShortcut: (saved?.sendShortcut === "mod-enter" ||+ saved?.sendShortcut === "mod-enter-multiline"+ ? saved.sendShortcut+ : "enter") as ComposerSendShortcut,followUpBehavior:saved?.followUpBehavior === "steer"? ("steer" as const)diff --git a/studio/frontend/src/features/settings/components/composer-settings.tsx b/studio/frontend/src/features/settings/components/composer-settings.tsxindex 588d395d104..5c609e441f6 100644--- a/studio/frontend/src/features/settings/components/composer-settings.tsx+++ b/studio/frontend/src/features/settings/components/composer-settings.tsx@@ -27,6 +27,21 @@ export function ComposerSettings({ embedded = false }: { embedded?: boolean }) {const ref = useRef<HTMLDivElement>(null);const scrollTarget = useSettingsDialogStore((s) => s.scrollTarget);const labels = composerShortcutLabels(prefs.sendShortcut, isMacPlatform());+ // The multiline mode's chord changes once the prompt has a line break.+ const multiline = composerShortcutLabels(prefs.sendShortcut, isMacPlatform(), "\n");+ const oppositeShortcut =+ labels.opposite === multiline.opposite+ ? labels.opposite+ : t("composerSettings.followUpMultilineShortcut", {+ shortcut: labels.opposite,+ multiline: multiline.opposite,+ });+ const mod = isMacPlatform() ? "\u2318" : "Ctrl";+ const sendDescriptionKey = {+ enter: "composerSettings.sendEnterDescription",+ "mod-enter-multiline": "composerSettings.sendMultilineDescription",+ "mod-enter": "composerSettings.sendAlwaysDescription",+ } as const;useEffect(() => {if (scrollTarget !== "chat-composer") return;const frame = requestAnimationFrame(() => {@@ -51,26 +66,31 @@ export function ComposerSettings({ embedded = false }: { embedded?: boolean }) {><SettingsRowlabel={t("composerSettings.sendShortcut")}- description={t("composerSettings.sendDescription")}+ description={t(sendDescriptionKey[prefs.sendShortcut], { mod })}><Selectvalue={prefs.sendShortcut}onValueChange={(value) =>prefs.setSendShortcut(- value === "mod-enter" ? "mod-enter" : "enter",+ value === "mod-enter" || value === "mod-enter-multiline"+ ? value+ : "enter",)}><SelectTrigger- className="w-36"+ className="w-auto max-w-72"aria-label={t("composerSettings.sendShortcut")}><SelectValue /></SelectTrigger>- <SelectContent>+ <SelectContent align="end"><SelectItem value="enter">Enter</SelectItem>+ <SelectItem value="mod-enter-multiline">+ {t("composerSettings.sendMultiline", { mod })}+ </SelectItem><SelectItem value="mod-enter">- {composerShortcutLabels("mod-enter", isMacPlatform()).send}+ {t("composerSettings.sendAlways", { mod })}</SelectItem></SelectContent></Select>@@ -78,7 +98,7 @@ export function ComposerSettings({ embedded = false }: { embedded?: boolean }) {<SettingsRowlabel={t("composerSettings.followUp")}description={t("composerSettings.followUpDescription", {- shortcut: labels.opposite,+ shortcut: oppositeShortcut,})}hint={t("composerSettings.steerDescription")}>diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex d2ff9a7fa9c..e45f4163e2f 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -11,9 +11,14 @@ export const ar = {plainTextDescription: "إبقاء التعليمات البرمجية وMarkdown والروابط كنص حرفي. عطّل هذا الخيار لعرض معاينة منسقة.",showContext: "إظهار استخدام نافذة السياق",sendShortcut: "اختصار الإرسال",- sendDescription: "اختر ما إذا كان Enter يرسل الرسالة أو يضيف سطرًا جديدًا.",+ sendMultiline: "{mod} + Enter للرسائل متعددة الأسطر",+ sendAlways: "{mod} + Enter دائمًا",+ sendEnterDescription: "Enter للإرسال. Shift + Enter لإضافة سطر جديد.",+ sendMultilineDescription: "Enter يرسل الرسالة المكونة من سطر واحد. وعندما تصبح أكثر من سطر، يضيف Enter سطرًا جديدًا ويرسل {mod} + Enter.",+ sendAlwaysDescription: "{mod} + Enter للإرسال. Enter لإضافة سطر جديد.",followUp: "سلوك رسائل المتابعة",followUpDescription: "اختر ما يحدث عند الإرسال أثناء الرد. اضغط {shortcut} لتنفيذ الإجراء المعاكس لرسالة واحدة.",+ followUpMultilineShortcut: "{shortcut} ({multiline} في الرسائل متعددة الأسطر)",queue: "إضافة للطابور",steer: "توجيه",steerDescription: "التوجيه يوقف الرد الحالي ويرسل رسالة المتابعة بعده مباشرة.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex b879fcac99b..02e1fa9963d 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -11,9 +11,14 @@ export const de = {plainTextDescription: "Code, Markdown und Links als wörtlichen Text anzeigen. Ausschalten, um eine formatierte Vorschau zu sehen.",showContext: "Auslastung des Kontextfensters anzeigen",sendShortcut: "Tastenkürzel zum Senden",- sendDescription: "Wähle, ob Enter eine Nachricht sendet oder eine neue Zeile einfügt.",+ sendMultiline: "{mod} + Enter bei mehrzeiligen Nachrichten",+ sendAlways: "{mod} + Enter immer",+ sendEnterDescription: "Enter sendet. Shift + Enter fügt eine neue Zeile ein.",+ sendMultilineDescription: "Enter sendet eine einzeilige Nachricht. Sobald sie mehrere Zeilen hat, fügt Enter eine neue Zeile ein und {mod} + Enter sendet.",+ sendAlwaysDescription: "{mod} + Enter sendet. Enter fügt eine neue Zeile ein.",followUp: "Folgenachrichten",followUpDescription: "Wähle, was beim Senden während einer Antwort passiert. Drücke {shortcut}, um für eine Nachricht das Gegenteil zu tun.",+ followUpMultilineShortcut: "{shortcut} ({multiline} bei mehrzeiligen Nachrichten)",queue: "Einreihen",steer: "Umlenken",steerDescription: "Umlenken stoppt die aktuelle Antwort und sendet deine Folgenachricht als Nächstes.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 7cafa908919..bbe81114acd 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -8,9 +8,15 @@ export const en = {plainTextDescription: "Keep code, Markdown, and links as literal text. Turn off to show a formatted preview.",showContext: "Context window usage",sendShortcut: "Send shortcut",- sendDescription: "Choose when Enter sends a prompt or inserts a new line.",+ sendMultiline: "{mod} + Enter for multiline prompts",+ sendAlways: "{mod} + Enter always",+ sendEnterDescription: "Enter sends. Shift + Enter adds a new line.",+ sendMultilineDescription:+ "Enter sends a one-line prompt. Once it has more than one line, Enter adds a new line and {mod} + Enter sends.",+ sendAlwaysDescription: "{mod} + Enter sends. Enter adds a new line.",followUp: "Follow-up behavior",followUpDescription: "What happens when you send during a response. Press {shortcut} to do the opposite once.",+ followUpMultilineShortcut: "{shortcut} ({multiline} in a multiline prompt)",queue: "Queue",steer: "Steer",steerDescription: "Steer stops the current response and sends your follow-up next.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 91207070a45..3e675e03509 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -11,9 +11,14 @@ export const es = {plainTextDescription: "Mantener el código, Markdown y los enlaces como texto literal. Desactívalo para mostrar una vista previa con formato.",showContext: "Mostrar uso de la ventana de contexto",sendShortcut: "Atajo para enviar",- sendDescription: "Elige si Intro envía un mensaje o inserta una línea nueva.",+ sendMultiline: "{mod} + Enter en mensajes de varias líneas",+ sendAlways: "{mod} + Enter siempre",+ sendEnterDescription: "Enter envía. Shift + Enter añade una línea nueva.",+ sendMultilineDescription: "Enter envía un mensaje de una línea. Cuando tiene más de una línea, Enter añade una línea nueva y {mod} + Enter envía.",+ sendAlwaysDescription: "{mod} + Enter envía. Enter añade una línea nueva.",followUp: "Mensajes de seguimiento",followUpDescription: "Elige qué ocurre al enviar durante una respuesta. Pulsa {shortcut} para hacer lo contrario con un mensaje.",+ followUpMultilineShortcut: "{shortcut} ({multiline} en un mensaje de varias líneas)",queue: "En cola",steer: "Redirigir",steerDescription: "Redirigir detiene la respuesta actual y envía tu mensaje de seguimiento a continuación.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 390c3460477..dfc05714755 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -11,9 +11,14 @@ export const fr = {plainTextDescription: "Conserver le code, le Markdown et les liens en texte brut. Désactivez pour afficher un aperçu mis en forme.",showContext: "Afficher l’utilisation de la fenêtre de contexte",sendShortcut: "Raccourci d’envoi",- sendDescription: "Choisissez si Entrée envoie un message ou insère une nouvelle ligne.",+ sendMultiline: "{mod} + Enter pour les messages sur plusieurs lignes",+ sendAlways: "{mod} + Enter toujours",+ sendEnterDescription: "Enter envoie. Shift + Enter ajoute une nouvelle ligne.",+ sendMultilineDescription: "Enter envoie un message d’une seule ligne. Dès qu’il compte plusieurs lignes, Enter ajoute une nouvelle ligne et {mod} + Enter envoie.",+ sendAlwaysDescription: "{mod} + Enter envoie. Enter ajoute une nouvelle ligne.",followUp: "Messages de suivi",followUpDescription: "Choisissez l’action lors d’un envoi pendant une réponse. Appuyez sur {shortcut} pour inverser ce choix pour un message.",+ followUpMultilineShortcut: "{shortcut} ({multiline} pour un message sur plusieurs lignes)",queue: "File d’attente",steer: "Réorienter",steerDescription: "Réorienter arrête la réponse en cours et envoie votre message de suivi en priorité.",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 24ba3cb2f5e..42d28b00e0a 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -11,9 +11,14 @@ export const hi = {plainTextDescription: "कोड, Markdown और लिंक को मूल टेक्स्ट के रूप में रखें। फ़ॉर्मैट किया हुआ पूर्वावलोकन दिखाने के लिए इसे बंद करें।",showContext: "कॉन्टेक्स्ट विंडो का उपयोग दिखाएँ",sendShortcut: "भेजने का शॉर्टकट",- sendDescription: "चुनें कि Enter से संदेश भेजना है या नई पंक्ति जोड़नी है।",+ sendMultiline: "कई पंक्तियों वाले संदेशों के लिए {mod} + Enter",+ sendAlways: "हमेशा {mod} + Enter",+ sendEnterDescription: "Enter भेजता है। Shift + Enter नई पंक्ति जोड़ता है।",+ sendMultilineDescription: "Enter एक पंक्ति वाला संदेश भेजता है। संदेश में एक से ज़्यादा पंक्तियाँ होने पर Enter नई पंक्ति जोड़ता है और {mod} + Enter भेजता है।",+ sendAlwaysDescription: "{mod} + Enter भेजता है। Enter नई पंक्ति जोड़ता है।",followUp: "अगले संदेश का व्यवहार",followUpDescription: "उत्तर के दौरान संदेश भेजने पर क्या होगा, चुनें। एक संदेश के लिए विपरीत विकल्प इस्तेमाल करने हेतु {shortcut} दबाएँ।",+ followUpMultilineShortcut: "{shortcut} (कई पंक्तियों वाले संदेश में {multiline})",queue: "कतार में जोड़ें",steer: "दिशा बदलें",steerDescription: "दिशा बदलने से वर्तमान उत्तर रुक जाता है और आपका अगला संदेश पहले भेजा जाता है।",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex a43934f1b5b..8c71870d98b 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -8,9 +8,14 @@ export const it = {plainTextDescription: "Mantieni codice, Markdown e link come testo letterale. Disattiva per mostrare un’anteprima formattata.",showContext: "Mostra l’utilizzo della finestra di contesto",sendShortcut: "Scorciatoia di invio",- sendDescription: "Scegli se Invio invia un messaggio o inserisce una nuova riga.",+ sendMultiline: "{mod} + Enter per i messaggi su più righe",+ sendAlways: "{mod} + Enter sempre",+ sendEnterDescription: "Enter invia. Shift + Enter aggiunge una nuova riga.",+ sendMultilineDescription: "Enter invia un messaggio di una riga. Quando ha più di una riga, Enter aggiunge una nuova riga e {mod} + Enter invia.",+ sendAlwaysDescription: "{mod} + Enter invia. Enter aggiunge una nuova riga.",followUp: "Messaggi successivi",followUpDescription: "Scegli cosa accade quando invii durante una risposta. Premi {shortcut} per fare il contrario per un messaggio.",+ followUpMultilineShortcut: "{shortcut} ({multiline} in un messaggio su più righe)",queue: "In coda",steer: "Riorienta",steerDescription: "Riorienta interrompe la risposta corrente e invia subito dopo il tuo messaggio successivo.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 8f0a1b6c640..e69c08b2e88 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -12,9 +12,14 @@ export const ja = {plainTextDescription: "コード、Markdown、リンクをそのままのテキストで表示します。オフにすると書式付きプレビューを表示します。",showContext: "コンテキストウィンドウの使用量を表示",sendShortcut: "送信ショートカット",- sendDescription: "Enter キーで送信するか改行するかを選択します。",+ sendMultiline: "複数行のメッセージは {mod} + Enter",+ sendAlways: "常に {mod} + Enter",+ sendEnterDescription: "Enter で送信、Shift + Enter で改行します。",+ sendMultilineDescription: "1 行のメッセージは Enter で送信します。2 行以上になると、Enter で改行し、{mod} + Enter で送信します。",+ sendAlwaysDescription: "{mod} + Enter で送信、Enter で改行します。",followUp: "追加メッセージの動作",followUpDescription: "応答中に送信した場合の動作を選択します。{shortcut} を押すと、そのメッセージだけ逆の動作になります。",+ followUpMultilineShortcut: "{shortcut}(複数行のメッセージでは {multiline})",queue: "キューに追加",steer: "方向を変更",steerDescription: "現在の応答を停止し、追加メッセージを次に送信します。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex cdf9ed192e0..2585a5d32ac 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -11,9 +11,14 @@ export const ko = {plainTextDescription: "코드, Markdown, 링크를 원문 그대로 표시합니다. 끄면 서식 미리보기를 표시합니다.",showContext: "컨텍스트 창 사용량 표시",sendShortcut: "전송 단축키",- sendDescription: "Enter 키로 메시지를 보내거나 줄을 바꿀지 선택합니다.",+ sendMultiline: "여러 줄 메시지는 {mod} + Enter",+ sendAlways: "항상 {mod} + Enter",+ sendEnterDescription: "Enter로 전송하고 Shift + Enter로 줄을 바꿉니다.",+ sendMultilineDescription: "한 줄 메시지는 Enter로 전송합니다. 두 줄 이상이 되면 Enter로 줄을 바꾸고 {mod} + Enter로 전송합니다.",+ sendAlwaysDescription: "{mod} + Enter로 전송하고 Enter로 줄을 바꿉니다.",followUp: "후속 메시지 동작",followUpDescription: "응답 중에 전송할 때의 동작을 선택합니다. {shortcut}을 누르면 해당 메시지만 반대로 처리합니다.",+ followUpMultilineShortcut: "{shortcut} (여러 줄 메시지에서는 {multiline})",queue: "대기열",steer: "방향 변경",steerDescription: "현재 응답을 중지하고 후속 메시지를 다음에 전송합니다.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex d76de5deb42..4860aaf6daa 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -11,9 +11,14 @@ export const ptBR = {plainTextDescription: "Manter código, Markdown e links como texto literal. Desative para mostrar uma prévia formatada.",showContext: "Mostrar uso da janela de contexto",sendShortcut: "Atalho de envio",- sendDescription: "Escolha se Enter envia uma mensagem ou insere uma nova linha.",+ sendMultiline: "{mod} + Enter para mensagens de várias linhas",+ sendAlways: "{mod} + Enter sempre",+ sendEnterDescription: "Enter envia. Shift + Enter adiciona uma nova linha.",+ sendMultilineDescription: "Enter envia uma mensagem de uma linha. Quando ela tem mais de uma linha, Enter adiciona uma nova linha e {mod} + Enter envia.",+ sendAlwaysDescription: "{mod} + Enter envia. Enter adiciona uma nova linha.",followUp: "Mensagens de acompanhamento",followUpDescription: "Escolha o que acontece ao enviar durante uma resposta. Pressione {shortcut} para fazer o contrário em uma mensagem.",+ followUpMultilineShortcut: "{shortcut} ({multiline} em uma mensagem de várias linhas)",queue: "Enfileirar",steer: "Redirecionar",steerDescription: "Redirecionar interrompe a resposta atual e envia sua mensagem de acompanhamento em seguida.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex fc5a01fb6f4..05aebc3207c 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -11,9 +11,14 @@ export const ru = {plainTextDescription: "Показывать код, Markdown и ссылки как обычный текст. Отключите для предпросмотра форматирования.",showContext: "Показывать использование контекстного окна",sendShortcut: "Клавиши отправки",- sendDescription: "Выберите, отправляет ли Enter сообщение или добавляет новую строку.",+ sendMultiline: "{mod} + Enter для многострочных сообщений",+ sendAlways: "Всегда {mod} + Enter",+ sendEnterDescription: "Enter отправляет. Shift + Enter добавляет новую строку.",+ sendMultilineDescription: "Enter отправляет однострочное сообщение. Когда в нём больше одной строки, Enter добавляет новую строку, а {mod} + Enter отправляет.",+ sendAlwaysDescription: "{mod} + Enter отправляет. Enter добавляет новую строку.",followUp: "Последующие сообщения",followUpDescription: "Выберите действие при отправке во время ответа. Нажмите {shortcut}, чтобы выполнить противоположное действие для одного сообщения.",+ followUpMultilineShortcut: "{shortcut} ({multiline} в многострочном сообщении)",queue: "В очередь",steer: "Перенаправить",steerDescription: "Перенаправление останавливает текущий ответ и отправляет ваше сообщение следующим.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 6f12ec93bb2..9d03339689e 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -11,9 +11,14 @@ export const zhCN = {plainTextDescription: "将代码、Markdown 和链接保留为原始文本。关闭后显示格式化预览。",showContext: "显示上下文窗口使用量",sendShortcut: "发送快捷键",- sendDescription: "选择按 Enter 发送消息还是插入新行。",+ sendMultiline: "多行消息使用 {mod} + Enter",+ sendAlways: "始终使用 {mod} + Enter",+ sendEnterDescription: "按 Enter 发送,按 Shift + Enter 换行。",+ sendMultilineDescription: "单行消息按 Enter 发送。消息超过一行后,按 Enter 换行,按 {mod} + Enter 发送。",+ sendAlwaysDescription: "按 {mod} + Enter 发送,按 Enter 换行。",followUp: "后续消息行为",followUpDescription: "选择在回复过程中发送消息时的操作。按 {shortcut} 可对单条消息执行相反操作。",+ followUpMultilineShortcut: "{shortcut}(多行消息中为 {multiline})",queue: "排队",steer: "调整方向",steerDescription: "调整方向会停止当前回复,并优先发送后续消息。",diff --git a/studio/frontend/tests/composer-preferences.test.ts b/studio/frontend/tests/composer-preferences.test.tsindex 7454c376fd1..648bdc4e4ce 100644--- a/studio/frontend/tests/composer-preferences.test.ts+++ b/studio/frontend/tests/composer-preferences.test.ts@@ -5,6 +5,7 @@ import {composerSubmitIntent,composerFollowUpBehavior,composerShortcutLabels,+ effectiveSendShortcut,followUpSubmitIntent,normalizeComposerPreferences,type ComposerKeyEvent,@@ -60,7 +61,7 @@ for (const blocked of [{ metaKey: true, ctrlKey: true },]) {test(`do not submit ${JSON.stringify(blocked)}`, () => {- for (const shortcut of ["enter", "mod-enter"] as const) {+ for (const shortcut of ["enter", "mod-enter-multiline", "mod-enter"] as const) {assert.equal(composerSubmitIntent({ ...enter, ...blocked }, shortcut),null,@@ -72,6 +73,47 @@ for (const blocked of [}});}+for (const key of ["metaKey", "ctrlKey"] as const) {+ test(`${key}: mod-enter-multiline is Enter for one line and mod-enter once the draft has a line break`, () => {+ const mod = { ...enter, [key]: true };+ // One line: Enter sends, Shift+Enter breaks the line.+ assert.equal(composerSubmitIntent(enter, "mod-enter-multiline", "hi"), "default");+ assert.equal(composerSubmitIntent({ ...enter, shiftKey: true }, "mod-enter-multiline", "hi"), null);+ assert.equal(composerSubmitIntent(enter, "mod-enter-multiline"), "default");+ // Several lines: Enter adds another, the modifier sends.+ assert.equal(composerSubmitIntent(enter, "mod-enter-multiline", "a\nb"), null);+ assert.equal(composerSubmitIntent(mod, "mod-enter-multiline", "a\nb"), "default");+ assert.equal(+ composerSubmitIntent({ ...mod, shiftKey: true }, "mod-enter-multiline", "a\nb"),+ "opposite",+ );+ // The other two ignore the draft.+ assert.equal(composerSubmitIntent(enter, "enter", "a\nb"), "default");+ assert.equal(composerSubmitIntent(enter, "mod-enter", "hi"), null);+ assert.equal(effectiveSendShortcut("mod-enter-multiline", "a\nb"), "mod-enter");+ assert.equal(effectiveSendShortcut("mod-enter-multiline", ""), "enter");+ assert.deepEqual(composerShortcutLabels("mod-enter-multiline", true, "a\nb"), {+ send: "⌘Enter",+ opposite: "⇧⌘Enter",+ });+ assert.deepEqual(composerShortcutLabels("mod-enter-multiline", true, "hi"), {+ send: "Enter",+ opposite: "⌘Enter",+ });+ assert.deepEqual(composerShortcutLabels("mod-enter-multiline", false, "a\nb"), {+ send: "Ctrl+Enter",+ opposite: "Ctrl+Shift+Enter",+ });+ assert.deepEqual(composerShortcutLabels("mod-enter-multiline", false, "hi"), {+ send: "Enter",+ opposite: "Ctrl+Enter",+ });+ assert.equal(+ normalizeComposerPreferences({ sendShortcut: "mod-enter-multiline" }).sendShortcut,+ "mod-enter-multiline",+ );+ });+}test("one-message override flips both preferences without changing the default", () => {assert.equal(composerFollowUpBehavior("queue", "default"), "queue");assert.equal(composerFollowUpBehavior("queue", "opposite"), "steer");diff --git a/studio/frontend/tests/composer-submit-path.test.ts b/studio/frontend/tests/composer-submit-path.test.tsindex f6d488dd9a3..997bbd15e84 100644--- a/studio/frontend/tests/composer-submit-path.test.ts+++ b/studio/frontend/tests/composer-submit-path.test.ts@@ -155,7 +155,7 @@ test("main, edit and comparison composers use the setting and expose settings acassert.match(text, /submitMode="none"/);assert.match(text,- /submitMode=\{sendShortcut === "mod-enter" \? "ctrlEnter" : "enter"\}/,+ /effectiveSendShortcut\(sendShortcut, editMultiline \? "\\n" : ""\) === "mod-enter"\s*\? "ctrlEnter"\s*: "enter"/,);assert.match(text,@@ -163,7 +163,7 @@ test("main, edit and comparison composers use the setting and expose settings ac);assert.match(text, /scrollTarget: "chat-composer"/);const compare = readSrc("features/chat/shared-composer.tsx");- assert.match(compare, /composerSubmitIntent\(e, sendShortcut\)/);+ assert.match(compare, /composerSubmitIntent\(e, sendShortcut, text\)/);assert.match(compare, /scrollTarget: "chat-composer"/);const page = readSrc("features/chat/chat-page.tsx");assert.match(page, /showContextWindowUsage &&\s*view.mode === "single"/);diff --git a/tests/studio/playwright_composer_settings.py b/tests/studio/playwright_composer_settings.pyindex f79b6825d8f..65bc8b08bd9 100644--- a/tests/studio/playwright_composer_settings.py+++ b/tests/studio/playwright_composer_settings.py@@ -48,7 +48,7 @@ def check_settings(page):context.click()page.get_by_role("button", name = "Steer", exact = True).click()select.click()- option = page.get_by_role("option", name = re.compile(r"^(⌘|Ctrl\+)Enter$"))+ option = page.get_by_role("option", name = re.compile(r"^(⌘|Ctrl) \+ Enter always$"))modified_label = option.inner_text()option.click()editor.fill("First line")