Skip to content
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

feat(ai-conversation): add allowAttachments prop #5802

Merged
merged 10 commits into from
Sep 30, 2024

Conversation

dbanksdesign
Copy link
Contributor

Description of changes

Adds allowAttachment prop to AIConversation component to let customers choose if they want the chatbot to have attachments or not.

Issue #, if available

Description of how you validated changes

Checklist

  • Have read the Pull Request Guidelines
  • PR description included
  • yarn test passes and tests are updated/added
  • PR title and commit messages follow conventional commit syntax
  • If this change should result in a version bump, changeset added (This can be done after creating the PR.) This does not apply to changes made to docs, e2e, examples, or other private packages.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dbanksdesign dbanksdesign requested a review from a team as a code owner September 17, 2024 04:54
Copy link

changeset-bot bot commented Sep 17, 2024

🦋 Changeset detected

Latest commit: e7ed523

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/ui-react-ai Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -72,6 +73,7 @@ function AIConversationBase({
...avatars,
},
isLoading,
allowAttachments,
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to add this on the createAIConversation as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Was this comment resolved?

thaddmt
thaddmt previously approved these changes Sep 19, 2024
* Will conditionally render the DropZone if allowAttachments
* is true
*/
const FormWrapper = ({
Copy link
Member

Choose a reason for hiding this comment

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

A bit confused on whether this addition is creating deltas between the behaviors of the default AIConversation and the Amplify UI version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, so the Amplify UI version uses the DropZone component that wraps the form so users can drag and drop a file onto the form and it gets attached (in addition to a button which triggers the file picker). So allowAttachments will affect bot the default component and the Amplify UI one.

Copy link
Member

Choose a reason for hiding this comment

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

Do we have drop event handlers configured in the default AiConversation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we do now

thaddmt
thaddmt previously approved these changes Sep 30, 2024
@@ -113,7 +113,6 @@ exports[`@aws-amplify/ui-react/internal exports should match snapshot 1`] = `
"useAuth",
"useColorMode",
"useDeprecationWarning",
"useDropZone",
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't this be a breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TECHNICALLY yes and no. It is from our /internal export path, which, as the name suggests is for internal use. I can re-export it from here too just to make sure though

@@ -44,6 +44,8 @@ export {
useTimeout,
useDataState,
DataState,
useDropZone,
Copy link
Contributor

@reesscot reesscot Sep 30, 2024

Choose a reason for hiding this comment

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

We're doing this to prevent a direct dependency on the react package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct


```jsx
<AIConversation
allowAttachments
Copy link
Contributor

Choose a reason for hiding this comment

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

Mention that to keep current behavior customers need to add this prop

@dbanksdesign dbanksdesign merged commit 8b4a28b into main Sep 30, 2024
33 checks passed
@dbanksdesign dbanksdesign deleted the ai-allow-attachments branch September 30, 2024 22:13
@github-actions github-actions bot mentioned this pull request Sep 30, 2024
calebpollman pushed a commit that referenced this pull request Oct 1, 2024
Co-authored-by: Scott Rees <6165315+reesscot@users.noreply.github.com>
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.

4 participants