Skip to content

Commit db3257b

Browse files
Fix(Lightspeeed): Upgrade PF chatbot in lightspeed (#878)
* upgrade patternfly chatbot * fix typo in prompts * add changeset * udpate e2e tests
1 parent 7e0901b commit db3257b

7 files changed

Lines changed: 31 additions & 11 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@red-hat-developer-hub/backstage-plugin-lightspeed': patch
3+
---
4+
5+
Upgrade PF chatbot

workspaces/lightspeed/packages/app/e2e-tests/utils/testHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ export const sendMessage = async (message: string, page: Page) => {
2828
const inputLocator = page.getByRole('textbox').first();
2929
await inputLocator.waitFor({ state: 'visible' });
3030
await inputLocator.fill(message);
31-
await page.locator('button[aria-label="Send button"]').click();
31+
await page.locator('button[aria-label="Send"]').click();
3232
};

workspaces/lightspeed/plugins/lightspeed/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"@material-ui/core": "^4.9.13",
4545
"@material-ui/lab": "^4.0.0-alpha.61",
4646
"@mui/icons-material": "^6.1.8",
47-
"@patternfly/chatbot": "6.3.0-prerelease.10",
47+
"@patternfly/chatbot": "6.3.0-prerelease.17",
4848
"@patternfly/react-core": "6.3.0-prerelease.4",
4949
"@red-hat-developer-hub/backstage-plugin-lightspeed-common": "workspace:^",
5050
"@tanstack/react-query": "^5.59.15",

workspaces/lightspeed/plugins/lightspeed/src/components/Attachment.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
import React from 'react';
1717

18+
import { makeStyles } from '@material-ui/core';
1819
import {
1920
AttachmentEdit,
2021
ChatbotDisplayMode,
@@ -23,13 +24,22 @@ import {
2324

2425
import { useFileAttachmentContext } from './AttachmentContext';
2526

27+
const useStyles = makeStyles(() => ({
28+
modalFooter: {
29+
'&>button': {
30+
width: '12% !important',
31+
},
32+
},
33+
}));
2634
const Attachment = () => {
2735
const {
2836
currentFileContent,
2937
setFileContents,
3038
modalState,
3139
setCurrentFileContent,
3240
} = useFileAttachmentContext();
41+
const classes = useStyles();
42+
3343
if (!currentFileContent) {
3444
return null;
3545
}
@@ -49,6 +59,8 @@ const Attachment = () => {
4959
code={currentFileContent?.content}
5060
fileName={currentFileContent?.name}
5161
isModalOpen={isPreviewModalOpen}
62+
secondaryActionButtonText="Close"
63+
modalFooterClassName={classes.modalFooter}
5264
onEdit={() => {
5365
setIsPreviewModalOpen(false);
5466
setIsEditModalOpen(true);
@@ -65,6 +77,7 @@ const Attachment = () => {
6577
code={currentFileContent?.content}
6678
fileName={currentFileContent?.name}
6779
isModalOpen={isEditModalOpen}
80+
modalFooterClassName={classes.modalFooter}
6881
onSave={(_, content) => {
6982
setCurrentFileContent({
7083
...currentFileContent,

workspaces/lightspeed/plugins/lightspeed/src/components/LightspeedChatBox.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
ChatbotWelcomePrompt,
2424
Message,
2525
MessageBox,
26+
MessageBoxHandle,
2627
MessageProps,
2728
WelcomePrompt,
2829
} from '@patternfly/chatbot';
@@ -81,7 +82,7 @@ export const LightspeedChatBox = React.forwardRef(
8182
) => {
8283
const classes = useStyles();
8384
const scrollQueued = React.useRef(false);
84-
const containerRef = React.useRef<HTMLDivElement>(null);
85+
const containerRef = React.useRef<MessageBoxHandle>(null);
8586

8687
const configApi = useApi(configApiRef);
8788
const questionValidationEnabled =

workspaces/lightspeed/plugins/lightspeed/src/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const DEFAULT_SAMPLE_PROMPTS: SamplePrompts = [
5656
),
5757
createPrompt(
5858
'Demystify Sorting Algorithms',
59-
'Can you explain the difference between a quicksort and a mergesort algorithm, and when to use each?',
59+
'Can you explain the difference between a quicksort and a merge sort algorithm, and when to use each?',
6060
),
6161
createPrompt(
6262
'Understand Event-Driven Architecture',

workspaces/lightspeed/yarn.lock

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9695,9 +9695,9 @@ __metadata:
96959695
languageName: node
96969696
linkType: hard
96979697

9698-
"@patternfly/chatbot@npm:6.3.0-prerelease.10":
9699-
version: 6.3.0-prerelease.10
9700-
resolution: "@patternfly/chatbot@npm:6.3.0-prerelease.10"
9698+
"@patternfly/chatbot@npm:6.3.0-prerelease.17":
9699+
version: 6.3.0-prerelease.17
9700+
resolution: "@patternfly/chatbot@npm:6.3.0-prerelease.17"
97019701
dependencies:
97029702
"@patternfly/react-code-editor": ^6.1.0
97039703
"@patternfly/react-core": ^6.1.0
@@ -9714,10 +9714,11 @@ __metadata:
97149714
rehype-sanitize: ^6.0.0
97159715
rehype-unwrap-images: ^1.0.0
97169716
remark-gfm: ^4.0.0
9717+
unist-util-visit: ^5.0.0
97179718
peerDependencies:
9718-
react: ^17 || ^18
9719-
react-dom: ^17 || ^18
9720-
checksum: d78d6c9eb3c4f2005ecaf63ed5354ec07101cbbaf93e9cb1d819a7921fef221b11e38d7be3723c9b0b633fc92b991f459554b94c04687e45c56ee9acf12335a7
9719+
react: ^17 || ^18 || ^19
9720+
react-dom: ^17 || ^18 || ^19
9721+
checksum: f29492ae053f6bcd90267eff96585c6fdf2eca52f8252ced0cc1b6579678df976d8d4d1d1b5aedea42dcfe64b6a865743c5af816d1d2620bc3231e82d5d5aa09
97219722
languageName: node
97229723
linkType: hard
97239724

@@ -10590,7 +10591,7 @@ __metadata:
1059010591
"@material-ui/core": ^4.9.13
1059110592
"@material-ui/lab": ^4.0.0-alpha.61
1059210593
"@mui/icons-material": ^6.1.8
10593-
"@patternfly/chatbot": 6.3.0-prerelease.10
10594+
"@patternfly/chatbot": 6.3.0-prerelease.17
1059410595
"@patternfly/react-core": 6.3.0-prerelease.4
1059510596
"@red-hat-developer-hub/backstage-plugin-lightspeed-common": "workspace:^"
1059610597
"@spotify/prettier-config": ^15.0.0

0 commit comments

Comments
 (0)