@rh-support/troubleshoot 2.6.49 → 2.6.55
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/lib/esm/components/CaseEditView/Tabs/CasePrivateNotes/CasePrivateNotes.js +1 -1
- package/lib/esm/components/TroubleshootSection/AskRedHat.d.ts.map +1 -1
- package/lib/esm/components/TroubleshootSection/AskRedHat.js +49 -22
- package/lib/esm/components/shared/fileUpload/WidgetFileUploader.js +1 -1
- package/lib/esm/components/wizardLayout/WizardMain.d.ts +3 -0
- package/lib/esm/components/wizardLayout/WizardMain.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardMain.js +23 -45
- package/lib/esm/css/AskRedHat.css +11 -2
- package/lib/esm/css/case.css +5 -1
- package/lib/esm/hooks/useARHResponse.d.ts +15 -0
- package/lib/esm/hooks/useARHResponse.d.ts.map +1 -0
- package/lib/esm/hooks/useARHResponse.js +50 -0
- package/lib/esm/scss/_main.scss +4 -6
- package/lib/esm/scss/_pf-overrides.scss +16 -0
- package/package.json +3 -3
|
@@ -80,7 +80,7 @@ function CasePrivateNotes(props) {
|
|
|
80
80
|
canUpdatePrivateNotes && (React.createElement("form", null,
|
|
81
81
|
React.createElement(TextAreaResizable, { style: { minHeight: '200px' }, id: "rha-case-notes", disabled: isUpdating, maxLength: 255, name: "notes", value: notesState, onChange: onChange }),
|
|
82
82
|
React.createElement("div", { className: "pf-v6-u-mt-md" },
|
|
83
|
-
React.createElement(Button, { className: `${isExportingPDF ? 'hide-in-pdf' : ''}`, onClick: updateCase,
|
|
83
|
+
React.createElement(Button, { className: `${isExportingPDF ? 'hide-in-pdf' : ''}`, onClick: updateCase, isDisabled: isPrivateNotesEmpty || isUpdating || !formIsDirty, variant: "primary" },
|
|
84
84
|
React.createElement(Trans, null, "Update"),
|
|
85
85
|
" ",
|
|
86
86
|
React.createElement(LoadingIndicator, { show: isUpdating, isInline: true })),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskRedHat.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/AskRedHat.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AskRedHat.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/AskRedHat.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAe5D,UAAU,MAAM;IACZ,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAsVtC,CAAC"}
|
|
@@ -9,11 +9,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { Env } from '@cee-eng/hydrajs';
|
|
11
11
|
import { sendRHDirectMessageFeedback } from '@ifd-ui/ask-redhat-core';
|
|
12
|
-
import { Button, Card, CardBody, CardHeader, Modal, ModalVariant, Spinner } from '@patternfly/react-core';
|
|
12
|
+
import { Button, Card, CardBody, CardHeader, Content, ContentVariants, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateVariant, Icon, Modal, ModalVariant, Skeleton, Spinner, } from '@patternfly/react-core';
|
|
13
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
14
|
+
import isEqual from 'lodash/isEqual';
|
|
13
15
|
import React, { useContext, useRef, useState } from 'react';
|
|
14
16
|
import { MODAL_MESSAGES, QUICK_RESPONSES, TOOLTIP_MESSAGES } from '../../constants/askRedHatMessages';
|
|
15
17
|
import { useAIResponseState } from '../../context/AIResponseContext';
|
|
18
|
+
import { useCaseSelector } from '../../context/CaseContext';
|
|
16
19
|
import { RouteContext } from '../../context/RouteContext';
|
|
20
|
+
import { useARHResponse } from '../../hooks/useARHResponse';
|
|
17
21
|
import { useParseRuleMarkdown } from '../../hooks/useParseRuleMarkdown';
|
|
18
22
|
import { appSourceId_ARH } from '../../reducers/CaseConstNTypes';
|
|
19
23
|
import { CollapseIcon } from './icons/CollapseIcon';
|
|
@@ -31,7 +35,29 @@ export const AskRedHat = ({ onChatWithAIClick }) => {
|
|
|
31
35
|
const [isSubmittingFeedback, setIsSubmittingFeedback] = useState(false);
|
|
32
36
|
const aiResponseState = useAIResponseState();
|
|
33
37
|
const contentRef = useRef(null);
|
|
34
|
-
const { routeState: { isCaseCreate }, } = useContext(RouteContext);
|
|
38
|
+
const { routeState: { isCaseCreate, activeSection }, } = useContext(RouteContext);
|
|
39
|
+
const { product, version, summary, issue, caseType } = useCaseSelector((state) => ({
|
|
40
|
+
product: state.caseDetails.product,
|
|
41
|
+
version: state.caseDetails.version,
|
|
42
|
+
summary: state.caseDetails.summary,
|
|
43
|
+
issue: state.caseDetails.issue,
|
|
44
|
+
caseType: state.caseDetails.caseType,
|
|
45
|
+
}), isEqual);
|
|
46
|
+
const config = {
|
|
47
|
+
appSourceId: appSourceId_ARH,
|
|
48
|
+
authToken: (_b = (_a = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _a === void 0 ? void 0 : _a.getEncodedToken()) !== null && _b !== void 0 ? _b : '',
|
|
49
|
+
packageVersion: (_c = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _c === void 0 ? void 0 : _c.packageVersion,
|
|
50
|
+
appEnv: Env.getEnvName(),
|
|
51
|
+
};
|
|
52
|
+
const { fetchARHResponse } = useARHResponse({
|
|
53
|
+
activeSection,
|
|
54
|
+
product,
|
|
55
|
+
version,
|
|
56
|
+
summary,
|
|
57
|
+
issue,
|
|
58
|
+
caseType,
|
|
59
|
+
config,
|
|
60
|
+
});
|
|
35
61
|
const onToggle = () => {
|
|
36
62
|
if (isExpanded && contentRef.current) {
|
|
37
63
|
contentRef.current.scrollTop = 0;
|
|
@@ -52,18 +78,12 @@ export const AskRedHat = ({ onChatWithAIClick }) => {
|
|
|
52
78
|
const isLoading = aiResponseState.isStreaming && aiResponseState.accumulatedResponse === '';
|
|
53
79
|
const isStreaming = aiResponseState.isStreaming;
|
|
54
80
|
const { parseMarkdown } = useParseRuleMarkdown();
|
|
55
|
-
const config = {
|
|
56
|
-
appSourceId: appSourceId_ARH,
|
|
57
|
-
packageVersion: (_a = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _a === void 0 ? void 0 : _a.packageVersion,
|
|
58
|
-
authToken: (_c = (_b = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _b === void 0 ? void 0 : _b.getEncodedToken()) !== null && _c !== void 0 ? _c : '',
|
|
59
|
-
appEnv: Env.getEnvName(),
|
|
60
|
-
};
|
|
61
81
|
const handleFeedbackSubmit = (selectedResponse, additionalFeedback) => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
82
|
setIsSubmittingFeedback(true);
|
|
63
83
|
try {
|
|
64
84
|
const payload = {
|
|
65
85
|
rating: (feedbackType === 'positive' ? 'positive' : 'negative'),
|
|
66
|
-
freeform: additionalFeedback ||
|
|
86
|
+
freeform: additionalFeedback || '',
|
|
67
87
|
predefined_response: selectedResponse || '',
|
|
68
88
|
};
|
|
69
89
|
yield sendRHDirectMessageFeedback(conversationId, messageId, payload, config);
|
|
@@ -91,15 +111,32 @@ export const AskRedHat = ({ onChatWithAIClick }) => {
|
|
|
91
111
|
navigator.clipboard.writeText(answer);
|
|
92
112
|
} }, TOOLTIP_MESSAGES.copy),
|
|
93
113
|
};
|
|
114
|
+
if (aiResponseState.error) {
|
|
115
|
+
return (React.createElement("div", { className: "ask-redhat" },
|
|
116
|
+
React.createElement("p", { className: "ask-redhat-title" },
|
|
117
|
+
React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
118
|
+
"Resolve your issue now with AI insights"),
|
|
119
|
+
React.createElement("div", { className: "ask-redhat-content-wrapper ask-redhat-error" },
|
|
120
|
+
React.createElement(EmptyState, { variant: EmptyStateVariant.xs, titleText: "", headingLevel: "h4" },
|
|
121
|
+
React.createElement("h4", null,
|
|
122
|
+
React.createElement(Icon, { iconSize: "lg", status: "danger", className: "pf-v6-u-mr-sm" },
|
|
123
|
+
React.createElement(ExclamationCircleIcon, null)),
|
|
124
|
+
' ',
|
|
125
|
+
"Error while loading AI insights"),
|
|
126
|
+
React.createElement(EmptyStateBody, null,
|
|
127
|
+
React.createElement(Content, { component: ContentVariants.p }, "AI insights is currently unavailable, try reloading.")),
|
|
128
|
+
React.createElement(EmptyStateFooter, null,
|
|
129
|
+
React.createElement(Button, { variant: "tertiary", size: "sm", onClick: fetchARHResponse }, "Reload"))))));
|
|
130
|
+
}
|
|
94
131
|
if (isLoading) {
|
|
95
132
|
return (React.createElement("div", { className: "ask-redhat" },
|
|
96
133
|
React.createElement("p", { className: "ask-redhat-title" },
|
|
97
134
|
React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
98
135
|
isCaseCreate ? 'Resolve your issue now with AI insights' : 'Troubleshoot with AI insights'),
|
|
99
136
|
React.createElement("div", { className: "ask-redhat-content-wrapper" },
|
|
100
|
-
React.createElement("div", { className: "
|
|
101
|
-
React.createElement(
|
|
102
|
-
React.createElement("
|
|
137
|
+
React.createElement("div", { className: "pf-v6-u-display-flex pf-v6-u-flex-direction-column pf-v6-u-justify-content-space-between" }, [...Array(3)].map((_, i) => (React.createElement("div", { className: "pf-v6-u-mb-sm", key: `AI-insights-loading-${i}` },
|
|
138
|
+
React.createElement(Skeleton, { width: "100%", screenreaderText: "Getting AI insights..." }),
|
|
139
|
+
React.createElement("br", null)))))),
|
|
103
140
|
!aiResponseState.isStreaming && (React.createElement("div", { className: "ask-redhat-toggle-button" },
|
|
104
141
|
React.createElement(Button, { variant: "link", onClick: handleChatWithAIClick, className: "ask-redhat-chat-button" }, "Chat with AI to get started")))));
|
|
105
142
|
}
|
|
@@ -123,16 +160,6 @@ export const AskRedHat = ({ onChatWithAIClick }) => {
|
|
|
123
160
|
isExpanded ? React.createElement(CollapseIcon, null) : React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
124
161
|
isExpanded ? '' : 'Read more'))));
|
|
125
162
|
}
|
|
126
|
-
if (aiResponseState.error) {
|
|
127
|
-
return (React.createElement("div", { className: "ask-redhat" },
|
|
128
|
-
React.createElement("p", { className: "ask-redhat-title" },
|
|
129
|
-
React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
130
|
-
"Resolve your issue now with AI insights"),
|
|
131
|
-
React.createElement("div", { className: "ask-redhat-content-wrapper" },
|
|
132
|
-
React.createElement("div", { className: "ask-redhat-content", style: { textAlign: 'center', padding: '2rem' } },
|
|
133
|
-
React.createElement("p", { style: { color: '#d73502', marginBottom: '1rem' } }, "Unable to get AI insights. Please try again later."),
|
|
134
|
-
React.createElement(Button, { variant: "link", onClick: handleChatWithAIClick, className: "ask-redhat-chat-button", icon: React.createElement(StarIcon, null) }, "Try again with AI Chat")))));
|
|
135
|
-
}
|
|
136
163
|
return (React.createElement("div", { className: "ask-redhat" },
|
|
137
164
|
React.createElement("p", { className: "ask-redhat-title" },
|
|
138
165
|
React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
@@ -146,7 +146,7 @@ function WidgetFileUploader(props) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
|
-
return (React.createElement(Card, { id: "file-uploader-card", className: "file-diag", onPaste: handlePaste },
|
|
149
|
+
return (React.createElement(Card, { id: "file-uploader-card", className: "file-diag pf-v6-u-mb-lg", onPaste: handlePaste },
|
|
150
150
|
React.createElement(CardHeader, { "aria-label": t('File uploader') },
|
|
151
151
|
React.createElement("h3", { id: "file-uploader-title" }, props.isIdea || props.isSecureSupport ? (React.createElement(Trans, null, "File uploader")) : (React.createElement(Trans, null, "Upload a file for Red Hat to analyze")))),
|
|
152
152
|
React.createElement(CardBody, { "aria-label": t('File upload area'), className: "file-upload-body" },
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { RouteComponentProps } from 'react-router-dom';
|
|
3
3
|
import { IRouteUrlParams } from '../../reducers/RouteConstNTypes';
|
|
4
|
+
export declare const getCaseTypeAIText: (caseType: string) => string;
|
|
5
|
+
export declare const generateCaseTypePrefix: (activeSection: string, caseType: string, lang: string) => string;
|
|
6
|
+
export declare const generateAIQuestion: (activeSection: string, product: string | undefined, version: string | undefined, summary: string | undefined, issue: string | undefined, caseType: string, lang: string) => string;
|
|
4
7
|
interface IProps {
|
|
5
8
|
routeProps: RouteComponentProps<IRouteUrlParams>;
|
|
6
9
|
submitCaseAndNavigate: (isReSubmitting: boolean) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardMain.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardMain.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAqD,MAAM,OAAO,CAAC;AAE3G,OAAO,EAAS,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAS9D,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAapF,eAAO,MAAM,iBAAiB,aAAc,MAAM,KAAG,MAEpD,CAAC;AAEF,eAAO,MAAM,sBAAsB,kBAAmB,MAAM,YAAY,MAAM,QAAQ,MAAM,KAAG,MAqB9F,CAAC;AAGF,eAAO,MAAM,kBAAkB,kBACZ,MAAM,WACZ,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,WAClB,MAAM,GAAG,SAAS,SACpB,MAAM,GAAG,SAAS,YACf,MAAM,QACV,MAAM,KACb,MAwCF,CAAC;AACF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,qBAAqB,EAAE,CAAC,cAAc,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,mBAAmB,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,IAAI,CAAC;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,qBAyVhC;AACD,eAAe,UAAU,CAAC"}
|
|
@@ -19,20 +19,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
21
|
import { Env } from '@cee-eng/hydrajs';
|
|
22
|
-
import {
|
|
22
|
+
import { getRHDirectStatusCheck } from '@ifd-ui/ask-redhat-core';
|
|
23
23
|
import { Wizard, WizardNav, WizardNavItem, WizardStep, } from '@patternfly/react-core';
|
|
24
24
|
import { LoadingIndicator } from '@rh-support/components';
|
|
25
|
-
import i18n from 'i18next';
|
|
26
25
|
import isEqual from 'lodash/isEqual';
|
|
27
26
|
import React, { Suspense, useContext, useEffect, useRef, useState } from 'react';
|
|
28
27
|
import { useTranslation } from 'react-i18next';
|
|
29
28
|
import { Route } from 'react-router-dom';
|
|
30
|
-
import { useAIResponseDispatch, useAIResponseState } from '../../context/AIResponseContext';
|
|
31
29
|
import { useCaseSelector } from '../../context/CaseContext';
|
|
32
30
|
import { RecommendationDispatchContext } from '../../context/RecommendationContext';
|
|
33
31
|
import { RouteContext, RouteDispatchContext } from '../../context/RouteContext';
|
|
32
|
+
import { useARHResponse } from '../../hooks/useARHResponse';
|
|
34
33
|
import { useWizard } from '../../hooks/useWizard';
|
|
35
|
-
import { streamingChunkReceived, streamingCompleted, streamingError, streamingStarted, } from '../../reducers/AIResponseReducer';
|
|
36
34
|
import { appSourceId_ARH, excludedCaseTypesforARH } from '../../reducers/CaseConstNTypes';
|
|
37
35
|
import { RecommendationsConstants } from '../../reducers/RecommendationsReducer';
|
|
38
36
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
@@ -46,10 +44,10 @@ import WizardNavigation from './WizardNavigation';
|
|
|
46
44
|
const CASE_TYPE_AI_TEXT_MAP = {
|
|
47
45
|
Other: 'Something',
|
|
48
46
|
};
|
|
49
|
-
const getCaseTypeAIText = (caseType) => {
|
|
47
|
+
export const getCaseTypeAIText = (caseType) => {
|
|
50
48
|
return CASE_TYPE_AI_TEXT_MAP[caseType] || caseType;
|
|
51
49
|
};
|
|
52
|
-
const generateCaseTypePrefix = (activeSection, caseType, lang) => {
|
|
50
|
+
export const generateCaseTypePrefix = (activeSection, caseType, lang) => {
|
|
53
51
|
if (activeSection === AppRouteSections.TROUBLESHOOT) {
|
|
54
52
|
return '';
|
|
55
53
|
}
|
|
@@ -69,7 +67,7 @@ const generateCaseTypePrefix = (activeSection, caseType, lang) => {
|
|
|
69
67
|
return helpWithMap[lang] || helpWithMap.en;
|
|
70
68
|
};
|
|
71
69
|
// Generate AI question based on case details
|
|
72
|
-
const generateAIQuestion = (activeSection, product, version, summary, issue, caseType, lang) => {
|
|
70
|
+
export const generateAIQuestion = (activeSection, product, version, summary, issue, caseType, lang) => {
|
|
73
71
|
const baseMessageMap = {
|
|
74
72
|
en: `My issue is primarily related to ${product !== null && product !== void 0 ? product : ''} ${version !== null && version !== void 0 ? version : ''}. I would title my problem: ${summary !== null && summary !== void 0 ? summary : ''}. More details are as follows: ${issue !== null && issue !== void 0 ? issue : ''}.`,
|
|
75
73
|
de: `Mein Problem hängt hauptsächlich mit ${product !== null && product !== void 0 ? product : ''} ${version !== null && version !== void 0 ? version : ''} zusammen. Ich würde mein Problem so betiteln: ${summary !== null && summary !== void 0 ? summary : ''}. Weitere Details sind wie folgt: ${issue !== null && issue !== void 0 ? issue : ''}.`,
|
|
@@ -99,7 +97,21 @@ function WizardMain(props) {
|
|
|
99
97
|
caseType: state.caseDetails.caseType,
|
|
100
98
|
}), isEqual);
|
|
101
99
|
const { routeState: { isCaseCreate, activeSection }, } = useContext(RouteContext);
|
|
102
|
-
const
|
|
100
|
+
const config = {
|
|
101
|
+
appSourceId: appSourceId_ARH,
|
|
102
|
+
authToken: (_b = (_a = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _a === void 0 ? void 0 : _a.getEncodedToken()) !== null && _b !== void 0 ? _b : '',
|
|
103
|
+
packageVersion: (_c = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _c === void 0 ? void 0 : _c.packageVersion,
|
|
104
|
+
appEnv: Env.getEnvName(),
|
|
105
|
+
};
|
|
106
|
+
const { fetchARHResponse } = useARHResponse({
|
|
107
|
+
activeSection,
|
|
108
|
+
product,
|
|
109
|
+
version,
|
|
110
|
+
summary,
|
|
111
|
+
issue,
|
|
112
|
+
caseType,
|
|
113
|
+
config,
|
|
114
|
+
});
|
|
103
115
|
const isTroubleshootSection = activeSection === AppRouteSections.TROUBLESHOOT;
|
|
104
116
|
const isResourcesSection = activeSection === AppRouteSections.RESOURCES;
|
|
105
117
|
const isSummarizeSection = activeSection === AppRouteSections.SUMMARIZE;
|
|
@@ -147,7 +159,7 @@ function WizardMain(props) {
|
|
|
147
159
|
// Check if user is not a secure support or confirmed stateside support user
|
|
148
160
|
const isNotSecureOrStatesideUser = !props.isSecureSupport && !props.hasConfirmedStatesideSupport;
|
|
149
161
|
// Check if the ARH fields have changed
|
|
150
|
-
const isARHFieldsChanged = haveARHFieldsChanged
|
|
162
|
+
const isARHFieldsChanged = haveARHFieldsChanged;
|
|
151
163
|
// Check if user is external and has invalid entitlements
|
|
152
164
|
const isNotUnentitledExternalUser = !(props.isUserExternal && props.hasInvalidEntitlements);
|
|
153
165
|
return (isRelevantSection &&
|
|
@@ -157,7 +169,7 @@ function WizardMain(props) {
|
|
|
157
169
|
isNotUnentitledExternalUser);
|
|
158
170
|
};
|
|
159
171
|
// Check if any of the ARH-relevant fields have changed
|
|
160
|
-
const haveARHFieldsChanged = () => {
|
|
172
|
+
const haveARHFieldsChanged = React.useMemo(() => {
|
|
161
173
|
const hasChanged = previousARHFieldsRef.current.product !== product ||
|
|
162
174
|
previousARHFieldsRef.current.version !== version ||
|
|
163
175
|
previousARHFieldsRef.current.summary !== summary ||
|
|
@@ -171,7 +183,7 @@ function WizardMain(props) {
|
|
|
171
183
|
};
|
|
172
184
|
}
|
|
173
185
|
return hasChanged;
|
|
174
|
-
};
|
|
186
|
+
}, [product, version, summary, issue]);
|
|
175
187
|
useEffect(() => {
|
|
176
188
|
if (!activeSection) {
|
|
177
189
|
return;
|
|
@@ -262,40 +274,6 @@ function WizardMain(props) {
|
|
|
262
274
|
const customNav = (isExpanded, steps, activeStep, goToStepByIndex) => (React.createElement(WizardNav, { isExpanded: isExpanded }, steps.map((step) => {
|
|
263
275
|
return (React.createElement(WizardNavItem, { key: step.id, id: step.id, content: step.name, isCurrent: activeStep.id === step.id, isDisabled: !step.canJumpTo, stepIndex: step.index, onClick: () => goToStepByIndex(step.index) }));
|
|
264
276
|
})));
|
|
265
|
-
const aiResponseState = useAIResponseState();
|
|
266
|
-
const config = {
|
|
267
|
-
appSourceId: appSourceId_ARH,
|
|
268
|
-
authToken: (_b = (_a = window === null || window === void 0 ? void 0 : window.sessionjs) === null || _a === void 0 ? void 0 : _a.getEncodedToken()) !== null && _b !== void 0 ? _b : '',
|
|
269
|
-
packageVersion: (_c = window === null || window === void 0 ? void 0 : window.supportVersionInfo) === null || _c === void 0 ? void 0 : _c.packageVersion,
|
|
270
|
-
appEnv: Env.getEnvName(),
|
|
271
|
-
};
|
|
272
|
-
const fetchARHResponse = () => __awaiter(this, void 0, void 0, function* () {
|
|
273
|
-
var _a;
|
|
274
|
-
const detailedQuestion = generateAIQuestion(activeSection || '', product, version, summary, issue, caseType || '', i18n.language || 'en');
|
|
275
|
-
//streaming callbacks
|
|
276
|
-
const streamingCallbacks = {
|
|
277
|
-
onChunk: (chunk, accumulatedResponse) => {
|
|
278
|
-
aiResponseDispatch(streamingChunkReceived(chunk, accumulatedResponse));
|
|
279
|
-
},
|
|
280
|
-
onComplete: (finalResponse) => {
|
|
281
|
-
aiResponseDispatch(streamingCompleted(finalResponse));
|
|
282
|
-
},
|
|
283
|
-
onError: (error) => {
|
|
284
|
-
aiResponseDispatch(streamingError(error));
|
|
285
|
-
},
|
|
286
|
-
};
|
|
287
|
-
aiResponseDispatch(streamingStarted());
|
|
288
|
-
try {
|
|
289
|
-
// Get existing conversation ID from state if available (need to map it with session data)
|
|
290
|
-
const existingConversationId = (_a = aiResponseState === null || aiResponseState === void 0 ? void 0 : aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId;
|
|
291
|
-
yield askRHDirectAIResponse(detailedQuestion, config, true, // response to be streamed or not
|
|
292
|
-
existingConversationId, streamingCallbacks);
|
|
293
|
-
}
|
|
294
|
-
catch (error) {
|
|
295
|
-
const errorMessage = error instanceof Error ? error.message : 'Failed to get AI response';
|
|
296
|
-
aiResponseDispatch(streamingError(errorMessage));
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
277
|
const CustomFooter = (activeStep, goToNextStep, goToPrevStep) => {
|
|
300
278
|
useEffect(() => {
|
|
301
279
|
if (steps.length > 2 && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.index) === 2 && isNextButtonClicked) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
.ask-redhat-content {
|
|
26
|
-
max-height:
|
|
26
|
+
max-height: 242px;
|
|
27
27
|
color: #000;
|
|
28
28
|
font-family: 'Red Hat Text';
|
|
29
29
|
font-size: 16px;
|
|
@@ -79,6 +79,12 @@
|
|
|
79
79
|
margin: 0;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
.ask-redhat-error {
|
|
83
|
+
border: 1px solid #c7c7c7;
|
|
84
|
+
border-radius: 6px;
|
|
85
|
+
padding: 12px 24px;
|
|
86
|
+
}
|
|
87
|
+
|
|
82
88
|
:root {
|
|
83
89
|
--color-red: var(--Core-color-palette-Red-red-40, #f56e6e);
|
|
84
90
|
--color-purple: var(--Secondary-color-palette-Purple-purple-50, #5e40be);
|
|
@@ -124,7 +130,6 @@
|
|
|
124
130
|
height: 100%;
|
|
125
131
|
}
|
|
126
132
|
|
|
127
|
-
|
|
128
133
|
.ask-redhat-chat-button .pf-v6-c-button__icon {
|
|
129
134
|
display: flex;
|
|
130
135
|
align-items: center;
|
|
@@ -390,3 +395,7 @@ body:has(.pf-chatbot--embedded) .pf-v6-c-wizard__main-body:last-child {
|
|
|
390
395
|
border-radius: var(--global-border-radius-small, 6px) !important;
|
|
391
396
|
background: #fff !important;
|
|
392
397
|
}
|
|
398
|
+
|
|
399
|
+
.ask-redhat-core .pf-chatbot__message-bar {
|
|
400
|
+
background: #fff !important;
|
|
401
|
+
}
|
package/lib/esm/css/case.css
CHANGED
|
@@ -47,11 +47,15 @@ button,
|
|
|
47
47
|
padding-left: 1.8rem;
|
|
48
48
|
margin-right: -1.8rem;
|
|
49
49
|
padding-right: 1.8rem;
|
|
50
|
-
margin-bottom: -
|
|
50
|
+
margin-bottom: -1rem;
|
|
51
51
|
padding-bottom: 8rem;
|
|
52
52
|
min-height: 300px;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
.case-details-tabs-content {
|
|
56
|
+
border-radius: 0 0 0 16px !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
.support-comment {
|
|
56
60
|
display: block;
|
|
57
61
|
margin-bottom: 1rem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom hook to prompt from the Ask Red Hat
|
|
3
|
+
*/
|
|
4
|
+
export declare const useARHResponse: ({ activeSection, product, version, summary, issue, caseType, config, }: {
|
|
5
|
+
activeSection: string;
|
|
6
|
+
product: string;
|
|
7
|
+
version: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
issue: string;
|
|
10
|
+
caseType: string;
|
|
11
|
+
config: any;
|
|
12
|
+
}) => {
|
|
13
|
+
fetchARHResponse: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useARHResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useARHResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/useARHResponse.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,eAAO,MAAM,cAAc,2EAQxB;IACC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,GAAG,CAAC;CACf;;CAgDA,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { askRHDirectAIResponse } from '@ifd-ui/ask-redhat-core';
|
|
11
|
+
import i18n from 'i18next';
|
|
12
|
+
import { useCallback } from 'react';
|
|
13
|
+
import { generateAIQuestion } from '../components/wizardLayout/WizardMain';
|
|
14
|
+
import { useAIResponseDispatch, useAIResponseState } from '../context/AIResponseContext';
|
|
15
|
+
import { streamingChunkReceived, streamingCompleted, streamingError, streamingStarted, } from '../reducers/AIResponseReducer';
|
|
16
|
+
/**
|
|
17
|
+
* Custom hook to prompt from the Ask Red Hat
|
|
18
|
+
*/
|
|
19
|
+
export const useARHResponse = ({ activeSection, product, version, summary, issue, caseType, config, }) => {
|
|
20
|
+
const aiResponseDispatch = useAIResponseDispatch();
|
|
21
|
+
const aiResponseState = useAIResponseState();
|
|
22
|
+
const fetchARHResponse = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
var _a;
|
|
24
|
+
const detailedQuestion = generateAIQuestion(activeSection || '', product, version, summary, issue, caseType || '', i18n.language || 'en');
|
|
25
|
+
// Streaming callbacks
|
|
26
|
+
const streamingCallbacks = {
|
|
27
|
+
onChunk: (chunk, accumulatedResponse) => {
|
|
28
|
+
aiResponseDispatch(streamingChunkReceived(chunk, accumulatedResponse));
|
|
29
|
+
},
|
|
30
|
+
onComplete: (finalResponse) => {
|
|
31
|
+
aiResponseDispatch(streamingCompleted(finalResponse));
|
|
32
|
+
},
|
|
33
|
+
onError: (error) => {
|
|
34
|
+
aiResponseDispatch(streamingError(error));
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
aiResponseDispatch(streamingStarted());
|
|
38
|
+
try {
|
|
39
|
+
// Get existing conversation ID from state if available (need to map it with session data)
|
|
40
|
+
const existingConversationId = (_a = aiResponseState === null || aiResponseState === void 0 ? void 0 : aiResponseState.aiResponse) === null || _a === void 0 ? void 0 : _a.conversationId;
|
|
41
|
+
yield askRHDirectAIResponse(detailedQuestion, config, true, // response to be streamed or not
|
|
42
|
+
existingConversationId, streamingCallbacks);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to get AI response';
|
|
46
|
+
aiResponseDispatch(streamingError(errorMessage));
|
|
47
|
+
}
|
|
48
|
+
}), [activeSection, product, version, summary, issue, caseType, config, aiResponseDispatch, aiResponseState]);
|
|
49
|
+
return { fetchARHResponse };
|
|
50
|
+
};
|
package/lib/esm/scss/_main.scss
CHANGED
|
@@ -179,10 +179,12 @@ div.support-grid-case-details.support-case {
|
|
|
179
179
|
min-height: 75vh;
|
|
180
180
|
width: 100%;
|
|
181
181
|
background-color: #f0f0f0;
|
|
182
|
+
border-radius: 0 0 0 16px;
|
|
182
183
|
|
|
183
184
|
.grid-main-section {
|
|
184
185
|
padding: 1rem;
|
|
185
186
|
background-color: #fff;
|
|
187
|
+
border-radius: 0 0 0 16px;
|
|
186
188
|
|
|
187
189
|
.case-overview-header {
|
|
188
190
|
padding: 0.5rem;
|
|
@@ -419,7 +421,7 @@ div.support-grid-case-details.support-case {
|
|
|
419
421
|
display: flex;
|
|
420
422
|
align-items: center;
|
|
421
423
|
width: 100%;
|
|
422
|
-
padding:
|
|
424
|
+
padding: 24px;
|
|
423
425
|
font-weight: 500;
|
|
424
426
|
|
|
425
427
|
span {
|
|
@@ -439,11 +441,7 @@ div.support-grid-case-details.support-case {
|
|
|
439
441
|
|
|
440
442
|
&.sidebar-collapsed {
|
|
441
443
|
button:first-of-type {
|
|
442
|
-
|
|
443
|
-
padding: 1.8rem 1.5rem;
|
|
444
|
-
background-color: #dedede;
|
|
445
|
-
border-top: 1px solid #ccc;
|
|
446
|
-
border-bottom: 1px solid #ccc;
|
|
444
|
+
padding: 24px;
|
|
447
445
|
}
|
|
448
446
|
|
|
449
447
|
button.sidebar-section-toggle-btn {
|
|
@@ -460,6 +460,14 @@ pfe-accordion {
|
|
|
460
460
|
z-index: 1 !important;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
+
nav.pf-v6-c-wizard__nav.pf-m-expanded {
|
|
464
|
+
position: absolute;
|
|
465
|
+
left: 0;
|
|
466
|
+
z-index: 2 !important;
|
|
467
|
+
background: #fff;
|
|
468
|
+
width: 100%;
|
|
469
|
+
}
|
|
470
|
+
|
|
463
471
|
.pf-v6-c-options-menu__menu {
|
|
464
472
|
z-index: 9 !important;
|
|
465
473
|
}
|
|
@@ -831,3 +839,11 @@ div.case-details-tabs pre {
|
|
|
831
839
|
.pf-v6-c-alert {
|
|
832
840
|
margin-top: 0;
|
|
833
841
|
}
|
|
842
|
+
|
|
843
|
+
.pf-v6-c-wizard__nav {
|
|
844
|
+
border-radius: 0 0 0 16px !important;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
.pf-v6-c-wizard__outer-wrap {
|
|
848
|
+
border-radius: 16px !important;
|
|
849
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.55",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@progress/kendo-react-pdf": "^5.16.0",
|
|
61
61
|
"@redux-devtools/extension": "^3.3.0",
|
|
62
62
|
"@rh-support/components": "2.5.45",
|
|
63
|
-
"@rh-support/react-context": "2.5.
|
|
63
|
+
"@rh-support/react-context": "2.5.60",
|
|
64
64
|
"@rh-support/types": "2.0.5",
|
|
65
65
|
"@rh-support/user-permissions": "2.5.20",
|
|
66
66
|
"@rh-support/utils": "2.5.19",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"defaults and supports es6-module",
|
|
136
136
|
"maintained node versions"
|
|
137
137
|
],
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "496bf698365697ff751a8edf712284454440d6ea"
|
|
139
139
|
}
|