@rh-support/troubleshoot 2.6.240 → 2.6.245
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/TroubleshootSection/AskRedHat.d.ts.map +1 -1
- package/lib/esm/components/TroubleshootSection/AskRedHat.js +27 -2
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.d.ts.map +1 -1
- package/lib/esm/components/TroubleshootSection/TroubleshootSection.js +17 -3
- package/lib/esm/components/wizardLayout/WizardNavigation.d.ts.map +1 -1
- package/lib/esm/components/wizardLayout/WizardNavigation.js +5 -2
- package/lib/esm/css/AskRedHat.css +31 -0
- package/lib/esm/hooks/useARHResponse.d.ts.map +1 -1
- package/lib/esm/hooks/useARHResponse.js +23 -13
- package/lib/esm/reducers/AIResponseConstNTypes.d.ts +5 -0
- package/lib/esm/reducers/AIResponseConstNTypes.d.ts.map +1 -1
- package/lib/esm/reducers/AIResponseConstNTypes.js +6 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AskRedHat.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/AskRedHat.tsx"],"names":[],"mappings":"AAyBA,OAAO,
|
|
1
|
+
{"version":3,"file":"AskRedHat.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/AskRedHat.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAmChF,UAAU,MAAM;IACZ,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,GAAI,uBAAuB,MAAM,sBAoiBtD,CAAC"}
|
|
@@ -12,9 +12,9 @@ import { sendRHDirectMessageFeedback } from '@ifd-ui/ask-redhat-core';
|
|
|
12
12
|
import { Button, Card, CardBody, CardHeader, Content, ContentVariants, EmptyState, EmptyStateBody, EmptyStateFooter, EmptyStateVariant, Icon, Label, Modal, ModalVariant, Skeleton, Spinner, } from '@patternfly/react-core';
|
|
13
13
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
|
|
14
14
|
import { useFetch } from '@rh-support/components';
|
|
15
|
-
import { dtmTrackEventAskRedhat } from '@rh-support/utils';
|
|
15
|
+
import { dtmTrackEventAskRedhat, isFunctionalCookieAccepted } from '@rh-support/utils';
|
|
16
16
|
import isEqual from 'lodash/isEqual';
|
|
17
|
-
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
17
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
18
18
|
import { Trans, useTranslation } from 'react-i18next';
|
|
19
19
|
import { MODAL_MESSAGES, QUICK_RESPONSES, TOOLTIP_MESSAGES } from '../../constants/askRedHatMessages';
|
|
20
20
|
import { useAIResponseDispatch, useAIResponseState } from '../../context/AIResponseContext';
|
|
@@ -208,6 +208,31 @@ export const AskRedHat = ({ onChatWithAIClick }) => {
|
|
|
208
208
|
navigator.clipboard.writeText(answer);
|
|
209
209
|
} }, TOOLTIP_MESSAGES.copy),
|
|
210
210
|
};
|
|
211
|
+
const isFunctionalCookieEnabled = useMemo(() => isFunctionalCookieAccepted(), []);
|
|
212
|
+
const handleManagePreferences = () => {
|
|
213
|
+
var _a, _b;
|
|
214
|
+
if (typeof ((_b = (_a = window.truste) === null || _a === void 0 ? void 0 : _a.eu) === null || _b === void 0 ? void 0 : _b.clickListener) === 'function') {
|
|
215
|
+
window.truste.eu.clickListener();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
if (!isFunctionalCookieEnabled) {
|
|
219
|
+
return (React.createElement("div", { className: "ask-redhat" },
|
|
220
|
+
React.createElement("p", { className: "ask-redhat-title" },
|
|
221
|
+
React.createElement(StarIcon, { width: 20, height: 20 }),
|
|
222
|
+
isCaseCreate ? t('Resolve your issue now with AI insights') : t('Troubleshoot with AI insights'),
|
|
223
|
+
React.createElement(Label, { variant: "outline" },
|
|
224
|
+
React.createElement(Trans, null, "PREVIEW"))),
|
|
225
|
+
React.createElement("div", { className: "ask-redhat-cookie-error" },
|
|
226
|
+
React.createElement("div", { className: "ask-redhat-cookie-error__heading" },
|
|
227
|
+
React.createElement(Icon, { iconSize: "md", status: "danger" },
|
|
228
|
+
React.createElement(ExclamationCircleIcon, null)),
|
|
229
|
+
React.createElement("h4", null,
|
|
230
|
+
React.createElement(Trans, null, "Functional cookies not enabled"))),
|
|
231
|
+
React.createElement("p", { className: "ask-redhat-cookie-error__body" },
|
|
232
|
+
React.createElement(Trans, null, "To access this feature, functional cookies must be turned on. After updating your preferences, you may need to refresh the page.")),
|
|
233
|
+
React.createElement(Button, { variant: "primary", onClick: handleManagePreferences },
|
|
234
|
+
React.createElement(Trans, null, "Manage preferences")))));
|
|
235
|
+
}
|
|
211
236
|
if (aiResponseState.isRateLimited) {
|
|
212
237
|
return (React.createElement("div", { className: "ask-redhat" },
|
|
213
238
|
React.createElement("p", { className: "ask-redhat-title" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TroubleshootSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/TroubleshootSection.tsx"],"names":[],"mappings":"AAAA,OAAO,6CAA6C,CAAC;AAkBrD,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"TroubleshootSection.d.ts","sourceRoot":"","sources":["../../../../src/components/TroubleshootSection/TroubleshootSection.tsx"],"names":[],"mappings":"AAAA,OAAO,6CAA6C,CAAC;AAkBrD,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAWvD,OAAO,EAAoB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAmCpF,UAAU,MAAM;IACZ,UAAU,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACjD,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,KA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hat-c
|
|
|
13
13
|
import { Button, Card, CardBody, CardHeader, Tooltip } from '@patternfly/react-core';
|
|
14
14
|
import InfoCircleIcon from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
|
|
15
15
|
import { ErrorBoundary, LoadingDots } from '@rh-support/components';
|
|
16
|
-
import { PreviousCaseTypes } from '@rh-support/utils';
|
|
16
|
+
import { getValidUUID, isFunctionalCookieAccepted, PreviousCaseTypes } from '@rh-support/utils';
|
|
17
17
|
import i18next from 'i18next';
|
|
18
18
|
import isEmpty from 'lodash/isEmpty';
|
|
19
19
|
import isEqual from 'lodash/isEqual';
|
|
@@ -25,6 +25,7 @@ import { RouteContext } from '../../context/RouteContext';
|
|
|
25
25
|
import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../../context/SessionRestoreContext';
|
|
26
26
|
import { TCStateContext } from '../../context/TopContentContext';
|
|
27
27
|
import { useAB } from '../../hooks/useAB';
|
|
28
|
+
import { ARHConversationErrorType } from '../../reducers/AIResponseConstNTypes';
|
|
28
29
|
import { setHasChunkReceived, updateConversationId } from '../../reducers/AIResponseReducer';
|
|
29
30
|
import { appSourceId_ARH, excludedCaseTypesforARH } from '../../reducers/CaseConstNTypes';
|
|
30
31
|
import { AppRouteSections } from '../../reducers/RouteConstNTypes';
|
|
@@ -236,9 +237,22 @@ function TroubleshootSection(props) {
|
|
|
236
237
|
(!isVariationA && ((_f = aiResponseState.aiResponse) === null || _f === void 0 ? void 0 : _f.conversationId) && ((_g = props.haveARHFieldsChangedForBRef) === null || _g === void 0 ? void 0 : _g.current))
|
|
237
238
|
? detailedQuestion
|
|
238
239
|
: '';
|
|
239
|
-
const firstUserMessage = isVariationA &&
|
|
240
|
+
const firstUserMessage = isVariationA &&
|
|
241
|
+
!((_h = aiResponseState.aiResponse) === null || _h === void 0 ? void 0 : _h.conversationId) &&
|
|
242
|
+
!hasFirstMessageSentRef.current &&
|
|
243
|
+
isFunctionalCookieAccepted()
|
|
240
244
|
? detailedQuestion
|
|
241
245
|
: '';
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
var _a;
|
|
248
|
+
if (!isFunctionalCookieAccepted() && activeSessionId) {
|
|
249
|
+
const sessionDetails = (_a = previousSessions.data[activeSessionId]) === null || _a === void 0 ? void 0 : _a.sessionDetails;
|
|
250
|
+
updateSession(sessionRestoreDispatch, activeSessionId, sessionDetails, {
|
|
251
|
+
conversationId: ARHConversationErrorType.FUNCTIONAL_COOKIE_NOT_ACCEPTED,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
255
|
+
}, [activeSessionId]);
|
|
242
256
|
// Reset haveNewARHFieldsChangedRef after 100ms on mount
|
|
243
257
|
useEffect(() => {
|
|
244
258
|
const timer = setTimeout(() => {
|
|
@@ -274,7 +288,7 @@ function TroubleshootSection(props) {
|
|
|
274
288
|
appEnv: Env.getEnvName(),
|
|
275
289
|
showWelcomeMessage: false,
|
|
276
290
|
firstUserMessage: firstUserMessage,
|
|
277
|
-
conversationId: (_l = (_k = aiResponseState.aiResponse) === null || _k === void 0 ? void 0 : _k.conversationId) !== null && _l !== void 0 ? _l : '',
|
|
291
|
+
conversationId: (_l = getValidUUID((_k = aiResponseState.aiResponse) === null || _k === void 0 ? void 0 : _k.conversationId)) !== null && _l !== void 0 ? _l : '',
|
|
278
292
|
latestUserMessage: latestUserMessage,
|
|
279
293
|
enableHeaderMenu: false,
|
|
280
294
|
enableTheme: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WizardNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/wizardLayout/WizardNavigation.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAUv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AAY,CAAC,EAAE,OAAO,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAGD,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,qBAkbtC;kBAlbQ,gBAAgB;;;AAobzB,eAAe,gBAAgB,CAAC"}
|
|
@@ -11,7 +11,7 @@ import { pcm } from '@cee-eng/hydrajs';
|
|
|
11
11
|
import { Button, ButtonVariant, WizardFooterWrapper } from '@patternfly/react-core';
|
|
12
12
|
import { useFetch, usePrevious } from '@rh-support/components';
|
|
13
13
|
import { GlobalMetadataStateContext, useCanCreateCase } from '@rh-support/react-context';
|
|
14
|
-
import { dtmTrackEventCaseCreationStepEncountered, getResTypeFromUrl, PreviousToNewCaseTypeMap, scrollIntoView, } from '@rh-support/utils';
|
|
14
|
+
import { dtmTrackEventCaseCreationStepEncountered, getResTypeFromUrl, isFunctionalCookieAccepted, PreviousToNewCaseTypeMap, scrollIntoView, } from '@rh-support/utils';
|
|
15
15
|
import find from 'lodash/find';
|
|
16
16
|
import isEmpty from 'lodash/isEmpty';
|
|
17
17
|
import isEqual from 'lodash/isEqual';
|
|
@@ -283,7 +283,10 @@ function WizardNavigation(props) {
|
|
|
283
283
|
React.createElement(WizardFooterWrapper, null,
|
|
284
284
|
shouldShowNewARHFlowFooterButtons ? (React.createElement(React.Fragment, null,
|
|
285
285
|
props.activeStep.order !== 0 && (React.createElement("button", { onClick: () => onBack({}), className: "btn btn-app btn-open-white main-nav-button", "data-tracking-id": `prev-of-${activeSection}`, type: "button" }, t('Go back'))),
|
|
286
|
-
React.createElement("button", { onClick: props.onSeeMoreResources, className: "btn btn-app btn-primary main-nav-button", type: "button", disabled:
|
|
286
|
+
React.createElement("button", { onClick: props.onSeeMoreResources, className: "btn btn-app btn-primary main-nav-button", type: "button", disabled: isFunctionalCookieAccepted() &&
|
|
287
|
+
props.aiServicesAvailable &&
|
|
288
|
+
!aiResponseState.hasChunkReceived &&
|
|
289
|
+
!aiResponseState.error }, t('See more resources')))) : props.isAIChatMode && activeSection === AppRouteSections.RESOURCES ? (isCaseCreate ? (React.createElement("span", null,
|
|
287
290
|
React.createElement(Trans, { i18nKey: "<span>Return to</span> <button>case creation</button>", components: {
|
|
288
291
|
span: React.createElement("span", { className: "return-to-case-text" }),
|
|
289
292
|
button: (React.createElement(Button, { className: "return-to-case-btn", variant: "link", component: "a", onClick: props.onReturnToCaseCreation })),
|
|
@@ -462,3 +462,34 @@ body:has(.pf-chatbot--embedded) .hide-for-askredhat {
|
|
|
462
462
|
.ask-redhat-core .pf-chatbot__expand-collapse-button:focus .pf-v6-c-button__text {
|
|
463
463
|
color: #151515 !important;
|
|
464
464
|
}
|
|
465
|
+
|
|
466
|
+
.ask-redhat-cookie-error {
|
|
467
|
+
display: flex;
|
|
468
|
+
flex-direction: column;
|
|
469
|
+
align-items: center;
|
|
470
|
+
gap: 16px;
|
|
471
|
+
padding: 24px;
|
|
472
|
+
border: 1px solid var(--pf-v6-global--BorderColor--100, #c7c7c7);
|
|
473
|
+
border-radius: var(--pf-t--global--border--radius--small, 6px);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.ask-redhat-cookie-error__heading {
|
|
477
|
+
display: flex;
|
|
478
|
+
align-items: center;
|
|
479
|
+
justify-content: center;
|
|
480
|
+
gap: 8px;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.ask-redhat-cookie-error__heading h4 {
|
|
484
|
+
margin: 0;
|
|
485
|
+
font-size: 16px;
|
|
486
|
+
font-weight: 500;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.ask-redhat-cookie-error__body {
|
|
490
|
+
text-align: center;
|
|
491
|
+
font-size: 14px;
|
|
492
|
+
line-height: 21px;
|
|
493
|
+
max-width: 535px;
|
|
494
|
+
margin: 0;
|
|
495
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useARHResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/useARHResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useARHResponse.d.ts","sourceRoot":"","sources":["../../../src/hooks/useARHResponse.ts"],"names":[],"mappings":"AAuBA;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,wEAQ5B;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;;CAoGA,CAAC"}
|
|
@@ -8,11 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { askRHDirectAIResponse, getRHDirectConversationQuota, } from '@ifd-ui/ask-redhat-core';
|
|
11
|
+
import { getValidUUID, isFunctionalCookieAccepted } from '@rh-support/utils';
|
|
11
12
|
import i18n from 'i18next';
|
|
12
13
|
import { useCallback, useContext } from 'react';
|
|
13
14
|
import { generateAIQuestion } from '../components/wizardLayout/WizardMain';
|
|
14
15
|
import { useAIResponseDispatch } from '../context/AIResponseContext';
|
|
15
16
|
import { SessionRestoreDispatchContext, SessionRestoreStateContext } from '../context/SessionRestoreContext';
|
|
17
|
+
import { ARHConversationErrorType } from '../reducers/AIResponseConstNTypes';
|
|
16
18
|
import { streamingChunkReceived, streamingCompleted, streamingError, streamingStarted, updateQuotaLimit, } from '../reducers/AIResponseReducer';
|
|
17
19
|
import { updateSession } from '../reducers/SessionRestoreReducer';
|
|
18
20
|
/**
|
|
@@ -22,9 +24,21 @@ export const useARHResponse = ({ activeSection, product, version, summary, issue
|
|
|
22
24
|
const aiResponseDispatch = useAIResponseDispatch();
|
|
23
25
|
const { sessionRestore } = useContext(SessionRestoreStateContext);
|
|
24
26
|
const sessionRestoreDispatch = useContext(SessionRestoreDispatchContext);
|
|
27
|
+
const persistConversationId = useCallback((conversationId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
29
|
+
if (!sessionRestore.activeSessionId)
|
|
30
|
+
return;
|
|
31
|
+
const sessionDetails = (_a = sessionRestore.previousSessions.data[sessionRestore.activeSessionId]) === null || _a === void 0 ? void 0 : _a.sessionDetails;
|
|
32
|
+
yield updateSession(sessionRestoreDispatch, sessionRestore.activeSessionId, sessionDetails, {
|
|
33
|
+
conversationId,
|
|
34
|
+
});
|
|
35
|
+
}), [sessionRestore.activeSessionId, sessionRestore.previousSessions.data, sessionRestoreDispatch]);
|
|
25
36
|
const fetchARHResponse = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
37
|
var _a;
|
|
27
38
|
try {
|
|
39
|
+
if (!isFunctionalCookieAccepted()) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
28
42
|
// Check conversation quota
|
|
29
43
|
const quotaResponse = yield getRHDirectConversationQuota(config);
|
|
30
44
|
// Update quota limit in state
|
|
@@ -32,6 +46,7 @@ export const useARHResponse = ({ activeSection, product, version, summary, issue
|
|
|
32
46
|
// Check if quota is exceeded
|
|
33
47
|
if (quotaResponse.quota.used >= quotaResponse.quota.limit) {
|
|
34
48
|
aiResponseDispatch(streamingError('Chat limit reached', true));
|
|
49
|
+
yield persistConversationId(ARHConversationErrorType.ARH_LIMIT_EXCEEDED);
|
|
35
50
|
return;
|
|
36
51
|
}
|
|
37
52
|
}
|
|
@@ -46,26 +61,21 @@ export const useARHResponse = ({ activeSection, product, version, summary, issue
|
|
|
46
61
|
aiResponseDispatch(streamingChunkReceived(chunk, accumulatedResponse));
|
|
47
62
|
},
|
|
48
63
|
onComplete: (finalResponse) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
var _a;
|
|
50
64
|
aiResponseDispatch(streamingCompleted(finalResponse));
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const sessionDetails = (_a = sessionRestore.previousSessions.data[sessionRestore.activeSessionId]) === null || _a === void 0 ? void 0 : _a.sessionDetails;
|
|
54
|
-
const newSession = {
|
|
55
|
-
conversationId: finalResponse.conversationId,
|
|
56
|
-
};
|
|
57
|
-
yield updateSession(sessionRestoreDispatch, sessionRestore.activeSessionId, sessionDetails, newSession);
|
|
65
|
+
if (finalResponse.conversationId) {
|
|
66
|
+
yield persistConversationId(finalResponse.conversationId);
|
|
58
67
|
}
|
|
59
68
|
}),
|
|
60
|
-
onError: (error) => {
|
|
69
|
+
onError: (error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
70
|
aiResponseDispatch(streamingError(error));
|
|
62
|
-
|
|
71
|
+
yield persistConversationId(ARHConversationErrorType.AI_RESPONSE_ERROR);
|
|
72
|
+
}),
|
|
63
73
|
};
|
|
64
74
|
aiResponseDispatch(streamingStarted());
|
|
65
75
|
try {
|
|
66
76
|
// Get existing conversation ID from session
|
|
67
77
|
const currentSessionItem = sessionRestore.previousSessions.data[sessionRestore.activeSessionId];
|
|
68
|
-
const existingConversationId = (_a = currentSessionItem === null || currentSessionItem === void 0 ? void 0 : currentSessionItem.session) === null || _a === void 0 ? void 0 : _a.conversationId;
|
|
78
|
+
const existingConversationId = getValidUUID((_a = currentSessionItem === null || currentSessionItem === void 0 ? void 0 : currentSessionItem.session) === null || _a === void 0 ? void 0 : _a.conversationId);
|
|
69
79
|
yield askRHDirectAIResponse(detailedQuestion, config, true, // response to be streamed or not
|
|
70
80
|
existingConversationId, streamingCallbacks);
|
|
71
81
|
}
|
|
@@ -81,10 +91,10 @@ export const useARHResponse = ({ activeSection, product, version, summary, issue
|
|
|
81
91
|
issue,
|
|
82
92
|
caseType,
|
|
83
93
|
aiResponseDispatch,
|
|
94
|
+
persistConversationId,
|
|
95
|
+
config,
|
|
84
96
|
sessionRestore.activeSessionId,
|
|
85
97
|
sessionRestore.previousSessions.data,
|
|
86
|
-
sessionRestoreDispatch,
|
|
87
|
-
config,
|
|
88
98
|
]);
|
|
89
99
|
return { fetchARHResponse };
|
|
90
100
|
};
|
|
@@ -16,6 +16,11 @@ export interface IAIResponseState {
|
|
|
16
16
|
hasChunkReceived?: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const initialAIResponseState: IAIResponseState;
|
|
19
|
+
export declare enum ARHConversationErrorType {
|
|
20
|
+
AI_RESPONSE_ERROR = "error_in_arh_ai_response",
|
|
21
|
+
FUNCTIONAL_COOKIE_NOT_ACCEPTED = "functional_cookie_not_accepted",
|
|
22
|
+
ARH_LIMIT_EXCEEDED = "arh_limit_exceeded"
|
|
23
|
+
}
|
|
19
24
|
export declare enum AIResponseConstants {
|
|
20
25
|
clearAIResponse = "clearAIResponse",
|
|
21
26
|
streamingStarted = "streamingStarted",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIResponseConstNTypes.d.ts","sourceRoot":"","sources":["../../../src/reducers/AIResponseConstNTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;CACjB;AAGD,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sBAAsB,EAAE,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAGD,eAAO,MAAM,sBAAsB,EAAE,gBAWpC,CAAC;
|
|
1
|
+
{"version":3,"file":"AIResponseConstNTypes.d.ts","sourceRoot":"","sources":["../../../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uB,GACvB,6BAA6B,GAC7B,yBAAyB,GACzB,qBAAqB,GACrB,+BAA+B,GAC/B,kCAAkC,GAClC,uBAAuB,GACvB,2BAA2B,GAC3B,0BAA0B,CAAC"}
|
|
@@ -11,6 +11,12 @@ export const initialAIResponseState = {
|
|
|
11
11
|
quotaLimit: undefined,
|
|
12
12
|
hasChunkReceived: false,
|
|
13
13
|
};
|
|
14
|
+
export var ARHConversationErrorType;
|
|
15
|
+
(function (ARHConversationErrorType) {
|
|
16
|
+
ARHConversationErrorType["AI_RESPONSE_ERROR"] = "error_in_arh_ai_response";
|
|
17
|
+
ARHConversationErrorType["FUNCTIONAL_COOKIE_NOT_ACCEPTED"] = "functional_cookie_not_accepted";
|
|
18
|
+
ARHConversationErrorType["ARH_LIMIT_EXCEEDED"] = "arh_limit_exceeded";
|
|
19
|
+
})(ARHConversationErrorType || (ARHConversationErrorType = {}));
|
|
14
20
|
// Action Constants
|
|
15
21
|
export var AIResponseConstants;
|
|
16
22
|
(function (AIResponseConstants) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rh-support/troubleshoot",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.245",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@cee-eng/hydrajs": "4.18.107",
|
|
49
49
|
"@cee-eng/ui-toolkit": "1.1.9",
|
|
50
|
-
"@ifd-ui/ask-redhat-core": "^0.0.
|
|
50
|
+
"@ifd-ui/ask-redhat-core": "^0.0.55",
|
|
51
51
|
"@patternfly/patternfly": "6.2.1",
|
|
52
52
|
"@patternfly/react-core": "6.2.1",
|
|
53
53
|
"@patternfly/react-table": "6.2.1",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"@progress/kendo-licensing": "1.3.5",
|
|
56
56
|
"@progress/kendo-react-pdf": "^5.16.0",
|
|
57
57
|
"@redux-devtools/extension": "^3.3.0",
|
|
58
|
-
"@rh-support/components": "2.5.
|
|
59
|
-
"@rh-support/react-context": "2.5.
|
|
58
|
+
"@rh-support/components": "2.5.155",
|
|
59
|
+
"@rh-support/react-context": "2.5.245",
|
|
60
60
|
"@rh-support/types": "2.0.15",
|
|
61
|
-
"@rh-support/user-permissions": "2.5.
|
|
62
|
-
"@rh-support/utils": "2.5.
|
|
61
|
+
"@rh-support/user-permissions": "2.5.102",
|
|
62
|
+
"@rh-support/utils": "2.5.82",
|
|
63
63
|
"@types/react-redux": "^7.1.33",
|
|
64
64
|
"@types/redux": "^3.6.0",
|
|
65
65
|
"date-fns": "3.6.0",
|
|
@@ -129,5 +129,5 @@
|
|
|
129
129
|
"defaults and supports es6-module",
|
|
130
130
|
"maintained node versions"
|
|
131
131
|
],
|
|
132
|
-
"gitHead": "
|
|
132
|
+
"gitHead": "e6c7d823ad0d71202cd1d8f3a58cc4710663dc3a"
|
|
133
133
|
}
|