Skip to content

The open source coding agent.

TypeScript

fix: preserve image attachments when selecting slash commands (#19771)

Jack3c32013eb122
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx
index 1cc7c578d36..c8f72b8d2f5 100644
--- a/packages/app/src/components/prompt-input.tsx
+++ b/packages/app/src/components/prompt-input.tsx
@@ -624,17 +624,18 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
if (!cmd) return
promptProbe.select(cmd.id)
closePopover()
+ const images = imageAttachments()
if (cmd.type === "custom") {
const text = `/${cmd.trigger} `
setEditorText(text)
- prompt.set([{ type: "text", content: text, start: 0, end: text.length }], text.length)
+ prompt.set([{ type: "text", content: text, start: 0, end: text.length }, ...images], text.length)
focusEditorEnd()
return
}
clearEditor()
- prompt.set([{ type: "text", content: "", start: 0, end: 0 }], 0)
+ prompt.set([...DEFAULT_PROMPT, ...images], 0)
command.trigger(cmd.id, "slash")
}