Procházet zdrojové kódy

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

Jack před 5 měsíci
rodič
revize
3c32013eb1
1 změnil soubory, kde provedl 3 přidání a 2 odebrání
  1. 3 2
      packages/app/src/components/prompt-input.tsx

+ 3 - 2
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")
   }