-
Notifications
You must be signed in to change notification settings - Fork 273
feat(amazonq): add image context support #5846
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
Conversation
...tware/aws/toolkits/jetbrains/services/amazonq/lsp/model/aws/chat/showOpenFileDialogParams.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
OPEN_FILE_DIALOG -> { | ||
handleChat(AmazonQChatServer.showOpenFileDialog, node) |
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.
can you walk me through the message flow? does it actually need to transit through flare before requesting the file picker?
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.
Flow:
- chat-client will send
openFileDialog
request to flare - Flare will send to extension the params, including
canSelectMany
(multiple files),filters
(what file extension types are allowed) - Extension will then handle file selection logic and send back the list of URIs.
- Flare will then send to chat-client the file uri to display in chat.
- does it actually need to transit through flare before requesting the file picker?
- In @yzhangok's design, yes. Flare is also telling client what type of files are supported in file picker as well(step 2)
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Fixed
Show fixed
Hide fixed
.../jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/Browser.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
// Set DropTarget on the browser component and its children | ||
browserInstance.component()?.let { component -> | ||
component.dropTarget = dropTarget | ||
// Also try setting on parent if needed |
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.
?
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 to make sure all chat window is drop area
} | ||
} | ||
|
||
// Set DropTarget on the browser component and its children |
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.
how are the children involved
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.
We want the whole chat window to be "drag & drop zone"
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor() | ||
} | ||
|
||
val chosenFiles = FileChooser.chooseFiles(descriptor, project, null) |
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.
why aren't images from this flow subject to constraints?
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.
Yes, they are now with the new commit.
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.
what about the file size and dimensional limits?
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 validation of the images chosen from file picker is done in language-server
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Fixed
Show fixed
Hide fixed
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Fixed
Show fixed
Hide fixed
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Fixed
Show fixed
Hide fixed
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Fixed
Show fixed
Hide fixed
...munity/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt
Outdated
Show resolved
Hide resolved
...tware/aws/toolkits/jetbrains/services/amazonq/lsp/model/aws/chat/ShowOpenFileDialogParams.kt
Outdated
Show resolved
Hide resolved
...ity/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor() | ||
} | ||
|
||
val chosenFiles = FileChooser.chooseFiles(descriptor, project, null) |
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.
what about the file size and dimensional limits?
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
continue | ||
} | ||
if (img.height > maxDimension) { | ||
errorMessages.add("$fileName: Image must be no more than 8,000px in height.") |
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.
Aren't all these checks also in language-server? Do they need to be duplicated on the client?
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.
Due to the restriction of Jetbrain webveiw, we have to handle the drag&drop natively
val allowedTypes = setOf("jpg", "jpeg", "png", "gif", "webp") | ||
val maxFileSize = 3.75 * 1024 * 1024 // 3.75MB in bytes | ||
val maxDimension = 8000 |
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.
Why do we need this here, can you please add a comment to the flare location that this picks up the values from?
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.
JCEF does not propagate OS-level dragenter, dragOver and drop into DOM. As an alternative, enabling the native drag in JCEF, and let the native handling the drop event, and update the UI through JS bridge.
The same logic of filtering the images are implemented on both language server and JetBrain
…olkits/jetbrains/services/amazonq/lsp/model/ExtendedClientMetadata.kt not set default value Co-authored-by: Richard Li <[email protected]>
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
...ns-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt
Outdated
Show resolved
Hide resolved
We are checking that in language servers |
/retryBuilds |
This reverts commit 83ac4f5.
)" (#5892) This reverts commit 161bf13. Co-authored-by: Bryce Ito <[email protected]>
Types of changes
Description
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.