Skip to content

add support for 'document' file attachments#3

Open
pniyongabo wants to merge 2 commits into
tahouse:mainfrom
pniyongabo:attach-files
Open

add support for 'document' file attachments#3
pniyongabo wants to merge 2 commits into
tahouse:mainfrom
pniyongabo:attach-files

Conversation

@pniyongabo

Copy link
Copy Markdown
Contributor

Description:

  • add support for all file extensions supported by AWS bedrock converse API
  • refactor file type classification to use consistent 'image'/'document' categories
  • add is_previewable property to FileData class to identify previewable content
  • simplify code with centralized file type utilities in Types.tsx

Testing:

  • tested by attaching pdf|csv|doc|docx|xls|xlsx|html|txt|md files

References:

Description:
- add support for all file extensions supported by AWS bedrock converse API
- refactor file type classification to use consistent 'image'/'document' categories
- add `is_previewable` property to FileData class to identify previewable content
- simplify code with centralized file type utilities in Types.tsx

Testing:
- tested by attaching `pdf|csv|doc|docx|xls|xlsx|html|txt|md` files

References:
- AWS Bedrock converse API for docs attachments: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html

@tahouse tahouse left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to check this out. Looks good, just a little confusion on my part about decision to separate pdf/md from other document types in the file logic below

Comment on lines +16 to +23
pdf: {
mimeTypes: ['application/pdf'],
extensions: ['.pdf']
},
markdown: {
mimeTypes: ['text/markdown', 'text/x-markdown'],
extensions: ['.md']
},

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we treat these differently than documents below? In other parts of code we seem to include pdf/md as both documents?

@pniyongabo pniyongabo Aug 26, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my bad, i kind of overlooked this as I was trying to keep the preview functionality in components/ChatInput.tsx that depended on checking whether file.type was md or pdf. I have added a new commit to consolidate pdf/md with other document types, while keeping the preview logic separate

Description:
- Simplify file types to 'image' and 'document' categories
- Add `isPreviewableDocument` function utility function in types.tsx
- 1st attempt to make the preview logic identical between Python and TypeScript

Testing:
- Tested: pdf|csv|doc|docx|xls|xlsx|html|txt|md file attachments

References:
- AWS Bedrock converse API for docs attachments: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_DocumentBlock.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants