-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AIConversation: custom actions accept a react node (#5999)
- Loading branch information
1 parent
7073a65
commit 24635cf
Showing
23 changed files
with
315 additions
and
291 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
"@aws-amplify/ui-react-ai": minor | ||
"@aws-amplify/ui": patch | ||
--- | ||
|
||
chore: ai cleanup | ||
|
||
```jsx | ||
<AIConversation | ||
messages={messages} | ||
handleSendMessage={handleSendMessage} | ||
actions={[ | ||
{ | ||
component: <MdCopyAll />, | ||
handler: (message) => {}, | ||
} | ||
]} | ||
/> | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
47 changes: 47 additions & 0 deletions
47
examples/next/pages/ui/components/ai/ai-conversation/custom-actions/index.page.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { MdCopyAll } from 'react-icons/md'; | ||
import { AIConversation } from '@aws-amplify/ui-react-ai'; | ||
import '@aws-amplify/ui-react/styles.css'; | ||
|
||
import { Authenticator, Card } from '@aws-amplify/ui-react'; | ||
import { INITIAL_MESSAGES } from '../../constants'; | ||
|
||
function Chat() { | ||
return ( | ||
<Card variation="outlined" width="50%" height="300px" margin="0 auto"> | ||
<AIConversation | ||
messages={INITIAL_MESSAGES} | ||
handleSendMessage={() => {}} | ||
actions={[ | ||
{ | ||
component: <MdCopyAll />, | ||
handler: (message) => console.log(message), | ||
}, | ||
{ | ||
component: <MdCopyAll />, | ||
handler: (message) => console.log(message), | ||
}, | ||
]} | ||
allowAttachments | ||
suggestedPrompts={[ | ||
{ | ||
inputText: 'hello', | ||
component: 'hello', | ||
}, | ||
{ | ||
inputText: 'how are you?', | ||
component: 'how are you?', | ||
}, | ||
]} | ||
variant="bubble" | ||
/> | ||
</Card> | ||
); | ||
} | ||
|
||
export default function Example() { | ||
return ( | ||
<Authenticator> | ||
<Chat /> | ||
</Authenticator> | ||
); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.