- 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
28 lines
841 B
TypeScript
28 lines
841 B
TypeScript
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
|