{{ message }}
Studio: make the paste-to-attachment threshold a chat setting - #8963
Merged
Conversation
Long pastes became a .txt attachment at 2,000 characters, or at 40 lines regardless of length, and neither was adjustable. A 45 line paste of short lines was condensed even though it would have sat fine inline. Raise the default to 4,000 characters, drop the line rule so length alone decides, and add a Settings > Chat dropdown offering Off, 2,000, 4,000, 8,000 and 16,000. Off keeps every paste inline. A stored value outside those choices falls back to the default, so a stale one cannot leave the dropdown blank. Widen the paste preview dialog from 46rem to 68rem and 80dvh to 88dvh, with the body growing to match, since the old width wrapped lines that did not need wrapping.
Member
Author
|
@codex review |
rhsCZ
pushed a commit
to rhsCZ/unsloth
that referenced
this pull request
Aug 16, 2026
Resolves the conflict in studio/frontend/src/components/assistant-ui/thread.tsx. Main's paste-to-attachment threshold (unslothai#8963) added pastedTextMinChars at the same spot this branch declares justSentRef, so both declarations are kept. Also tightens the two longest comments the branch adds, in the draft-restore suppression and the deliberate-write retire effect. Comment-only: the file transpiles byte-identical with comments stripped.
danielhanchen
added a commit
that referenced
this pull request
Aug 16, 2026
…load it (#8981) Frontend build + bundle sanity is red on main. tests/delete-chat-files-preference.test.ts fails with ERR_MODULE_NOT_FOUND for studio/frontend/src/features/chat/utils/pasted-text, and the file is there. The frontend suite runs under `node --experimental-strip-types --test`, and Node's ESM resolver does not add extensions. #8963 added } from "../utils/pasted-text"; to chat-preferences-store.ts, which the test imports for its value, so the resolver is asked for a file called pasted-text and there is not one. The two sibling modules that import the same file, use-chat-search-index.ts and prompt-storage-dialog.tsx, both write ../utils/pasted-text.ts, which is the convention this restores. Reproduced the mechanism on its own: a.ts importing "./b" fails with ERR_MODULE_NOT_FOUND under --experimental-strip-types, and "./b.ts" resolves. Scope. 47 other relative imports without an extension sit in modules the tests name, but all except two are erased before resolution, being `import type` or a braced clause of nothing but types. The two real ones, chat-settings-api.ts -> ../utils/settings-retry and per-model-config.ts -> ./model-identity, are not reached at runtime: the tests that mention those files pass them to readFile as source text, or import only their types. They are latent rather than broken, so they are left alone here and worth a separate look.
danielhanchen
added a commit
that referenced
this pull request
Aug 16, 2026
One conflict, in the composer's hook block: main added the pastedTextMinChars preference read (#8963) and this branch added the Cmd/Ctrl+Enter ref and its handler at the same spot. Both are kept. Nothing else in thread.tsx conflicted, and the paste threshold does not change what the queue sees: a long paste still arrives as an attachment that isPastedTextFile recognises, which is what canQueuePastedTextPrompt gates on.
This was referenced Aug 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
A long paste in Chat becomes a
.txtattachment instead of filling the message box. Two things decided that, and neither was adjustable:The preview dialog was also narrower than the text needed, so lines wrapped that did not have to.
Changes
Threshold. Default raised to 4,000 characters. The line rule is gone, so length alone decides.
Setting. Settings > Chat gets a dropdown: Off, 2,000, 4,000, 8,000, 16,000. Off keeps every paste inline no matter how long. The value is stored in the existing
unsloth_chat_preferenceslocalStorage entry.A stored value outside those choices falls back to the default. Without that, a stale or hand-edited entry leaves the dropdown blank with no way to fix it from the UI.
Preview dialog. Widened from
46remto68remand from80dvhto88dvh, with the bodypregrowing from64dvhto72dvhso the extra height is usable rather than padding.shouldAttachPastedTextandpasteLongTextAsFiletake the threshold as an optional argument defaulting to 4,000, so the one production caller passes the preference and the rest of the call sites are unchanged.Verification
Dialog geometry measured on a vite entry with no backend, at a 1280x720 viewport, to confirm the arbitrary Tailwind values resolve rather than assuming they compile:
tests/pasted-text-attachment.test.tscovers the new behaviour: the configurable threshold at 2,000, 4,000 and 16,000 against the same input, Off refusing a 5MB paste, a negative value not re-enabling it, a 200 line short paste now staying inline, and the default being one of the offered choices.Full frontend suite passes at 2705.
tsc -bclean.npm run i18n:check:strictpasses, with the three new keys added to all 12 locales. No new biome findings on the touched files.Note on CI
Frontend build + bundle sanityfails ontests/llama-extra-args-diagnostics.test.tsfor a missingparallelSlotsClampedonLlamaFlagCatalog, andBackend CIfails onAttributeError: '_Backend' object has no attribute 'context_length'. Both reproduce on a cleanmaincheckout and are unrelated to this branch, which changes no Python.This touches
studio/frontend/src/components/assistant-ui/thread.tsx, which #8849 also touches. Whichever merges second needs a small conflict resolution; the two changes are in different parts of the composer.