Add file attachments with @ mentions and drag & drop support
- Create attachment type system with file, text, symbol, and agent sources - Implement file picker with SDK integration (find.files, file.status) - Add @ detection in prompt input to trigger file search - Create attachment chips UI for managing attached files - Add attachment state management per session - Update message submission to include attachments - Implement drag & drop support for adding files - Show git-modified files first in file picker with +/- indicators - Filter files as user types after @ - Clear attachments after successful message send
This commit is contained in:
27
src/components/attachment-chip.tsx
Normal file
27
src/components/attachment-chip.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Component } from "solid-js"
|
||||
import type { Attachment } from "../types/attachment"
|
||||
|
||||
interface AttachmentChipProps {
|
||||
attachment: Attachment
|
||||
onRemove: () => void
|
||||
}
|
||||
|
||||
const AttachmentChip: Component<AttachmentChipProps> = (props) => {
|
||||
return (
|
||||
<div
|
||||
class="inline-flex items-center gap-1 rounded bg-blue-100 px-2 py-1 text-sm text-blue-800 dark:bg-blue-900/30 dark:text-blue-300"
|
||||
title={props.attachment.source.type === "file" ? props.attachment.source.path : undefined}
|
||||
>
|
||||
<span class="font-mono">{props.attachment.display}</span>
|
||||
<button
|
||||
onClick={props.onRemove}
|
||||
class="flex h-4 w-4 items-center justify-center rounded hover:bg-blue-200 dark:hover:bg-blue-800"
|
||||
aria-label="Remove attachment"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AttachmentChip
|
||||
Reference in New Issue
Block a user