-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding AIConversation docs * fixing build error * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: dindjarinjs <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * Update src/pages/[platform]/ai/conversation/ai-conversation/index.mdx Co-authored-by: Ian Saultz <[email protected]> * updats * chore: bump ui-react lib --------- Co-authored-by: dindjarinjs <[email protected]> Co-authored-by: Ian Saultz <[email protected]>
- Loading branch information
1 parent
20667e9
commit 6e71ea0
Showing
9 changed files
with
532 additions
and
18 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,64 @@ | ||
import { Avatar } from '@aws-amplify/ui-react'; | ||
import { ConversationMessage } from '@aws-amplify/ui-react-ai'; | ||
import { AmplifyLogo } from '@/components/GlobalNav/components/icons'; | ||
|
||
export const UserAvatar = () => { | ||
return <Avatar src="/images/user.jpg" />; | ||
}; | ||
|
||
export const AssistantAvatar = () => { | ||
return ( | ||
<Avatar backgroundColor={'primary.20'}> | ||
<AmplifyLogo /> | ||
</Avatar> | ||
); | ||
}; | ||
|
||
export const MESSAGES: ConversationMessage[] = [ | ||
{ | ||
conversationId: 'foobar', | ||
id: '1', | ||
content: [{ text: 'Hello' }], | ||
role: 'user' as const, | ||
createdAt: new Date(2023, 4, 21, 15, 23).toISOString() | ||
}, | ||
{ | ||
conversationId: 'foobar', | ||
id: '2', | ||
content: [ | ||
{ | ||
text: 'Hello! I am your virtual assistant how may I help you?' | ||
} | ||
], | ||
role: 'assistant' as const, | ||
createdAt: new Date(2023, 4, 21, 15, 24).toISOString() | ||
} | ||
]; | ||
|
||
export const MESSAGES_RESPONSE_COMPONENTS: ConversationMessage[] = [ | ||
{ | ||
conversationId: 'foobar', | ||
id: '1', | ||
content: [{ text: 'Whats the weather in San Jose?' }], | ||
role: 'user' as const, | ||
createdAt: new Date(2023, 4, 21, 15, 23).toISOString() | ||
}, | ||
{ | ||
conversationId: 'foobar', | ||
id: '2', | ||
content: [ | ||
{ | ||
text: 'Let me get the weather for San Jose for you.' | ||
}, | ||
{ | ||
toolUse: { | ||
name: 'AMPLIFY_UI_WeatherCard', | ||
input: { city: 'San Jose' }, | ||
toolUseId: '1234' | ||
} | ||
} | ||
], | ||
role: 'assistant' as const, | ||
createdAt: new Date(2023, 4, 21, 15, 24).toISOString() | ||
} | ||
]; |
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,29 @@ | ||
import { | ||
createTheme, | ||
defaultDarkModeOverride, | ||
ThemeProvider, | ||
View | ||
} from '@aws-amplify/ui-react'; | ||
import * as React from 'react'; | ||
import { LayoutContext } from '../Layout'; | ||
|
||
const theme = createTheme({ | ||
name: 'default-amplify-ui-theme', | ||
overrides: [defaultDarkModeOverride] | ||
}); | ||
|
||
export const UIWrapper = ({ children }: React.PropsWithChildren) => { | ||
const { colorMode } = React.useContext(LayoutContext); | ||
|
||
return ( | ||
<ThemeProvider theme={theme} colorMode={colorMode}> | ||
<View | ||
borderRadius="small" | ||
padding="large" | ||
boxShadow={`0 0 0 2px ${theme.tokens.colors.neutral[20]}`} | ||
> | ||
{children} | ||
</View> | ||
</ThemeProvider> | ||
); | ||
}; |
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 @@ | ||
export { UIWrapper } from './UWrapper'; |
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
Oops, something went wrong.