-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ai): add timestamp function to displayText (#5782)
* chore(ai): add timestamp function to displayText * Create heavy-bottles-poke.md * move DisplayTextProvider below static providers, revert context exports * add types git date message override
- Loading branch information
Showing
12 changed files
with
129 additions
and
44 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,5 @@ | ||
--- | ||
"@aws-amplify/ui-react-ai": patch | ||
--- | ||
|
||
chore(ai): add timestamp function to displayText |
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
7 changes: 7 additions & 0 deletions
7
.../react-ai/src/components/AIConversation/__tests__/__snapshots__/displayText.test.tsx.snap
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,7 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`displayText should match snapshot 1`] = ` | ||
[ | ||
"getMessageTimestampText", | ||
] | ||
`; |
11 changes: 11 additions & 0 deletions
11
packages/react-ai/src/components/AIConversation/__tests__/displayText.test.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,11 @@ | ||
import { defaultAIConversationDisplayTextEn } from '../displayText'; | ||
|
||
describe('displayText', () => { | ||
it('should match snapshot', () => { | ||
const sortedDisplayText = Object.keys( | ||
defaultAIConversationDisplayTextEn | ||
).sort(); | ||
|
||
expect(sortedDisplayText).toMatchSnapshot(); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/react-ai/src/components/AIConversation/context/DisplayTextContext.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,14 @@ | ||
import { createContextUtilities } from '@aws-amplify/ui-react-core'; | ||
import { | ||
ConversationDisplayText, | ||
defaultAIConversationDisplayTextEn, | ||
} from '../displayText'; | ||
|
||
export const { | ||
ConversationDisplayTextContext, | ||
ConversationDisplayTextProvider, | ||
useConversationDisplayText, | ||
} = createContextUtilities<Required<ConversationDisplayText>>({ | ||
contextName: 'ConversationDisplayText', | ||
defaultValue: defaultAIConversationDisplayTextEn, | ||
}); |
38 changes: 28 additions & 10 deletions
38
packages/react-ai/src/components/AIConversation/context/index.ts
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 |
---|---|---|
@@ -1,17 +1,35 @@ | ||
import { ActionsContext } from './ActionsContext'; | ||
import { AvatarsContext } from './AvatarsContext'; | ||
import { ConversationInputContext } from './ConversationInputContext'; | ||
import { MessagesContext, RoleContext } from './MessagesContext'; | ||
import { SuggestedPromptsContext } from './SuggestedPromptsContext'; | ||
import { MessageVariantContext } from './MessageVariantContext'; | ||
|
||
export { ActionsContext, ActionsProvider } from './ActionsContext'; | ||
export { AvatarsContext, AvatarsProvider } from './AvatarsContext'; | ||
export { | ||
ActionsContext, | ||
AvatarsContext, | ||
ConversationInputContext, | ||
ConversationInput, | ||
ConversationInputContextProvider, | ||
} from './ConversationInputContext'; | ||
export { | ||
MessagesContext, | ||
RoleContext, | ||
MessagesProvider, | ||
} from './MessagesContext'; | ||
export { | ||
SuggestedPromptsContext, | ||
SuggestedPromptProvider, | ||
} from './SuggestedPromptsContext'; | ||
export { | ||
MessageVariantContext, | ||
}; | ||
MessageVariantProvider, | ||
} from './MessageVariantContext'; | ||
export { | ||
ConversationDisplayTextContext, | ||
useConversationDisplayText, | ||
ConversationDisplayTextProvider, | ||
} from './DisplayTextContext'; | ||
export { | ||
ControlsContext, | ||
ControlsContextProps, | ||
ControlsProvider, | ||
} from './ControlsContext'; | ||
export { LoadingContextProvider } from './LoadingContext'; | ||
export { ResponseComponentsProvider } from './ResponseComponentsContext'; | ||
export { SendMessageContextProvider } from './SendMessageContext'; | ||
|
||
export * from './elements'; |
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
7 changes: 4 additions & 3 deletions
7
packages/react-ai/src/components/AIConversation/displayText.ts
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