Skip to content

Commit

Permalink
Adding AIConversation docs (#8116)
Browse files Browse the repository at this point in the history
* 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
3 people authored Nov 21, 2024
1 parent 20667e9 commit 6e71ea0
Show file tree
Hide file tree
Showing 9 changed files with 532 additions and 18 deletions.
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,8 @@
"ampx",
"autodetection",
"jamba",
"knowledgebases"
"knowledgebases",
"rehype"
],
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],
"patterns": [
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"private": true,
"dependencies": {
"@aws-amplify/amplify-cli-core": "^4.3.9",
"@aws-amplify/ui-react": "^6.3.1",
"@aws-amplify/ui-react": "^6.7.0",
"@aws-amplify/ui-react-ai": "^1.0.0",
"@docsearch/react": "3",
"ajv": "^8.16.0",
"aws-amplify": "^6.0.9",
Expand Down
Binary file added public/images/user.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions src/components/AI/index.tsx
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()
}
];
29 changes: 29 additions & 0 deletions src/components/UIWrapper/UWrapper.tsx
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>
);
};
1 change: 1 addition & 0 deletions src/components/UIWrapper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { UIWrapper } from './UWrapper';
3 changes: 3 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ export const directory = {
{
path: 'src/pages/[platform]/ai/conversation/index.mdx',
children: [
{
path: 'src/pages/[platform]/ai/conversation/ai-conversation/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/history/index.mdx'
},
Expand Down
Loading

0 comments on commit 6e71ea0

Please sign in to comment.