-
Notifications
You must be signed in to change notification settings - Fork 19
Add support for images and pdf files #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+327
−171
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
34480f8
Add support for images and pdf files
Yahiewi 6acf401
Merge remote-tracking branch 'upstream/main' into image
Yahiewi b531350
Use IAttachment mimetype for reading attachments
Yahiewi 030280b
Use IAttachment mimetype for reading attachments
Yahiewi ad6aa39
Refactor AIChatModel methods to Private namespace
Yahiewi d68774c
Lint extension
Yahiewi bd6e8d8
Fix conflicts
Yahiewi 4a45d63
Improve error handling and messaging
Yahiewi ed34f4f
Improve error handling
Yahiewi 041e088
Resolve conflicts
Yahiewi 8694ae0
Lint
Yahiewi c07978c
Fix generateResponse
Yahiewi 9c8aed3
Resolve conflicts
Yahiewi bedc7dc
Improve error logging
Yahiewi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message should only appear in the
responseHistoryobject; we probably don't need to go through the entire history.Actually, if I'm not mistaken, the user message should always be the first message of the
responseHistory, we can probably get it withresponseHistory[0].Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how I did it at first too (by only looking at the last sent user message).
However in the current version, I look at the entire history because of the following case:
If a user uses a vision-capable model at first and sends it attachment(s), they then later for some reason (say they no longer have any credits) decide to switch to a non vision-capable model, upon sending a message, the conversation would enter the infinite error loop because of the attachment(s) in the history.
Here's what it looks like:
Screencast.from.2026-04-14.17-03-50.mp4
As you can see we avoid the infinite error loop because the attachment is deleted when we catch the error. However, this is still not ideal I think because you need to send a message to trigger the error and then send the prompt. I'm currently thinking about how I can remove this friction.
EDIT: I tried encapsulating the function body in a while loop and make it retry sending the message once automatically after the first error of this kind and this works fine. But I think it overcomplicates the code a bit and makes it less readable so in the end I just improved the error logging:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification, indeed it would break when switching the model.
Let's keep it that way for now, but we should open an issue to handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #321