From 737c5ad0e09e8f9802245df696fd4596f4b32a14 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 24 May 2026 17:19:50 +0000 Subject: [PATCH] Allow whitespace stop sequences from the chips editor (PR #5711) Round 11 P2 finding: the stop-sequence chips input rejected any draft that strip to empty, which silently dropped pasted whitespace stops like `"\n\n"` for blank-line halts. Local llama-server and OpenAI- compat backends accept those; the Anthropic helper independently filters whitespace entries before they hit the wire, so allowing them in the UI cannot turn into a 400. Drop the .trim() gate; reject only the truly empty draft. Single-line Input behaviour is unchanged for the common typed-letters path. --- .../src/components/ui/stop-sequences-input.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/studio/frontend/src/components/ui/stop-sequences-input.tsx b/studio/frontend/src/components/ui/stop-sequences-input.tsx index 2e647de01e..539571313a 100644 --- a/studio/frontend/src/components/ui/stop-sequences-input.tsx +++ b/studio/frontend/src/components/ui/stop-sequences-input.tsx @@ -38,10 +38,13 @@ export function StopSequencesInput({ const atCap = value.length >= maxEntries; function commitDraft() { - // Reject empty / whitespace-only chips but preserve significant - // leading/trailing whitespace (stop matching is exact). Backend - // re-validates per provider. - if (!draft || !draft.trim()) return; + // Reject only the empty draft; preserve whitespace exactly (stop + // matching is byte-exact). OpenAI-compat / llama-server backends + // accept whitespace-only stops like "\n\n" for blank-line halts; + // pasting such a value into the input should round-trip rather + // than be silently dropped. Anthropic's helper strips whitespace + // entries on the wire so a chip that's invalid there cannot 400. + if (!draft) return; if (atCap) return; if (value.includes(draft)) { setDraft("");