Repository navigation
[Feature] Composer: inline image/file nodes with drag reorder / 输入框支持图片与文件内联并拖拽调位 #12506
yqx2006-maker
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
The composer is already a Lexical rich-text editor and already supports atomic inline chips for references, commands and quotes. Images and files are not part of the draft document, though: they live in
input.attachmentIdsplus the separate attachment rail, so a user cannot place an image between two sentences, cannot drag an attachment to a position, and the submitted prompt always puts every attachment before the text block.Requesting first-class inline attachment nodes with drag reorder — the composer behaviour of WorkBuddy / Claude / ChatGPT.
Environment
@deepseek-ai/dsh-desktop-runtime0.2.2-rc.1) on Windows 11; the same composer renders indsh web.@deepseek-ai/dsh-client-ui-conversation/lib/client.js(940 KB bundle; the asar ships nosrc/).Current behaviour (verified in the shipped bundle)
ReferenceChipNode,CommandChipNode,QuoteNodeare decorator nodes inside the document, so "text and file chips interleaved" already works.SessionInputShell.attachmentIdsis an ordered array rendered by the attachment rail, andaddAttachments/removeAttachment/pruneAttachmentsare its only mutations.client.js:4822-4832buildscontent = [...await serializeAttachments(), {type:'text', text}]and callssession.prompt(content, mode, signal, requestId).inputActionssurface isinsertQuote,captureInsertion,insertText(plain text only, revision-guarded),setDraft,persistDraft,addAttachments,removeAttachment,pruneAttachments,submit. There is no node-level operation, so a plugin can neither place an attachment into the document nor reorder nodes in it.Why this matters (beyond aesthetics)
session.promptaccepts an ordered block list; only the assembly step is fixed. This is a localised change with no protocol impact.Proposal (smallest unblocking surface, in preference order)
A. Make attachments first-class draft nodes (preferred).
inputActions.insertAttachmentNode(attachmentId, span?)andinputActions.moveAttachmentNode(nodeId, at)with node ids stable across ordinary edits.sendSessionderivescontentfrom document order (interleaved image/file blocks and text blocks) instead of attachments-first.B. Export-only alternative (no editor change).
Keep the rail, but let a takeover composer send explicit structure:
inputActions.submit({ blocks })(or an equivalentsubmitInterleaved), so plugin composers built onconversation.composercan preserve their own ordering. This alone does not give the default composer inline images.C. Minimum read/reorder surface for plugins.
Expose a read-only draft projection plus
reorderAttachments(ids); a plugin-side dnd implementation then covers drag-reorder of the rail even without host editor changes.Acceptance criteria
Reference recipe (from an Electron composer we reversed for comparison)
The mechanism is small and well understood; it does not need a new editor:
PointerSensorwithactivationConstraint: { distance: 8 },closestCentercollision detection, and a singleSortableContextover the draggable nodes.document.caretPositionFromPoint(fallbackcaretRangeFromPoint), map to an editor point withexactMatch: false.clientXis left of its horizontal midpoint, use the node start, otherwise the node end; render the indicator from the same rect.position: relative), not into the document, and keep the same portal trick for the drag overlay.Notes
All reactions