@patternfly/chatbot 2.2.1 → 6.3.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +4 -0
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +7 -1
- package/dist/cjs/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +23 -0
- package/dist/cjs/Message/Message.d.ts +17 -1
- package/dist/cjs/Message/Message.js +53 -34
- package/dist/cjs/Message/Message.test.js +52 -0
- package/dist/cjs/Message/MessageInput.d.ts +18 -0
- package/dist/cjs/Message/MessageInput.js +34 -0
- package/dist/cjs/MessageBar/MicrophoneButton.js +1 -1
- package/dist/cjs/MessageBox/MessageBox.js +5 -5
- package/dist/cjs/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/cjs/SourcesCard/SourcesCard.js +16 -10
- package/dist/cjs/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/cjs/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/cjs/tracking/console_tracking_provider.js +22 -15
- package/dist/cjs/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/posthog_tracking_provider.js +21 -12
- package/dist/cjs/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/cjs/tracking/segment_tracking_provider.js +21 -12
- package/dist/cjs/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/cjs/tracking/trackingProviderProxy.js +2 -2
- package/dist/cjs/tracking/tracking_api.d.ts +1 -1
- package/dist/cjs/tracking/tracking_registry.js +46 -12
- package/dist/cjs/tracking/tracking_spi.d.ts +15 -5
- package/dist/cjs/tracking/tracking_spi.js +9 -0
- package/dist/cjs/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/cjs/tracking/umami_tracking_provider.js +66 -22
- package/dist/css/main.css +7 -7
- package/dist/css/main.css.map +1 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.d.ts +4 -0
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.js +7 -1
- package/dist/esm/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.js +23 -0
- package/dist/esm/Message/Message.d.ts +17 -1
- package/dist/esm/Message/Message.js +53 -34
- package/dist/esm/Message/Message.test.js +52 -0
- package/dist/esm/Message/MessageInput.d.ts +18 -0
- package/dist/esm/Message/MessageInput.js +29 -0
- package/dist/esm/MessageBar/MicrophoneButton.js +1 -1
- package/dist/esm/MessageBox/MessageBox.js +5 -5
- package/dist/esm/SourcesCard/SourcesCard.d.ts +7 -1
- package/dist/esm/SourcesCard/SourcesCard.js +17 -11
- package/dist/esm/SourcesCard/SourcesCard.test.js +25 -15
- package/dist/esm/tracking/console_tracking_provider.d.ts +4 -5
- package/dist/esm/tracking/console_tracking_provider.js +22 -15
- package/dist/esm/tracking/posthog_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/posthog_tracking_provider.js +21 -12
- package/dist/esm/tracking/segment_tracking_provider.d.ts +2 -2
- package/dist/esm/tracking/segment_tracking_provider.js +21 -12
- package/dist/esm/tracking/trackingProviderProxy.d.ts +1 -1
- package/dist/esm/tracking/trackingProviderProxy.js +2 -2
- package/dist/esm/tracking/tracking_api.d.ts +1 -1
- package/dist/esm/tracking/tracking_registry.js +46 -12
- package/dist/esm/tracking/tracking_spi.d.ts +15 -5
- package/dist/esm/tracking/tracking_spi.js +8 -1
- package/dist/esm/tracking/umami_tracking_provider.d.ts +6 -2
- package/dist/esm/tracking/umami_tracking_provider.js +66 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Analytics/Analytics.md +18 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/BotMessage.tsx +74 -104
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/FileDetailsLabel.tsx +48 -37
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx +10 -0
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithSources.tsx +51 -14
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/Messages.md +3 -1
- package/patternfly-docs/content/extensions/chatbot/examples/Messages/UserMessage.tsx +80 -104
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawer.tsx +35 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerResizable.tsx +13 -2
- package/patternfly-docs/content/extensions/chatbot/examples/UI/UI.md +1 -1
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Chatbot.tsx +6 -3
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachment.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotAttachmentMenu.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/ChatbotInDrawer.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedChatbot.tsx +2 -0
- package/patternfly-docs/content/extensions/chatbot/examples/demos/EmbeddedComparisonChatbot.tsx +62 -57
- package/patternfly-docs/content/extensions/chatbot/examples/demos/Feedback.tsx +2 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.test.tsx +53 -0
- package/src/ChatbotConversationHistoryNav/ChatbotConversationHistoryNav.tsx +14 -0
- package/src/Message/Message.scss +4 -0
- package/src/Message/Message.test.tsx +62 -0
- package/src/Message/Message.tsx +111 -53
- package/src/Message/MessageInput.tsx +59 -0
- package/src/MessageBar/MicrophoneButton.tsx +1 -1
- package/src/MessageBox/MessageBox.tsx +5 -5
- package/src/SourcesCard/SourcesCard.scss +3 -7
- package/src/SourcesCard/SourcesCard.test.tsx +30 -22
- package/src/SourcesCard/SourcesCard.tsx +54 -12
- package/src/tracking/console_tracking_provider.ts +21 -17
- package/src/tracking/posthog_tracking_provider.ts +20 -13
- package/src/tracking/segment_tracking_provider.ts +20 -13
- package/src/tracking/trackingProviderProxy.ts +2 -2
- package/src/tracking/tracking_api.ts +1 -1
- package/src/tracking/tracking_registry.ts +46 -13
- package/src/tracking/tracking_spi.ts +18 -7
- package/src/tracking/umami_tracking_provider.ts +76 -20
- package/src/SourcesCard/__snapshots__/SourcesCard.test.tsx.snap +0 -34
@@ -2,35 +2,44 @@ import React from 'react';
|
|
2
2
|
import Message from '@patternfly/chatbot/dist/dynamic/Message';
|
3
3
|
import patternflyAvatar from './patternfly_avatar.jpg';
|
4
4
|
import squareImg from './PF-social-color-square.svg';
|
5
|
-
import {
|
5
|
+
import {
|
6
|
+
AlertActionLink,
|
7
|
+
MenuToggle,
|
8
|
+
MenuToggleElement,
|
9
|
+
Select,
|
10
|
+
SelectList,
|
11
|
+
SelectOption
|
12
|
+
} from '@patternfly/react-core';
|
6
13
|
|
7
14
|
export const BotMessageExample: React.FunctionComponent = () => {
|
8
|
-
const [variant, setVariant] = React.useState('
|
15
|
+
const [variant, setVariant] = React.useState<string>('Code');
|
16
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
17
|
+
const [selected, setSelected] = React.useState<string>('Message content type');
|
9
18
|
|
10
19
|
/* eslint-disable indent */
|
11
20
|
const renderContent = () => {
|
12
21
|
switch (variant) {
|
13
|
-
case '
|
22
|
+
case 'Code':
|
14
23
|
return code;
|
15
|
-
case '
|
24
|
+
case 'Heading':
|
16
25
|
return heading;
|
17
|
-
case '
|
26
|
+
case 'Emphasis':
|
18
27
|
return emphasis;
|
19
|
-
case '
|
28
|
+
case 'Block quotes':
|
20
29
|
return blockQuotes;
|
21
|
-
case '
|
30
|
+
case 'Ordered list':
|
22
31
|
return orderedList;
|
23
|
-
case '
|
32
|
+
case 'Unordered list':
|
24
33
|
return unorderedList;
|
25
|
-
case '
|
34
|
+
case 'More complex list':
|
26
35
|
return moreComplexList;
|
27
|
-
case '
|
36
|
+
case 'Inline code':
|
28
37
|
return inlineCode;
|
29
|
-
case '
|
38
|
+
case 'Link':
|
30
39
|
return link;
|
31
|
-
case '
|
40
|
+
case 'Table':
|
32
41
|
return table;
|
33
|
-
case '
|
42
|
+
case 'Image':
|
34
43
|
return image;
|
35
44
|
default:
|
36
45
|
return;
|
@@ -155,6 +164,32 @@ _Italic text, formatted with single underscores_
|
|
155
164
|
)
|
156
165
|
};
|
157
166
|
|
167
|
+
const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {
|
168
|
+
setVariant(value);
|
169
|
+
setSelected(value as string);
|
170
|
+
setIsOpen(false);
|
171
|
+
};
|
172
|
+
|
173
|
+
const onToggleClick = () => {
|
174
|
+
setIsOpen(!isOpen);
|
175
|
+
};
|
176
|
+
|
177
|
+
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
178
|
+
<MenuToggle
|
179
|
+
className="pf-v6-u-mb-md"
|
180
|
+
ref={toggleRef}
|
181
|
+
onClick={onToggleClick}
|
182
|
+
isExpanded={isOpen}
|
183
|
+
style={
|
184
|
+
{
|
185
|
+
width: '200px'
|
186
|
+
} as React.CSSProperties
|
187
|
+
}
|
188
|
+
>
|
189
|
+
{selected}
|
190
|
+
</MenuToggle>
|
191
|
+
);
|
192
|
+
|
158
193
|
return (
|
159
194
|
<>
|
160
195
|
<Message
|
@@ -193,104 +228,39 @@ _Italic text, formatted with single underscores_
|
|
193
228
|
timestamp="1 hour ago"
|
194
229
|
/>
|
195
230
|
<Message name="Bot" role="bot" avatar={patternflyAvatar} content="Example content" isLoading />
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
<
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
<
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
<Radio
|
221
|
-
isChecked={variant === 'blockQuotes'}
|
222
|
-
onChange={() => setVariant('blockQuotes')}
|
223
|
-
name="bot-message-type"
|
224
|
-
label="Block quote"
|
225
|
-
id="block-quotes"
|
226
|
-
/>
|
227
|
-
<Radio
|
228
|
-
isChecked={variant === 'emphasis'}
|
229
|
-
onChange={() => setVariant('emphasis')}
|
230
|
-
name="bot-message-type"
|
231
|
-
label="Emphasis"
|
232
|
-
id="emphasis"
|
233
|
-
/>
|
234
|
-
<Radio
|
235
|
-
isChecked={variant === 'link'}
|
236
|
-
onChange={() => setVariant('link')}
|
237
|
-
name="bot-message-type"
|
238
|
-
label="Link"
|
239
|
-
id="link"
|
240
|
-
/>
|
241
|
-
<Radio
|
242
|
-
isChecked={variant === 'unorderedList'}
|
243
|
-
onChange={() => setVariant('unorderedList')}
|
244
|
-
name="bot-message-type"
|
245
|
-
label="Unordered list"
|
246
|
-
id="unordered-list"
|
247
|
-
/>
|
248
|
-
<Radio
|
249
|
-
isChecked={variant === 'orderedList'}
|
250
|
-
onChange={() => setVariant('orderedList')}
|
251
|
-
name="bot-message-type"
|
252
|
-
label="Ordered list"
|
253
|
-
id="ordered-list"
|
254
|
-
/>
|
255
|
-
<Radio
|
256
|
-
isChecked={variant === 'moreComplexList'}
|
257
|
-
onChange={() => setVariant('moreComplexList')}
|
258
|
-
name="bot-message-type"
|
259
|
-
label="More complex list"
|
260
|
-
id="more-complex-list"
|
261
|
-
/>
|
262
|
-
<Radio
|
263
|
-
isChecked={variant === 'table'}
|
264
|
-
onChange={() => setVariant('table')}
|
265
|
-
name="bot-message-type"
|
266
|
-
label="Table"
|
267
|
-
id="table"
|
268
|
-
/>
|
269
|
-
<Radio
|
270
|
-
isChecked={variant === 'image'}
|
271
|
-
onChange={() => setVariant('image')}
|
272
|
-
name="bot-message-type"
|
273
|
-
label="Image"
|
274
|
-
id="image"
|
275
|
-
/>
|
276
|
-
<Radio
|
277
|
-
isChecked={variant === 'error'}
|
278
|
-
onChange={() => setVariant('error')}
|
279
|
-
name="bot-message-error"
|
280
|
-
label="Error"
|
281
|
-
id="error"
|
282
|
-
/>
|
283
|
-
</FormGroup>
|
284
|
-
</Form>
|
231
|
+
<Select
|
232
|
+
id="single-select"
|
233
|
+
isOpen={isOpen}
|
234
|
+
selected={selected}
|
235
|
+
onSelect={onSelect}
|
236
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
237
|
+
toggle={toggle}
|
238
|
+
shouldFocusToggleOnSelect
|
239
|
+
>
|
240
|
+
<SelectList>
|
241
|
+
<SelectOption value="Code">Code</SelectOption>
|
242
|
+
<SelectOption value="Inline code">Inline code</SelectOption>
|
243
|
+
<SelectOption value="Heading">Heading</SelectOption>
|
244
|
+
<SelectOption value="Block quotes">Block quotes</SelectOption>
|
245
|
+
<SelectOption value="Emphasis">Emphasis</SelectOption>
|
246
|
+
<SelectOption value="Link">Link</SelectOption>
|
247
|
+
<SelectOption value="Unordered list">Unordered list</SelectOption>
|
248
|
+
<SelectOption value="Ordered list">Ordered list</SelectOption>
|
249
|
+
<SelectOption value="More complex list">More complex list</SelectOption>
|
250
|
+
<SelectOption value="Table">Table</SelectOption>
|
251
|
+
<SelectOption value="Image">Image</SelectOption>
|
252
|
+
<SelectOption value="Error">Error</SelectOption>
|
253
|
+
</SelectList>
|
254
|
+
</Select>
|
285
255
|
<Message
|
286
256
|
name="Bot"
|
287
257
|
role="bot"
|
288
258
|
avatar={patternflyAvatar}
|
289
259
|
content={renderContent()}
|
290
260
|
tableProps={
|
291
|
-
variant === '
|
261
|
+
variant === 'Table' ? { 'aria-label': 'App information and user roles for bot messages' } : undefined
|
292
262
|
}
|
293
|
-
error={variant === '
|
263
|
+
error={variant === 'Error' ? error : undefined}
|
294
264
|
/>
|
295
265
|
</>
|
296
266
|
);
|
@@ -1,52 +1,63 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import FileDetailsLabel from '@patternfly/chatbot/dist/dynamic/FileDetailsLabel';
|
3
|
-
import {
|
4
|
-
import { FormGroup } from '@patternfly/react-core/dist/dynamic/FormGroup';
|
5
|
-
import { Stack } from '@patternfly/react-core/dist/dynamic/Stack';
|
3
|
+
import { Stack, MenuToggle, MenuToggleElement, Select, SelectList, SelectOption } from '@patternfly/react-core';
|
6
4
|
|
7
5
|
export const FileDetailsLabelExample: React.FunctionComponent = () => {
|
8
|
-
const [variant, setVariant] = React.useState('plain');
|
6
|
+
const [variant, setVariant] = React.useState<string>('plain');
|
7
|
+
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
8
|
+
const [selected, setSelected] = React.useState<string>('Variant');
|
9
|
+
|
10
|
+
const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {
|
11
|
+
setVariant(value);
|
12
|
+
setSelected(value as string);
|
13
|
+
setIsOpen(false);
|
14
|
+
};
|
15
|
+
|
16
|
+
const onToggleClick = () => {
|
17
|
+
setIsOpen(!isOpen);
|
18
|
+
};
|
19
|
+
|
20
|
+
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
21
|
+
<MenuToggle
|
22
|
+
ref={toggleRef}
|
23
|
+
onClick={onToggleClick}
|
24
|
+
isExpanded={isOpen}
|
25
|
+
style={
|
26
|
+
{
|
27
|
+
width: '200px'
|
28
|
+
} as React.CSSProperties
|
29
|
+
}
|
30
|
+
>
|
31
|
+
{selected}
|
32
|
+
</MenuToggle>
|
33
|
+
);
|
9
34
|
|
10
35
|
return (
|
11
36
|
<Stack hasGutter>
|
12
|
-
<
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
isChecked={variant === 'clickable'}
|
29
|
-
onChange={() => setVariant('clickable')}
|
30
|
-
name="basic-inline-radio"
|
31
|
-
label="Clickable"
|
32
|
-
id="clickable"
|
33
|
-
/>
|
34
|
-
<Radio
|
35
|
-
isChecked={variant === 'loading'}
|
36
|
-
onChange={() => setVariant('loading')}
|
37
|
-
name="basic-inline-radio"
|
38
|
-
label="Loading"
|
39
|
-
id="loading"
|
40
|
-
/>
|
41
|
-
</FormGroup>
|
37
|
+
<Select
|
38
|
+
id="single-select"
|
39
|
+
isOpen={isOpen}
|
40
|
+
selected={selected}
|
41
|
+
onSelect={onSelect}
|
42
|
+
onOpenChange={(isOpen) => setIsOpen(isOpen)}
|
43
|
+
toggle={toggle}
|
44
|
+
shouldFocusToggleOnSelect
|
45
|
+
>
|
46
|
+
<SelectList>
|
47
|
+
<SelectOption value="Plain">Plain</SelectOption>
|
48
|
+
<SelectOption value="Closeable">Closeable</SelectOption>
|
49
|
+
<SelectOption value="Clickable">Clickable</SelectOption>
|
50
|
+
<SelectOption value="Loading">Loading</SelectOption>
|
51
|
+
</SelectList>
|
52
|
+
</Select>
|
42
53
|
<div className="pf-chatbot__file-details-example">
|
43
54
|
<FileDetailsLabel
|
44
55
|
fileName="auth-operator.yml"
|
45
56
|
// eslint-disable-next-line no-console
|
46
|
-
{...(variant === '
|
57
|
+
{...(variant === 'Closeable' && { onClose: () => console.log('clicked close button!') })}
|
47
58
|
// eslint-disable-next-line no-console
|
48
|
-
{...(variant === '
|
49
|
-
{...(variant === '
|
59
|
+
{...(variant === 'Clickable' && { onClick: () => console.log('clicked entire button!') })}
|
60
|
+
{...(variant === 'Loading' && { isLoading: true })}
|
50
61
|
/>
|
51
62
|
</div>
|
52
63
|
</Stack>
|
package/patternfly-docs/content/extensions/chatbot/examples/Messages/MessageWithQuickResponses.tsx
CHANGED
@@ -40,5 +40,15 @@ export const MessageWithQuickResponsesExample: React.FunctionComponent = () => (
|
|
40
40
|
{ id: '5', content: 'Something else', onClick: () => alert('Clicked id 5') }
|
41
41
|
]}
|
42
42
|
/>
|
43
|
+
<Message
|
44
|
+
name="Bot"
|
45
|
+
role="bot"
|
46
|
+
avatar={patternflyAvatar}
|
47
|
+
content="Did you clear your cache?"
|
48
|
+
quickResponses={[
|
49
|
+
{ id: '1', content: 'Yes', isDisabled: true },
|
50
|
+
{ id: '2', content: 'No', onClick: () => alert('Clicked no') }
|
51
|
+
]}
|
52
|
+
/>
|
43
53
|
</>
|
44
54
|
);
|
@@ -14,23 +14,26 @@ export const MessageWithSourcesExample: React.FunctionComponent = () => {
|
|
14
14
|
name="Bot"
|
15
15
|
role="bot"
|
16
16
|
avatar={patternflyAvatar}
|
17
|
-
content="
|
17
|
+
content="This example has a body description that's within the recommended limit of 2 lines:"
|
18
18
|
sources={{
|
19
19
|
sources: [
|
20
20
|
{
|
21
21
|
title: 'Getting started with Red Hat OpenShift',
|
22
22
|
link: '#',
|
23
|
-
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...'
|
23
|
+
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...',
|
24
|
+
isExternal: true
|
24
25
|
},
|
25
26
|
{
|
26
27
|
title: 'Azure Red Hat OpenShift documentation',
|
27
28
|
link: '#',
|
28
|
-
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...'
|
29
|
+
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...',
|
30
|
+
isExternal: true
|
29
31
|
},
|
30
32
|
{
|
31
33
|
title: 'OKD Documentation: Home',
|
32
34
|
link: '#',
|
33
|
-
body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon ...'
|
35
|
+
body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon ...',
|
36
|
+
isExternal: true
|
34
37
|
}
|
35
38
|
],
|
36
39
|
onSetPage
|
@@ -40,18 +43,49 @@ export const MessageWithSourcesExample: React.FunctionComponent = () => {
|
|
40
43
|
name="Bot"
|
41
44
|
role="bot"
|
42
45
|
avatar={patternflyAvatar}
|
43
|
-
content="
|
46
|
+
content="This example has a body description that's longer than the recommended limit of 2 lines, with a link to load the rest of the description:"
|
47
|
+
sources={{
|
48
|
+
sources: [
|
49
|
+
{
|
50
|
+
title: 'Getting started with Red Hat OpenShift',
|
51
|
+
link: '#',
|
52
|
+
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud.',
|
53
|
+
hasShowMore: true
|
54
|
+
},
|
55
|
+
{
|
56
|
+
title: 'Azure Red Hat OpenShift documentation',
|
57
|
+
link: '#',
|
58
|
+
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure.',
|
59
|
+
hasShowMore: true
|
60
|
+
},
|
61
|
+
{
|
62
|
+
title: 'OKD Documentation: Home',
|
63
|
+
link: '#',
|
64
|
+
body: 'OKD is a distribution of Kubernetes optimized for continuous application development and multi-tenant deployment. OKD also serves as the upstream code base upon.',
|
65
|
+
hasShowMore: true
|
66
|
+
}
|
67
|
+
],
|
68
|
+
onSetPage
|
69
|
+
}}
|
70
|
+
/>
|
71
|
+
<Message
|
72
|
+
name="Bot"
|
73
|
+
role="bot"
|
74
|
+
avatar={patternflyAvatar}
|
75
|
+
content="This example has a truncated title:"
|
44
76
|
sources={{
|
45
77
|
sources: [
|
46
78
|
{
|
47
79
|
title: 'Getting started with Red Hat OpenShift AI and other products',
|
48
80
|
link: '#',
|
49
|
-
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...'
|
81
|
+
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...',
|
82
|
+
isExternal: true
|
50
83
|
},
|
51
84
|
{
|
52
85
|
title: 'Azure Red Hat OpenShift documentation | Red Hat',
|
53
86
|
link: '#',
|
54
|
-
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...'
|
87
|
+
body: 'Microsoft Azure Red Hat OpenShift allows you to deploy a production ready Red Hat OpenShift cluster in Azure ...',
|
88
|
+
isExternal: true
|
55
89
|
}
|
56
90
|
],
|
57
91
|
onSetPage
|
@@ -61,13 +95,14 @@ export const MessageWithSourcesExample: React.FunctionComponent = () => {
|
|
61
95
|
name="Bot"
|
62
96
|
role="bot"
|
63
97
|
avatar={patternflyAvatar}
|
64
|
-
content="
|
98
|
+
content="This example only includes 1 source:"
|
65
99
|
sources={{
|
66
100
|
sources: [
|
67
101
|
{
|
68
102
|
title: 'Getting started with Red Hat OpenShift',
|
69
103
|
link: '#',
|
70
|
-
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...'
|
104
|
+
body: 'Red Hat OpenShift on IBM Cloud is a managed offering to create your own cluster of compute hosts where you can deploy and manage containerized apps on IBM Cloud ...',
|
105
|
+
isExternal: true
|
71
106
|
}
|
72
107
|
],
|
73
108
|
onSetPage
|
@@ -77,17 +112,19 @@ export const MessageWithSourcesExample: React.FunctionComponent = () => {
|
|
77
112
|
name="Bot"
|
78
113
|
role="bot"
|
79
114
|
avatar={patternflyAvatar}
|
80
|
-
content="
|
115
|
+
content="This example has a title and no body description:"
|
81
116
|
sources={{
|
82
117
|
sources: [
|
83
|
-
{ title: 'Getting started with Red Hat OpenShift', link: '#' },
|
118
|
+
{ title: 'Getting started with Red Hat OpenShift', link: '#', isExternal: true },
|
84
119
|
{
|
85
120
|
title: 'Azure Red Hat OpenShift documentation',
|
86
|
-
link: '#'
|
121
|
+
link: '#',
|
122
|
+
isExternal: true
|
87
123
|
},
|
88
124
|
{
|
89
125
|
title: 'OKD Documentation: Home',
|
90
|
-
link: '#'
|
126
|
+
link: '#',
|
127
|
+
isExternal: true
|
91
128
|
}
|
92
129
|
],
|
93
130
|
onSetPage
|
@@ -97,7 +134,7 @@ export const MessageWithSourcesExample: React.FunctionComponent = () => {
|
|
97
134
|
name="Bot"
|
98
135
|
role="bot"
|
99
136
|
avatar={patternflyAvatar}
|
100
|
-
content="
|
137
|
+
content="This example displays the source as a link, without a title (not recommended)"
|
101
138
|
sources={{
|
102
139
|
sources: [
|
103
140
|
{
|
@@ -142,7 +142,9 @@ To add quick actions, pass `quickResponses` to `<Message>`. This can be overridd
|
|
142
142
|
|
143
143
|
If you are using Retrieval-Augmented Generation, you may want to display sources in a message. Passing `sources` to `<Message>` allows you to paginate between the sources you provide.
|
144
144
|
|
145
|
-
|
145
|
+
If a source will open outside of the ChatBot window, add an external link icon via `isExternal`.
|
146
|
+
|
147
|
+
The API for a source requires a link at minimum, but we strongly recommend providing a more descriptive title and body description so users have enough context. For the best clarity and readability, we strongly recommend limiting the title to 1 line and the body to 2 lines. If the body description is more than 2 lines, use the "long sources" or "very long sources" variant.
|
146
148
|
|
147
149
|
```js file="./MessageWithSources.tsx"
|
148
150
|
|