diff --git a/apps/doc-site/stories/components/assistant/Overview.mdx b/apps/doc-site/stories/assistant/Overview.mdx similarity index 81% rename from apps/doc-site/stories/components/assistant/Overview.mdx rename to apps/doc-site/stories/assistant/Overview.mdx index 43eb4a47e..efab30abb 100644 --- a/apps/doc-site/stories/components/assistant/Overview.mdx +++ b/apps/doc-site/stories/assistant/Overview.mdx @@ -1,14 +1,15 @@ -import { Meta, IconGallery, IconItem } from '@storybook/blocks'; -import { AssistantComponentsCards } from "../../common/cards"; +import { IconGallery, IconItem, Meta } from '@storybook/blocks'; +import { AssistantComponentsCards } from '../../common/cards'; - + # AWS IoT SiteWise Assistant -AWS IoT SiteWise Assistant, a generative AI-powered assistant in AWS IoT SiteWise that allows industrial users to gain insights, +AWS IoT SiteWise Assistant, a generative AI-powered assistant in AWS IoT SiteWise that allows industrial users to gain insights, solve problems, and take actions from their operational data and other data sources intuitively using natural language queries. ## Get Started + Please check our user guide about how to setup and enable the AWS IoT Sitewise assistant: [https://docs.aws.amazon.com/iot-sitewise/latest/userguide/assistant-get-started.html](https://docs.aws.amazon.com/iot-sitewise/latest/userguide/assistant-get-started.html) ## Features @@ -21,6 +22,6 @@ For more details, please read [Transforming industrial decision making with AWS - Seamless Integration and Accessibility - Security and Privacy -## AI-aware app kit components +## AI-aware app kit components - \ No newline at end of file + diff --git a/apps/doc-site/stories/components/assistant/components/Chart.mdx b/apps/doc-site/stories/assistant/components/Chart.mdx similarity index 100% rename from apps/doc-site/stories/components/assistant/components/Chart.mdx rename to apps/doc-site/stories/assistant/components/Chart.mdx diff --git a/apps/doc-site/stories/components/assistant/components/Chart.stories.tsx b/apps/doc-site/stories/assistant/components/Chart.stories.tsx similarity index 88% rename from apps/doc-site/stories/components/assistant/components/Chart.stories.tsx rename to apps/doc-site/stories/assistant/components/Chart.stories.tsx index 1d72be117..2e782e1ef 100644 --- a/apps/doc-site/stories/components/assistant/components/Chart.stories.tsx +++ b/apps/doc-site/stories/assistant/components/Chart.stories.tsx @@ -1,8 +1,6 @@ -import { Chart, useAssistant } from '@iot-app-kit/react-components'; -import { - mockSinWaveData, -} from '@iot-app-kit/testing-util'; import { IoTSitewiseAssistantClient } from '@iot-app-kit/core-util'; +import { Chart, useAssistant } from '@iot-app-kit/react-components'; +import { mockSinWaveData } from '@iot-app-kit/testing-util'; import { type Meta, type StoryObj } from '@storybook/react'; import { MockInvokeAssistant } from '../../mockAssistantAPI'; @@ -33,7 +31,7 @@ export const Assistant: Story = { return (
- Please, select an item in the table below: + Please, select an item in the table below: { - if (event.type === 'selection') { - clearAll(); + onAction: (event) => { + if (event.type === 'selection') { + clearAll(); generateSummary({ componentId: componentId1, conversationId: crypto.randomUUID(), @@ -64,11 +62,11 @@ export const Assistant: Story = { 'generate a summary and return the response in markdown format.', }); } - } + }, }} />
- ) + ); }, args: { queries: [mockSinWaveData()], diff --git a/apps/doc-site/stories/components/assistant/components/Chatbot.mdx b/apps/doc-site/stories/assistant/components/Chatbot.mdx similarity index 100% rename from apps/doc-site/stories/components/assistant/components/Chatbot.mdx rename to apps/doc-site/stories/assistant/components/Chatbot.mdx diff --git a/apps/doc-site/stories/components/assistant/components/Chatbot.stories.tsx b/apps/doc-site/stories/assistant/components/Chatbot.stories.tsx similarity index 80% rename from apps/doc-site/stories/components/assistant/components/Chatbot.stories.tsx rename to apps/doc-site/stories/assistant/components/Chatbot.stories.tsx index 60100dee9..19e2ff356 100644 --- a/apps/doc-site/stories/components/assistant/components/Chatbot.stories.tsx +++ b/apps/doc-site/stories/assistant/components/Chatbot.stories.tsx @@ -1,10 +1,14 @@ /* eslint-disable */ // @ts-nocheck -import { useEffect } from 'react'; -import { ComponentMeta, ComponentStory } from '@storybook/react'; -import { AssistantChatbot, useAssistant, MessageType } from '@iot-app-kit/react-components'; -import { IoTSitewiseAssistantClient } from '@iot-app-kit/core-util'; import '@cloudscape-design/global-styles/index.css'; +import { IoTSitewiseAssistantClient } from '@iot-app-kit/core-util'; +import { + AssistantChatbot, + MessageType, + useAssistant, +} from '@iot-app-kit/react-components'; +import { ComponentMeta, ComponentStory } from '@storybook/react'; +import { useEffect } from 'react'; import { MockInvokeAssistant } from '../../mockAssistantAPI'; export default { @@ -30,10 +34,7 @@ const client = new IoTSitewiseAssistantClient({ defaultContext: '', }); -export const Standard: ComponentStory< - typeof AssistantChatbot -> = () => { - +export const Standard: ComponentStory = () => { const { messages, invokeAssistant, clearAll, setMessages } = useAssistant({ assistantClient: client, }); @@ -42,8 +43,7 @@ export const Standard: ComponentStory< clearAll(); setMessages([ { - content: - 'Who are you ?', + content: 'Who are you ?', sender: 'user', type: MessageType.TEXT, id: crypto.randomUUID(), @@ -83,14 +83,10 @@ export const Standard: ComponentStory< ); }; -export const LoadingState: ComponentStory< - typeof AssistantChatbot -> = () => { - +export const LoadingState: ComponentStory = () => { const messages = [ { - content: - 'Processing assistant response, please wait..', + content: 'Processing assistant response, please wait..', sender: 'assistant', type: MessageType.TEXT, id: crypto.randomUUID(), @@ -105,7 +101,7 @@ export const LoadingState: ComponentStory< loading: true, }, ]; - + return (
= () => { - +export const ErrorState: ComponentStory = () => { const messages = [ { - content: - 'Processing assistant response, please wait..', + content: 'Processing assistant response, please wait..', sender: 'assistant', type: MessageType.TEXT, id: crypto.randomUUID(), loading: true, }, { - content: 'You do not have the required permissions to use the Sitewise Assistant. Please contact your administrator to request access.', + content: + 'You do not have the required permissions to use the Sitewise Assistant. Please contact your administrator to request access.', sender: 'assistant', type: MessageType.ERROR, id: crypto.randomUUID(), @@ -140,10 +133,11 @@ export const ErrorState: ComponentStory< payload: { accessDeniedException: { name: 'accessDeniedException', - message: 'You do not have the required permissions to use the Sitewise Assistant. Please contact your administrator to request access.', - } - } - } + message: + 'You do not have the required permissions to use the Sitewise Assistant. Please contact your administrator to request access.', + }, + }, + }, ]; return ( @@ -156,4 +150,4 @@ export const ErrorState: ComponentStory< />
); -}; \ No newline at end of file +}; diff --git a/apps/doc-site/stories/components/assistant/components/Gauge.mdx b/apps/doc-site/stories/assistant/components/Gauge.mdx similarity index 100% rename from apps/doc-site/stories/components/assistant/components/Gauge.mdx rename to apps/doc-site/stories/assistant/components/Gauge.mdx diff --git a/apps/doc-site/stories/components/assistant/components/Gauge.stories.tsx b/apps/doc-site/stories/assistant/components/Gauge.stories.tsx similarity index 92% rename from apps/doc-site/stories/components/assistant/components/Gauge.stories.tsx rename to apps/doc-site/stories/assistant/components/Gauge.stories.tsx index 56eab2959..1b53d95cf 100644 --- a/apps/doc-site/stories/components/assistant/components/Gauge.stories.tsx +++ b/apps/doc-site/stories/assistant/components/Gauge.stories.tsx @@ -1,11 +1,9 @@ import { useEffect } from 'react'; // eslint-disable-next-line import/default -import { Gauge, useAssistant} from '@iot-app-kit/react-components'; -import { - mockSinWaveDataWithQuality, -} from '@iot-app-kit/testing-util'; -import { type Meta, type StoryObj } from '@storybook/react'; import { IoTSitewiseAssistantClient } from '@iot-app-kit/core-util'; +import { Gauge, useAssistant } from '@iot-app-kit/react-components'; +import { mockSinWaveDataWithQuality } from '@iot-app-kit/testing-util'; +import { type Meta, type StoryObj } from '@storybook/react'; import { MockInvokeAssistant } from '../../mockAssistantAPI'; // More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction @@ -52,7 +50,7 @@ export const Assistant: Story = { margin: '0 auto', }} > - - @@ -122,4 +126,4 @@ export const Alarm: Story = { secondaryFontSize: 12, }, }, -}; \ No newline at end of file +}; diff --git a/apps/doc-site/stories/components/assistant/components/Table.mdx b/apps/doc-site/stories/assistant/components/Table.mdx similarity index 100% rename from apps/doc-site/stories/components/assistant/components/Table.mdx rename to apps/doc-site/stories/assistant/components/Table.mdx diff --git a/apps/doc-site/stories/components/assistant/components/Table.stories.tsx b/apps/doc-site/stories/assistant/components/Table.stories.tsx similarity index 80% rename from apps/doc-site/stories/components/assistant/components/Table.stories.tsx rename to apps/doc-site/stories/assistant/components/Table.stories.tsx index 2e177643e..426ddba0d 100644 --- a/apps/doc-site/stories/components/assistant/components/Table.stories.tsx +++ b/apps/doc-site/stories/assistant/components/Table.stories.tsx @@ -1,10 +1,14 @@ -import { useEffect } from 'react'; -import { Table, useAssistant, AssistantChatbot } from '@iot-app-kit/react-components'; import Button from '@cloudscape-design/components/button'; -import { mockAlarmData } from '@iot-app-kit/testing-util'; import { DATA_TYPE } from '@iot-app-kit/core'; import { IoTSitewiseAssistantClient } from '@iot-app-kit/core-util'; +import { + AssistantChatbot, + Table, + useAssistant, +} from '@iot-app-kit/react-components'; +import { mockAlarmData } from '@iot-app-kit/testing-util'; import { type Meta, type StoryObj } from '@storybook/react'; +import { useEffect } from 'react'; import { MockInvokeAssistant } from '../../mockAssistantAPI'; const meta: Meta = { @@ -71,24 +75,28 @@ export const Assistant: Story = { componentId, conversationId: 'mockConversationId', target: 'dashboard', - onAction:(event) => { + onAction: (event) => { if (event.type === 'selection') { console.log('onAction', event); } - } + }, }} />
- +
{messages.length > 0 ? ( {}} /> - ): null } + ) : null} - ) + ); }, args: { queries: [mockAlarmData()],