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

AIConversation: custom actions accept a react node #5999

Merged
merged 6 commits into from
Nov 8, 2024
Merged

Conversation

dbanksdesign
Copy link
Contributor

@dbanksdesign dbanksdesign commented Nov 3, 2024

Description of changes

  • Removing the CSS from react-ai package as it was unused
  • Custom actions accept a ReactNode
  • Aligning the Providers for both default and Amplify UI versions of the component
  • Adding some testing

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 November 3, 2024 06:00
Copy link

changeset-bot bot commented Nov 3, 2024

🦋 Changeset detected

Latest commit: 0c739a3

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

This PR includes changesets to release 15 packages
Name Type
@aws-amplify/ui-react-ai Minor
@aws-amplify/ui Patch
@aws-amplify/ui-react-auth Patch
@aws-amplify/ui-react-core-auth Patch
@aws-amplify/ui-react-core-notifications Patch
@aws-amplify/ui-react-core Patch
@aws-amplify/ui-react-liveness Patch
@aws-amplify/ui-react-native-auth Patch
@aws-amplify/ui-react-native Patch
@aws-amplify/ui-react-notifications Patch
@aws-amplify/ui-react-storage Patch
@aws-amplify/ui-react Patch
@aws-amplify/ui-vue Patch
@aws-amplify/ui-angular Patch
@aws-amplify/ui-react-geo Patch

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

import '@aws-amplify/ui-react-ai/ai-conversation-styles.css';

import { Authenticator, Card } from '@aws-amplify/ui-react';
import { INITIAL_MESSAGES } from '../../constants';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For a lot of the UI customization stuff, we don't actually need a backend to be deployed, we can just pass in static messages to test. Neat!

handleSendMessage={() => {}}
actions={[
{
component: <MdCopyAll />,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Custom actions now are just React nodes

functions: 70,
lines: 70,
statements: 70,
branches: 68,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumping up thresholds because they were too low

messageRenderer,
children,
}: AIConversationProviderProps): JSX.Element {
...rest
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving all these to just rest, we only need the nested configurations like avatars and controls to merge those with the defaults.


function AIConversationBase(props: AIConversationBaseProps): JSX.Element {
return (
<Provider {...props}>
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 don't need to create a separate Provider component anymore

@@ -0,0 +1,184 @@
import React from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Somewhat unrelated, started adding some more tests

@dbanksdesign dbanksdesign changed the title chore: ai cleanup AIConversation: custom actions accept a react node Nov 3, 2024
@dbanksdesign dbanksdesign merged commit 24635cf into main Nov 8, 2024
34 checks passed
@dbanksdesign dbanksdesign deleted the ai-cleanup branch November 8, 2024 17:40
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.

3 participants