Fix file attachment API format and duplicate attachments
- Add required 'url' field to file parts in API request - Use url, mime, filename instead of path field - Prevent duplicate attachments by checking if path already exists - Show all files when picker opens with empty query (use space as query) - Filter git files only when search query provided - Enter key now works correctly when file list has items
This commit is contained in:
@@ -161,8 +161,14 @@ export default function PromptInput(props: PromptInputProps) {
|
||||
|
||||
function handleFileSelect(path: string) {
|
||||
const filename = path.split("/").pop() || path
|
||||
const attachment = createFileAttachment(path, filename)
|
||||
addAttachment(props.instanceId, props.sessionId, attachment)
|
||||
|
||||
const existingAttachments = attachments()
|
||||
const alreadyAttached = existingAttachments.some((att) => att.source.type === "file" && att.source.path === path)
|
||||
|
||||
if (!alreadyAttached) {
|
||||
const attachment = createFileAttachment(path, filename)
|
||||
addAttachment(props.instanceId, props.sessionId, attachment)
|
||||
}
|
||||
|
||||
const currentPrompt = prompt()
|
||||
const pos = atPosition()
|
||||
|
||||
Reference in New Issue
Block a user