Skip to content

The open-source app everyone uses to manage agents at work

fix: embed uploaded images inline in comments via paperclip button

Matt Van Hornd11492781420
diff --git a/ui/src/components/CommentThread.tsx b/ui/src/components/CommentThread.tsx
index fa123d3178..0323bf880d 100644
--- a/ui/src/components/CommentThread.tsx
+++ b/ui/src/components/CommentThread.tsx
@@ -335,10 +335,16 @@ export function CommentThread({
async function handleAttachFile(evt: ChangeEvent<HTMLInputElement>) {
const file = evt.target.files?.[0];
- if (!file || !onAttachImage) return;
+ if (!file) return;
setAttaching(true);
try {
- await onAttachImage(file);
+ if (imageUploadHandler) {
+ const url = await imageUploadHandler(file);
+ const markdown = `![${file.name}](${url})`;
+ setBody((prev) => prev ? `${prev}\n${markdown}` : markdown);
+ } else if (onAttachImage) {
+ await onAttachImage(file);
+ }
} finally {
setAttaching(false);
if (attachInputRef.current) attachInputRef.current.value = "";
@@ -367,7 +373,7 @@ export function CommentThread({
contentClassName="min-h-[60px] text-sm"
/>
<div className="flex items-center justify-end gap-3">
- {onAttachImage && (
+ {(imageUploadHandler || onAttachImage) && (
<div className="mr-auto flex items-center gap-3">
<input
ref={attachInputRef}