Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat(desktop): preview image attachments in the composer
leepokai84a9e65153e9
diff --git a/apps/desktop/src/renderer/views/thread/Composer.tsx b/apps/desktop/src/renderer/views/thread/Composer.tsxindex e4625d59..a3eeb0ce 100644--- a/apps/desktop/src/renderer/views/thread/Composer.tsx+++ b/apps/desktop/src/renderer/views/thread/Composer.tsx@@ -5,7 +5,7 @@ import { Icon } from '../../components/Icon'import { font } from '../../lib/fonts'import { useStore } from '../../store/context'import { MAX_FILE_SIZE, type OutgoingFile } from '../../store/bot-store'-import { attachmentSymbol } from './Attachments'+import { ComposerAttachment } from './ComposerAttachment'type Trailing = 'interrupt' | 'stop' | 'call' | 'send'@@ -127,13 +127,7 @@ export function Composer({ botId, thread = null, onCall, onInterrupt }: {{files.length ? (<div className="file-chips">{files.map((f) => (- <span key={f.id} className="file-chip">- <Icon name={attachmentSymbol(f.name)} size={10} color="var(--secondary)" />- <span style={{ ...font('footnote'), color: 'var(--text)', maxWidth: 160, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{f.name}</span>- <button aria-label={`Remove ${f.name}`} title="Remove" style={{ display: 'flex' }} onClick={() => setFiles((list) => list.filter((x) => x.id !== f.id))}>- <Icon name="xmark" size={10} weight="bold" color="var(--secondary)" />- </button>- </span>+ <ComposerAttachment key={f.id} file={f} remove={() => setFiles((list) => list.filter((x) => x.id !== f.id))} />))}</div>) : null}diff --git a/apps/desktop/src/renderer/views/thread/ComposerAttachment.tsx b/apps/desktop/src/renderer/views/thread/ComposerAttachment.tsxnew file mode 100644index 00000000..462137f0--- /dev/null+++ b/apps/desktop/src/renderer/views/thread/ComposerAttachment.tsx@@ -0,0 +1,42 @@+import { useEffect, useState } from 'react'+import { isImageName } from '@shared/models'+import { Icon } from '../../components/Icon'+import { font } from '../../lib/fonts'+import type { OutgoingFile } from '../../store/bot-store'+import { attachmentSymbol } from './Attachments'++/**+ * A local attachment, shown before it is sent: images as a whole-image thumbnail with the+ * remove button in the corner, anything else (or an image that won't decode) as a name chip.+ */+export function ComposerAttachment({ file, remove }: { file: OutgoingFile; remove: () => void }) {+ const [url, setUrl] = useState<string | null>(null)+ const [broken, setBroken] = useState(false)++ useEffect(() => {+ if (!isImageName(file.name)) return+ const objectURL = URL.createObjectURL(new Blob([file.data as BlobPart]))+ setUrl(objectURL)+ return () => URL.revokeObjectURL(objectURL)+ }, [file])++ if (url && !broken) {+ return (+ <span className="attachment-tile" aria-label={`Image attachment: ${file.name}`} title={file.name}>+ <img src={url} alt="" onError={() => setBroken(true)} />+ <button className="press attachment-remove" aria-label={`Remove ${file.name}`} title="Remove" onClick={remove}>+ <Icon name="xmark" size={11} weight="bold" color="#fff" />+ </button>+ </span>+ )+ }+ return (+ <span className="file-chip">+ <Icon name={attachmentSymbol(file.name)} size={10} color="var(--secondary)" />+ <span style={{ ...font('footnote'), color: 'var(--text)', maxWidth: 160, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{file.name}</span>+ <button aria-label={`Remove ${file.name}`} title="Remove" style={{ display: 'flex' }} onClick={remove}>+ <Icon name="xmark" size={10} weight="bold" color="var(--secondary)" />+ </button>+ </span>+ )+}diff --git a/apps/desktop/src/renderer/views/thread/thread.css b/apps/desktop/src/renderer/views/thread/thread.cssindex f23a3f5a..b919e90f 100644--- a/apps/desktop/src/renderer/views/thread/thread.css+++ b/apps/desktop/src/renderer/views/thread/thread.css@@ -315,6 +315,35 @@padding: 8px 10px 0;overflow-x: auto;}+.file-chips:has(.attachment-tile) {+ align-items: flex-start;+}+.attachment-tile {+ position: relative;+ width: 80px;+ height: 80px;+ flex: none;+ border-radius: 16px;+ overflow: hidden;+ background: var(--surface);+}+.attachment-tile img {+ width: 100%;+ height: 100%;+ object-fit: contain;+}+.attachment-remove {+ position: absolute;+ top: 4px;+ right: 4px;+ width: 22px;+ height: 22px;+ display: flex;+ align-items: center;+ justify-content: center;+ border-radius: 50%;+ background: rgba(0, 0, 0, 0.75);+}.file-chip {display: flex;align-items: center;