@box/box-ai-content-answers 0.129.11 → 0.130.0
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/chunks/types.js +13 -7
- package/dist/esm/index.js +20 -18
- package/dist/esm/lib/components/answer/answer.js +48 -46
- package/dist/esm/lib/components/answer/thumb-buttons.js +47 -45
- package/dist/esm/lib/components/api-wrapper/records.js +16 -15
- package/dist/esm/lib/components/api-wrapper/utils/format.js +7 -5
- package/dist/esm/lib/components/chat/chat.js +33 -31
- package/dist/esm/lib/components/footer/footer.js +101 -93
- package/dist/esm/lib/components/suggested-questions/suggested-questions.js +56 -51
- package/dist/esm/lib/components/suggested-questions/suggestions.js +32 -32
- package/dist/types/lib/components/answer/answer.d.ts +2 -1
- package/dist/types/lib/components/answer/thumb-buttons.d.ts +3 -2
- package/dist/types/lib/components/footer/footer.d.ts +3 -3
- package/dist/types/lib/components/suggested-questions/suggested-questions.d.ts +2 -2
- package/dist/types/lib/components/suggested-questions/suggestions.d.ts +2 -2
- package/dist/types/lib/types.d.ts +12 -2
- package/package.json +1 -1
package/dist/chunks/types.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
let
|
|
1
|
+
let t = /* @__PURE__ */ function(e) {
|
|
2
2
|
return e.GENERAL = "general", e.RATE_LIMITING = "rate_limiting", e.NO_CONTENT = "no_content", e.PRECONDITION_FAILED = "precondition_failed", e.AGENT_NOT_FOUND = "agent_not_found", e.RESPONSE_FAILED = "response_failed", e.RESPONSE_INTERRUPTED = "response_interrupted", e.RESPONSE_STOPPED = "response_stopped", e;
|
|
3
|
-
}({}),
|
|
3
|
+
}({}), n = /* @__PURE__ */ function(e) {
|
|
4
4
|
return e.LARGE_FILE = "large_file", e.GENERAL = "general", e;
|
|
5
5
|
}({}), r = /* @__PURE__ */ function(e) {
|
|
6
6
|
return e.NOT_STARTED = "not_started", e.IN_PROGRESS = "in_progress", e.SUCCESS = "success", e.ERROR = "error", e.CANCELLED = "cancelled", e;
|
|
7
|
-
}({}),
|
|
7
|
+
}({}), s = /* @__PURE__ */ function(e) {
|
|
8
|
+
return e.CUSTOM = "suggested_question_custom", e.INTELLIGENT = "suggested_question_intelligent", e.STATIC = "suggested_question_static", e;
|
|
9
|
+
}({});
|
|
10
|
+
const o = "user_input";
|
|
11
|
+
let i = /* @__PURE__ */ function(e) {
|
|
8
12
|
return e.DID_NOT_FOLLOW_REQUEST = "did_not_follow_request", e.INACCURATE_ANSWER = "inaccurate_answer", e.OTHER = "other", e;
|
|
9
13
|
}({});
|
|
10
14
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r as R
|
|
15
|
+
t as A,
|
|
16
|
+
n as C,
|
|
17
|
+
i as F,
|
|
18
|
+
r as R,
|
|
19
|
+
s as S,
|
|
20
|
+
o as U
|
|
15
21
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
|
|
2
|
-
import { AnswerContent as
|
|
3
|
-
import { withApiWrapper as
|
|
4
|
-
import { C as
|
|
5
|
-
import { IntelligenceModal as
|
|
6
|
-
import { IntelligenceSidebar as
|
|
7
|
-
import { APP_MODE as
|
|
8
|
-
import { usePromptFocus as
|
|
9
|
-
import { A as
|
|
2
|
+
import { AnswerContent as s } from "./lib/components/answer/answer-content.js";
|
|
3
|
+
import { withApiWrapper as E } from "./lib/components/api-wrapper/api-wrapper.js";
|
|
4
|
+
import { C as n } from "../chunks/clear-conversation-button.js";
|
|
5
|
+
import { IntelligenceModal as R } from "./lib/components/modal/modal.js";
|
|
6
|
+
import { IntelligenceSidebar as x } from "./lib/components/sidebar/sidebar.js";
|
|
7
|
+
import { APP_MODE as _ } from "./lib/constants.js";
|
|
8
|
+
import { usePromptFocus as S } from "./lib/hooks/usePromptFocus.js";
|
|
9
|
+
import { A as i, C, F as O, R as l, S as U, U as I } from "../chunks/types.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
i as ANSWER_ERROR,
|
|
12
|
+
_ as APP_MODE,
|
|
13
|
+
s as AnswerContent,
|
|
14
14
|
r as BoxAiContentAnswers,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
C as CONTENT_ERROR,
|
|
16
|
+
n as ClearConversationButton,
|
|
17
17
|
O as FeedbackIssueType,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
R as IntelligenceModal,
|
|
19
|
+
x as IntelligenceSidebar,
|
|
20
|
+
l as REQUEST_STATE,
|
|
21
|
+
U as SUGGESTED_QUESTION_PROMPT_TYPE,
|
|
22
|
+
I as USER_INPUT_PROMPT_TYPE,
|
|
23
|
+
S as usePromptFocus,
|
|
24
|
+
E as withApiWrapper
|
|
23
25
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { Gray65 as
|
|
1
|
+
import { Text as k } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as j } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Gray65 as z, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
4
|
import p from "clsx";
|
|
5
5
|
import * as l from "react";
|
|
6
|
-
import { useIntl as
|
|
6
|
+
import { useIntl as W } from "react-intl";
|
|
7
7
|
import { A as n } from "../../../../chunks/types.js";
|
|
8
8
|
import { MediaContainer as N } from "../common/media-container.js";
|
|
9
|
-
import { AnswerContent as
|
|
10
|
-
import { CopyButton as
|
|
11
|
-
import { InlineError as
|
|
12
|
-
import { ThumbButtons as K } from "./thumb-buttons.js";
|
|
9
|
+
import { AnswerContent as q } from "./answer-content.js";
|
|
10
|
+
import { CopyButton as J } from "./copy-button.js";
|
|
11
|
+
import { InlineError as K } from "./inline-error.js";
|
|
13
12
|
import { LoadingIndicator as Q } from "./loading-indicator.js";
|
|
14
13
|
import m from "./messages.js";
|
|
15
14
|
import { References as X } from "./references.js";
|
|
15
|
+
import { ThumbButtons as Y } from "./thumb-buttons.js";
|
|
16
16
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
17
|
-
import '../../../../styles/answer.css';const
|
|
18
|
-
answer:
|
|
19
|
-
alertIcon:
|
|
20
|
-
error:
|
|
21
|
-
footer:
|
|
22
|
-
copyButtonContainer:
|
|
23
|
-
feedbackButtonsContainer:
|
|
24
|
-
shouldHaveMarginTop:
|
|
25
|
-
shouldUseAnimation:
|
|
26
|
-
shouldAnimateHeight:
|
|
27
|
-
footerButtons:
|
|
28
|
-
iconAvatar:
|
|
29
|
-
buttonsVisible:
|
|
30
|
-
},
|
|
17
|
+
import '../../../../styles/answer.css';const Z = "_answer_140hd_1", $ = "_alertIcon_140hd_5", tt = "_error_140hd_8", ot = "_footer_140hd_12", et = "_copyButtonContainer_140hd_18", nt = "_feedbackButtonsContainer_140hd_19", st = "_shouldHaveMarginTop_140hd_23", rt = "_shouldUseAnimation_140hd_26", at = "_shouldAnimateHeight_140hd_30", it = "_footerButtons_140hd_34", dt = "_iconAvatar_140hd_40", ct = "_buttonsVisible_140hd_56", t = {
|
|
18
|
+
answer: Z,
|
|
19
|
+
alertIcon: $,
|
|
20
|
+
error: tt,
|
|
21
|
+
footer: ot,
|
|
22
|
+
copyButtonContainer: et,
|
|
23
|
+
feedbackButtonsContainer: nt,
|
|
24
|
+
shouldHaveMarginTop: st,
|
|
25
|
+
shouldUseAnimation: rt,
|
|
26
|
+
shouldAnimateHeight: at,
|
|
27
|
+
footerButtons: it,
|
|
28
|
+
iconAvatar: dt,
|
|
29
|
+
buttonsVisible: ct
|
|
30
|
+
}, lt = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), bt = /* @__PURE__ */ l.memo(({
|
|
31
31
|
answer: s,
|
|
32
32
|
citations: I,
|
|
33
33
|
error: o,
|
|
@@ -46,40 +46,41 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
|
|
|
46
46
|
onCitationClick: C,
|
|
47
47
|
onFeedbackFormSubmit: v,
|
|
48
48
|
onFeedbackTooltipOpenChange: M,
|
|
49
|
+
promptType: y,
|
|
49
50
|
recordAction: d,
|
|
50
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
51
|
-
useAnimation:
|
|
51
|
+
shouldFeedbackFormIncludeFeedbackText: D,
|
|
52
|
+
useAnimation: H = !0,
|
|
52
53
|
variant: r = "modal",
|
|
53
|
-
setAnswerFeedback:
|
|
54
|
-
questionId:
|
|
54
|
+
setAnswerFeedback: L,
|
|
55
|
+
questionId: U
|
|
55
56
|
}) => {
|
|
56
|
-
const _ =
|
|
57
|
+
const _ = lt.has(o), h = b && !s && !o, [x, F] = l.useState(i), {
|
|
57
58
|
formatMessage: c
|
|
58
|
-
} =
|
|
59
|
+
} = W();
|
|
59
60
|
l.useEffect(() => {
|
|
60
|
-
setTimeout(() =>
|
|
61
|
+
setTimeout(() => F(i), 0);
|
|
61
62
|
}, [i]);
|
|
62
|
-
const f = () => /* @__PURE__ */ e(
|
|
63
|
+
const f = () => /* @__PURE__ */ e(j, {
|
|
63
64
|
className: t.alertIcon,
|
|
64
|
-
color:
|
|
65
|
+
color: z,
|
|
65
66
|
"data-testid": "content-answers-error-alert-icon",
|
|
66
67
|
height: E,
|
|
67
68
|
role: "presentation",
|
|
68
69
|
width: E
|
|
69
|
-
}),
|
|
70
|
+
}), G = () => /* @__PURE__ */ a(k, {
|
|
70
71
|
as: "p",
|
|
71
72
|
className: t.error,
|
|
72
73
|
color: "textOnLightSecondary",
|
|
73
74
|
"data-testid": "content-answers-error",
|
|
74
75
|
variant: "caption",
|
|
75
76
|
children: [o === n.RESPONSE_INTERRUPTED && c(m.responseInterruptedError), o === n.RESPONSE_FAILED && c(m.responseFailedError), o === n.RESPONSE_STOPPED && c(m.responseStoppedError), o !== n.RESPONSE_STOPPED && f()]
|
|
76
|
-
}),
|
|
77
|
+
}), V = () => o !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
|
|
77
78
|
className: p(t.footerButtons, "footer-buttons-container", {
|
|
78
79
|
[t.buttonsVisible]: u
|
|
79
80
|
}),
|
|
80
81
|
children: [g ? /* @__PURE__ */ e("div", {
|
|
81
82
|
className: t.feedbackButtonsContainer,
|
|
82
|
-
children: /* @__PURE__ */ e(
|
|
83
|
+
children: /* @__PURE__ */ e(Y, {
|
|
83
84
|
feedbackValue: T,
|
|
84
85
|
hostAppName: A,
|
|
85
86
|
isFeedbackFormEnabled: O,
|
|
@@ -87,15 +88,16 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
|
|
|
87
88
|
items: B,
|
|
88
89
|
onFeedbackFormSubmit: v,
|
|
89
90
|
onFeedbackTooltipOpenChange: M,
|
|
90
|
-
|
|
91
|
+
promptType: y,
|
|
92
|
+
questionId: U,
|
|
91
93
|
recordAction: d,
|
|
92
|
-
setAnswerFeedback:
|
|
93
|
-
shouldFeedbackFormIncludeFeedbackText:
|
|
94
|
+
setAnswerFeedback: L,
|
|
95
|
+
shouldFeedbackFormIncludeFeedbackText: D,
|
|
94
96
|
variant: r
|
|
95
97
|
})
|
|
96
98
|
}) : null, /* @__PURE__ */ e("div", {
|
|
97
99
|
className: t.copyButtonContainer,
|
|
98
|
-
children: /* @__PURE__ */ e(
|
|
100
|
+
children: /* @__PURE__ */ e(J, {
|
|
99
101
|
answer: s,
|
|
100
102
|
onAnswerCopy: P,
|
|
101
103
|
recordAction: d
|
|
@@ -112,25 +114,25 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
|
|
|
112
114
|
children: /* @__PURE__ */ a(N.Content, {
|
|
113
115
|
isUsedInsideSidebar: r === "sidebar",
|
|
114
116
|
variant: "answer",
|
|
115
|
-
children: [/* @__PURE__ */ e(
|
|
117
|
+
children: [/* @__PURE__ */ e(q, {
|
|
116
118
|
answer: s,
|
|
117
119
|
isMarkdownEnabled: w,
|
|
118
120
|
variant: r
|
|
119
121
|
}), i && /* @__PURE__ */ a("div", {
|
|
120
122
|
className: p(t.footer, {
|
|
121
123
|
[t.shouldHaveMarginTop]: s,
|
|
122
|
-
[t.shouldAnimateHeight]:
|
|
123
|
-
[t.shouldUseAnimation]:
|
|
124
|
+
[t.shouldAnimateHeight]: x,
|
|
125
|
+
[t.shouldUseAnimation]: H
|
|
124
126
|
}),
|
|
125
127
|
"data-testid": "content-answers-answer-footer",
|
|
126
|
-
children: [o &&
|
|
128
|
+
children: [o && G(), R && !o && /* @__PURE__ */ e(X, {
|
|
127
129
|
citations: I,
|
|
128
130
|
onCitationClick: C,
|
|
129
131
|
recordAction: d
|
|
130
|
-
}),
|
|
132
|
+
}), V()]
|
|
131
133
|
})]
|
|
132
134
|
})
|
|
133
|
-
}), _ && /* @__PURE__ */ e(
|
|
135
|
+
}), _ && /* @__PURE__ */ e(K, {
|
|
134
136
|
contentType: S,
|
|
135
137
|
error: o,
|
|
136
138
|
recordAction: d,
|
|
@@ -139,6 +141,6 @@ import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertI
|
|
|
139
141
|
});
|
|
140
142
|
});
|
|
141
143
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
bt as Answer,
|
|
145
|
+
bt as default
|
|
144
146
|
};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { useNotification as
|
|
2
|
-
import { ThumbUp as
|
|
3
|
-
import { ThumbUp as
|
|
1
|
+
import { useNotification as E, Tooltip as T, IconButton as p } from "@box/blueprint-web";
|
|
2
|
+
import { ThumbUp as I, ThumbDown as S } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { ThumbUp as W, ThumbDown as d } from "@box/blueprint-web-assets/icons/Line";
|
|
4
4
|
import c from "react";
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { FeedbackTooltip as $ } from "./feedback-tooltip.js";
|
|
5
|
+
import { useIntl as $ } from "react-intl";
|
|
7
6
|
import { LOGGER_BASE_CONFIG as j, LOGGER_ACTION_PROGRAMMATIC as z } from "../common/constants.js";
|
|
8
|
-
import
|
|
7
|
+
import { FeedbackTooltip as A } from "./feedback-tooltip.js";
|
|
8
|
+
import M from "../../messages.js";
|
|
9
|
+
import { focusInput as J } from "../common/focusInputUtils.js";
|
|
9
10
|
import r from "./messages.js";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
thumbDown: Q
|
|
11
|
+
import { jsxs as K, Fragment as Q, jsx as f } from "react/jsx-runtime";
|
|
12
|
+
import '../../../../styles/thumb-buttons.css';const V = "_thumbDown_1axcd_1", X = {
|
|
13
|
+
thumbDown: V
|
|
14
14
|
}, u = {
|
|
15
15
|
THUMB_UP: "positive",
|
|
16
16
|
THUMB_DOWN: "negative",
|
|
17
17
|
NONE: "none"
|
|
18
|
-
},
|
|
19
|
-
feedbackValue:
|
|
18
|
+
}, mt = ({
|
|
19
|
+
feedbackValue: L,
|
|
20
20
|
hostAppName: _,
|
|
21
|
-
isFeedbackFormEnabled:
|
|
22
|
-
isFeedbackTooltipOpen:
|
|
23
|
-
items:
|
|
21
|
+
isFeedbackFormEnabled: y = !1,
|
|
22
|
+
isFeedbackTooltipOpen: w = !1,
|
|
23
|
+
items: h,
|
|
24
24
|
onFeedbackFormSubmit: D,
|
|
25
25
|
onFeedbackTooltipOpenChange: s,
|
|
26
|
+
promptType: N,
|
|
26
27
|
questionId: a,
|
|
27
28
|
recordAction: i,
|
|
28
29
|
setAnswerFeedback: o,
|
|
@@ -31,9 +32,9 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
|
|
|
31
32
|
}) => {
|
|
32
33
|
const {
|
|
33
34
|
formatMessage: m
|
|
34
|
-
} =
|
|
35
|
-
addNotification:
|
|
36
|
-
} =
|
|
35
|
+
} = $(), {
|
|
36
|
+
addNotification: x
|
|
37
|
+
} = E(), l = L, U = c.useMemo(() => h.filter((t) => t.status === "supported").map((t) => t.fileType), [h]), b = c.useCallback((t) => {
|
|
37
38
|
l !== t && (o == null || o(a, t), i == null || i({
|
|
38
39
|
...j,
|
|
39
40
|
action: z,
|
|
@@ -42,61 +43,62 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
|
|
|
42
43
|
data: {
|
|
43
44
|
feedback_value: t,
|
|
44
45
|
file_types: U,
|
|
45
|
-
feature: _
|
|
46
|
+
feature: _,
|
|
47
|
+
prompt_type: N
|
|
46
48
|
}
|
|
47
|
-
}),
|
|
48
|
-
}, [_, i, l, B, U, a, o]),
|
|
49
|
+
}), J());
|
|
50
|
+
}, [_, i, l, B, U, a, o]), H = ({
|
|
49
51
|
feedback: t,
|
|
50
|
-
issueType:
|
|
52
|
+
issueType: v
|
|
51
53
|
}) => {
|
|
52
54
|
if (s == null || s(!1, a), !D)
|
|
53
55
|
return;
|
|
54
|
-
const
|
|
56
|
+
const e = {
|
|
55
57
|
fileTypes: U,
|
|
56
58
|
hostApp: _,
|
|
57
|
-
issueType:
|
|
59
|
+
issueType: v,
|
|
58
60
|
timestamp: Date.now(),
|
|
59
61
|
questionId: a
|
|
60
62
|
};
|
|
61
|
-
n && (
|
|
62
|
-
|
|
63
|
+
n && (e.feedback = t, e.hasFeedback = !!t), D(e, () => {
|
|
64
|
+
x({
|
|
63
65
|
sensitivity: "foreground",
|
|
64
66
|
styledText: m(r.feedbackTooltipConfirmation),
|
|
65
67
|
variant: "success",
|
|
66
|
-
typeIconAriaLabel: m(
|
|
67
|
-
closeButtonAriaLabel: m(
|
|
68
|
+
typeIconAriaLabel: m(M.ariaTypeSuccessIconLabel),
|
|
69
|
+
closeButtonAriaLabel: m(M.closeButtonText)
|
|
68
70
|
});
|
|
69
71
|
});
|
|
70
|
-
},
|
|
72
|
+
}, G = (t) => {
|
|
71
73
|
t || s == null || s(!1, a);
|
|
72
|
-
},
|
|
74
|
+
}, P = c.useCallback(() => b(u.THUMB_UP), [b]), R = c.useCallback(() => {
|
|
73
75
|
b(u.THUMB_DOWN), s == null || s(!0, a);
|
|
74
76
|
}, [b, s, a]);
|
|
75
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ K(Q, {
|
|
76
78
|
children: [/* @__PURE__ */ f(T, {
|
|
77
79
|
content: m(r.thumbsUpAriaLabel),
|
|
78
|
-
children: /* @__PURE__ */ f(
|
|
80
|
+
children: /* @__PURE__ */ f(p, {
|
|
79
81
|
"aria-label": m(r.thumbsUpAriaLabel),
|
|
80
82
|
disabled: l === u.THUMB_DOWN,
|
|
81
|
-
icon: l === u.THUMB_UP ?
|
|
82
|
-
onClick:
|
|
83
|
+
icon: l === u.THUMB_UP ? I : W,
|
|
84
|
+
onClick: P,
|
|
83
85
|
size: "x-small",
|
|
84
86
|
"data-target-id": "IconButton-thumbsUpAriaLabel"
|
|
85
87
|
})
|
|
86
|
-
}), /* @__PURE__ */ f(
|
|
87
|
-
isOpen:
|
|
88
|
-
onOpenChange:
|
|
89
|
-
onSubmit:
|
|
88
|
+
}), /* @__PURE__ */ f(A, {
|
|
89
|
+
isOpen: w,
|
|
90
|
+
onOpenChange: G,
|
|
91
|
+
onSubmit: H,
|
|
90
92
|
shouldIncludeFeedbackText: n,
|
|
91
|
-
shouldShow:
|
|
93
|
+
shouldShow: y,
|
|
92
94
|
children: /* @__PURE__ */ f(T, {
|
|
93
95
|
content: m(r.thumbsDownAriaLabel),
|
|
94
|
-
children: /* @__PURE__ */ f(
|
|
96
|
+
children: /* @__PURE__ */ f(p, {
|
|
95
97
|
"aria-label": m(r.thumbsDownAriaLabel),
|
|
96
|
-
className:
|
|
98
|
+
className: X.thumbDown,
|
|
97
99
|
disabled: l === u.THUMB_UP,
|
|
98
|
-
icon: l === u.THUMB_DOWN ?
|
|
99
|
-
onClick:
|
|
100
|
+
icon: l === u.THUMB_DOWN ? S : d,
|
|
101
|
+
onClick: R,
|
|
100
102
|
size: "x-small",
|
|
101
103
|
"data-target-id": "IconButton-thumbsDownAriaLabel"
|
|
102
104
|
})
|
|
@@ -105,6 +107,6 @@ import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V
|
|
|
105
107
|
});
|
|
106
108
|
};
|
|
107
109
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
mt as ThumbButtons,
|
|
111
|
+
mt as default
|
|
110
112
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Record as e } from "immutable";
|
|
2
|
-
import { R as s } from "../../../../chunks/types.js";
|
|
3
|
-
const
|
|
2
|
+
import { R as s, U as n } from "../../../../chunks/types.js";
|
|
3
|
+
const o = e({
|
|
4
4
|
has_streamed_responses: !0,
|
|
5
5
|
has_citations_enabled: !1
|
|
6
|
-
}),
|
|
6
|
+
}), t = e({
|
|
7
7
|
type: "file",
|
|
8
8
|
id: null,
|
|
9
9
|
version_id: null
|
|
10
|
-
}),
|
|
10
|
+
}), r = e({
|
|
11
11
|
suggestions: [],
|
|
12
12
|
requestState: s.NOT_STARTED
|
|
13
|
-
}),
|
|
14
|
-
config: new
|
|
13
|
+
}), u = e({
|
|
14
|
+
config: new o(),
|
|
15
15
|
encodedSession: null,
|
|
16
16
|
contextSession: null,
|
|
17
17
|
error: null,
|
|
18
18
|
isLoading: !1,
|
|
19
19
|
hasRequestInProgress: !1,
|
|
20
|
-
item: new
|
|
20
|
+
item: new t(),
|
|
21
21
|
questions: [],
|
|
22
22
|
shouldShowLandingPage: !0,
|
|
23
|
-
suggestedQuestions: new
|
|
24
|
-
}),
|
|
23
|
+
suggestedQuestions: new r()
|
|
24
|
+
}), a = e({
|
|
25
25
|
answer: null,
|
|
26
26
|
citations: [],
|
|
27
27
|
created_at: null,
|
|
@@ -30,12 +30,13 @@ const n = e({
|
|
|
30
30
|
isLoading: !0,
|
|
31
31
|
error: null,
|
|
32
32
|
prompt: null,
|
|
33
|
-
feedbackValue: "none"
|
|
33
|
+
feedbackValue: "none",
|
|
34
|
+
promptType: n
|
|
34
35
|
});
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
o as ContentAnswersConfigRecord,
|
|
38
|
+
t as ContentAnswersItemRecord,
|
|
39
|
+
u as ContentAnswersRecord,
|
|
40
|
+
a as QuestionRecord,
|
|
41
|
+
r as SuggestedQuestionsRecord
|
|
41
42
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { S as i } from "../../../../../chunks/types.js";
|
|
2
|
+
const n = (e) => e.map((t) => ({
|
|
2
3
|
content: t.cited_text_content,
|
|
3
4
|
location: t.cited_text_location,
|
|
4
5
|
title: t.cited_doc_name,
|
|
5
6
|
fileId: t.cited_doc_id
|
|
6
|
-
})),
|
|
7
|
+
})), a = (e) => e.suggestedPrompts.map((t, o) => ({
|
|
7
8
|
prompt: t,
|
|
8
|
-
id: `suggestion-${o}
|
|
9
|
+
id: `suggestion-${o}`,
|
|
10
|
+
type: i.INTELLIGENT
|
|
9
11
|
}));
|
|
10
12
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
n as defaultFormatCitations,
|
|
14
|
+
a as defaultFormatSuggestions
|
|
13
15
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BoxAiLogo as
|
|
3
|
-
import { Text as K } from "@box/blueprint-web";
|
|
1
|
+
import { Text as J } from "@box/blueprint-web";
|
|
2
|
+
import { BoxAiLogo as K } from "@box/blueprint-web-assets/icons/Logo";
|
|
4
3
|
import { Size10 as d } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import
|
|
6
|
-
import V from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import U from "clsx";
|
|
5
|
+
import * as V from "react";
|
|
6
|
+
import { useIntl as X } from "react-intl";
|
|
7
|
+
import { Answer as Y } from "../answer/answer.js";
|
|
8
|
+
import { MediaContainer as Z } from "../common/media-container.js";
|
|
9
|
+
import { Question as $ } from "../question/question.js";
|
|
10
|
+
import { SuggestedQuestions as L } from "../suggested-questions/suggested-questions.js";
|
|
12
11
|
import P from "../welcome-message/messages.js";
|
|
12
|
+
import { WelcomeMessage as S } from "../welcome-message/welcome-message.js";
|
|
13
13
|
import { jsx as e, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
-
import '../../../../styles/chat.css';const
|
|
15
|
-
chat:
|
|
16
|
-
clearChatText:
|
|
17
|
-
landingPage:
|
|
18
|
-
askQuestionText:
|
|
19
|
-
iconAvatar:
|
|
20
|
-
sidebar:
|
|
21
|
-
},
|
|
14
|
+
import '../../../../styles/chat.css';const ee = "_chat_77vqr_1", te = "_clearChatText_77vqr_1", oe = "_landingPage_77vqr_7", ae = "_askQuestionText_77vqr_15", re = "_iconAvatar_77vqr_23", ie = "_sidebar_77vqr_39", a = {
|
|
15
|
+
chat: ee,
|
|
16
|
+
clearChatText: te,
|
|
17
|
+
landingPage: oe,
|
|
18
|
+
askQuestionText: ae,
|
|
19
|
+
iconAvatar: re,
|
|
20
|
+
sidebar: ie
|
|
21
|
+
}, be = ({
|
|
22
22
|
askSuggestedQuestion: f,
|
|
23
23
|
contentType: n,
|
|
24
24
|
hasCustomSuggestedQuestions: h,
|
|
@@ -48,33 +48,33 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
|
|
|
48
48
|
}) => {
|
|
49
49
|
const {
|
|
50
50
|
formatMessage: M
|
|
51
|
-
} =
|
|
51
|
+
} = X(), [w, z] = V.useState(null), B = (r, i) => {
|
|
52
52
|
z(r ? i : null);
|
|
53
53
|
};
|
|
54
54
|
return /* @__PURE__ */ e("div", {
|
|
55
55
|
className: a.chat,
|
|
56
56
|
"data-testid": "content-answers-chat",
|
|
57
57
|
children: /* @__PURE__ */ _("div", {
|
|
58
|
-
className:
|
|
58
|
+
className: U({
|
|
59
59
|
[a.landingPage]: o,
|
|
60
60
|
[a.sidebar]: t === "sidebar"
|
|
61
61
|
}),
|
|
62
|
-
children: [o && /* @__PURE__ */ e(
|
|
62
|
+
children: [o && /* @__PURE__ */ e(Z.Figure, {
|
|
63
63
|
variant: t,
|
|
64
64
|
children: /* @__PURE__ */ e("div", {
|
|
65
65
|
className: a.iconAvatar,
|
|
66
|
-
children: /* @__PURE__ */ e(
|
|
66
|
+
children: /* @__PURE__ */ e(K, {
|
|
67
67
|
height: d,
|
|
68
68
|
role: "presentation",
|
|
69
69
|
width: d
|
|
70
70
|
})
|
|
71
71
|
})
|
|
72
|
-
}), /* @__PURE__ */ e(
|
|
72
|
+
}), /* @__PURE__ */ e(S, {
|
|
73
73
|
contentType: "",
|
|
74
74
|
shouldShowLandingPage: o,
|
|
75
75
|
...p,
|
|
76
76
|
variant: t
|
|
77
|
-
}), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(
|
|
77
|
+
}), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(L, {
|
|
78
78
|
askSuggestedQuestion: f,
|
|
79
79
|
hasCustomSuggestedQuestions: h,
|
|
80
80
|
isLoading: x,
|
|
@@ -84,7 +84,7 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
|
|
|
84
84
|
suggestedQuestions: l,
|
|
85
85
|
suggestedQuestionsRequestState: N,
|
|
86
86
|
variant: t
|
|
87
|
-
}), /* @__PURE__ */ e(
|
|
87
|
+
}), /* @__PURE__ */ e(J, {
|
|
88
88
|
as: "p",
|
|
89
89
|
className: a.clearChatText,
|
|
90
90
|
children: y || M(P.welcomeClearChatText, {
|
|
@@ -99,17 +99,18 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
|
|
|
99
99
|
isLoading: W,
|
|
100
100
|
error: D,
|
|
101
101
|
prompt: E,
|
|
102
|
-
|
|
102
|
+
promptType: G,
|
|
103
|
+
feedbackValue: H
|
|
103
104
|
}) => /* @__PURE__ */ _("li", {
|
|
104
|
-
children: [/* @__PURE__ */ e(
|
|
105
|
+
children: [/* @__PURE__ */ e($, {
|
|
105
106
|
prompt: E,
|
|
106
107
|
variant: t
|
|
107
|
-
}), /* @__PURE__ */ e(
|
|
108
|
+
}), /* @__PURE__ */ e(Y, {
|
|
108
109
|
answer: r,
|
|
109
110
|
citations: i,
|
|
110
111
|
contentType: n,
|
|
111
112
|
error: D,
|
|
112
|
-
feedbackValue:
|
|
113
|
+
feedbackValue: H,
|
|
113
114
|
hostAppName: j,
|
|
114
115
|
isCitationsEnabled: T,
|
|
115
116
|
isCompleted: R,
|
|
@@ -123,6 +124,7 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
|
|
|
123
124
|
onCitationClick: k,
|
|
124
125
|
onFeedbackFormSubmit: u,
|
|
125
126
|
onFeedbackTooltipOpenChange: B,
|
|
127
|
+
promptType: G,
|
|
126
128
|
questionId: s,
|
|
127
129
|
recordAction: c,
|
|
128
130
|
setAnswerFeedback: I,
|
|
@@ -136,6 +138,6 @@ import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChat
|
|
|
136
138
|
});
|
|
137
139
|
};
|
|
138
140
|
export {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
be as Chat,
|
|
142
|
+
be as default
|
|
141
143
|
};
|
|
@@ -1,119 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import z from "clsx";
|
|
2
|
+
import V from "lodash/noop";
|
|
3
3
|
import * as r from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useBreakpoint as Z, Breakpoint as $, TextArea as
|
|
6
|
-
import { ArrowUp as
|
|
7
|
-
import { useAgents as
|
|
8
|
-
import { FooterActions as
|
|
9
|
-
import { s as
|
|
10
|
-
import { getAIAgentConfig as
|
|
11
|
-
import { isDebugModeTrigger as
|
|
12
|
-
import { TEXT_AREA as
|
|
4
|
+
import { useIntl as J } from "react-intl";
|
|
5
|
+
import { useBreakpoint as Z, Breakpoint as $, TextArea as q, Tooltip as Q, Button as g } from "@box/blueprint-web";
|
|
6
|
+
import { ArrowUp as tt } from "@box/blueprint-web-assets/icons/Fill";
|
|
7
|
+
import { useAgents as at } from "@box/box-ai-agent-selector";
|
|
8
|
+
import { FooterActions as rt } from "./footer-actions.js";
|
|
9
|
+
import { s as _, S as et } from "../../../../chunks/stopResponseButton.js";
|
|
10
|
+
import { getAIAgentConfig as R } from "../common/agentUtils.js";
|
|
11
|
+
import { isDebugModeTrigger as ot, isEnterTrigger as it } from "../common/keyInputUtils.js";
|
|
12
|
+
import { TEXT_AREA as n, INPUT_TARGET_ID as nt } from "./constants.js";
|
|
13
|
+
import { U as st } from "../../../../chunks/types.js";
|
|
13
14
|
import m from "./messages.js";
|
|
14
|
-
import { LOGGER_BASE_CONFIG as
|
|
15
|
-
import { jsxs as
|
|
16
|
-
const
|
|
17
|
-
askSuggestedQuestion:
|
|
18
|
-
enableDebugMode:
|
|
19
|
-
hasRequestInProgress:
|
|
20
|
-
isAIStudioAgentSelectorEnabled:
|
|
15
|
+
import { LOGGER_BASE_CONFIG as A, LOGGER_ACTION_CLICK as lt, LOGGER_ACTION_KEYPRESS as mt } from "../common/constants.js";
|
|
16
|
+
import { jsxs as v, jsx as u } from "react/jsx-runtime";
|
|
17
|
+
const Nt = ({
|
|
18
|
+
askSuggestedQuestion: c,
|
|
19
|
+
enableDebugMode: M = !1,
|
|
20
|
+
hasRequestInProgress: o,
|
|
21
|
+
isAIStudioAgentSelectorEnabled: C,
|
|
21
22
|
isDebugModeShown: b,
|
|
22
|
-
isStopResponseEnabled:
|
|
23
|
+
isStopResponseEnabled: B,
|
|
23
24
|
isStreamingEnabled: w,
|
|
24
|
-
lastQuestion:
|
|
25
|
-
onRetryQuestion:
|
|
25
|
+
lastQuestion: E,
|
|
26
|
+
onRetryQuestion: k,
|
|
26
27
|
onStopQuestion: X,
|
|
27
|
-
onUserInteraction:
|
|
28
|
-
recordAction:
|
|
29
|
-
sendQuestion:
|
|
28
|
+
onUserInteraction: d = V,
|
|
29
|
+
recordAction: i,
|
|
30
|
+
sendQuestion: L,
|
|
30
31
|
setAskSuggestedQuestion: x,
|
|
31
|
-
toggleDebugMode:
|
|
32
|
-
variant:
|
|
32
|
+
toggleDebugMode: s,
|
|
33
|
+
variant: y = "modal"
|
|
33
34
|
}) => {
|
|
34
|
-
const G =
|
|
35
|
-
selectedAgent:
|
|
36
|
-
} =
|
|
37
|
-
answer:
|
|
38
|
-
isCompleted:
|
|
39
|
-
} =
|
|
35
|
+
const G = y === "sidebar", l = J(), H = Z(), a = r.useRef(null), I = H <= $.Medium && !G ? n.MAX_ROWS_MOBILE : n.MAX_ROWS, [f, N] = r.useState(!0), [K, O] = r.useState(!1), {
|
|
36
|
+
selectedAgent: T
|
|
37
|
+
} = at(), {
|
|
38
|
+
answer: S,
|
|
39
|
+
isCompleted: F
|
|
40
|
+
} = E ?? {}, U = w && F === !1 && (B || S), h = r.useCallback(() => {
|
|
40
41
|
a.current && a.current.focus();
|
|
41
|
-
}, [a]),
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
let t = ((
|
|
45
|
-
a.current && t.length >
|
|
46
|
-
}, [a,
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
prompt: a.current.value
|
|
42
|
+
}, [a]), j = r.useCallback(() => {
|
|
43
|
+
var e;
|
|
44
|
+
d();
|
|
45
|
+
let t = ((e = a.current) == null ? void 0 : e.value) ?? "";
|
|
46
|
+
a.current && t.length > n.MAX_LENGTH && (a.current.value = t.slice(0, n.MAX_LENGTH), t = a.current.value), O(t.length >= n.MAX_LENGTH), N(t.trim().length === 0);
|
|
47
|
+
}, [a, d]), p = r.useCallback((t = st) => {
|
|
48
|
+
if (h(), !o && a.current) {
|
|
49
|
+
const e = {
|
|
50
|
+
prompt: a.current.value,
|
|
51
|
+
promptType: t
|
|
50
52
|
};
|
|
51
|
-
if (
|
|
52
|
-
const
|
|
53
|
-
|
|
53
|
+
if (e.prompt && e.prompt.trim()) {
|
|
54
|
+
const Y = R(C, T);
|
|
55
|
+
L(e, Y), a.current.value = "", N(!0), O(!1);
|
|
54
56
|
}
|
|
55
|
-
b &&
|
|
57
|
+
b && s && s();
|
|
56
58
|
}
|
|
57
|
-
}, [
|
|
58
|
-
t.preventDefault(), !
|
|
59
|
-
...
|
|
60
|
-
action:
|
|
59
|
+
}, [T, h, o, a, C, b, L, s]), D = r.useCallback((t) => {
|
|
60
|
+
t.preventDefault(), !o && !f && i && i({
|
|
61
|
+
...A,
|
|
62
|
+
action: lt,
|
|
61
63
|
target: "ask"
|
|
62
|
-
}),
|
|
63
|
-
}, [
|
|
64
|
-
|
|
65
|
-
...
|
|
66
|
-
action:
|
|
64
|
+
}), p();
|
|
65
|
+
}, [o, f, i, p]), P = r.useCallback((t) => {
|
|
66
|
+
M && s && ot(t) && s(), it(t) && (t.preventDefault(), !o && !f && i && i({
|
|
67
|
+
...A,
|
|
68
|
+
action: mt,
|
|
67
69
|
target: "ask"
|
|
68
|
-
}),
|
|
69
|
-
}, [
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
}, [
|
|
70
|
+
}), p());
|
|
71
|
+
}, [M, o, f, i, p, s]), W = r.useCallback((t) => {
|
|
72
|
+
const e = R(C, T);
|
|
73
|
+
k(t, e);
|
|
74
|
+
}, [T, C, k]);
|
|
73
75
|
return r.useEffect(() => {
|
|
74
|
-
queueMicrotask(
|
|
76
|
+
queueMicrotask(h);
|
|
75
77
|
}, []), r.useEffect(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
if (c && a.current && !o && x) {
|
|
79
|
+
const {
|
|
80
|
+
prompt: t,
|
|
81
|
+
type: e
|
|
82
|
+
} = c;
|
|
83
|
+
a.current.value = t, p(e), x(null);
|
|
84
|
+
}
|
|
85
|
+
}, [c == null ? void 0 : c.id]), /* @__PURE__ */ v("div", {
|
|
86
|
+
children: [E && /* @__PURE__ */ u(rt, {
|
|
87
|
+
lastQuestion: E,
|
|
88
|
+
onRetryButtonInteraction: d,
|
|
89
|
+
onRetryQuestion: W,
|
|
90
|
+
recordAction: i
|
|
91
|
+
}), /* @__PURE__ */ v("div", {
|
|
92
|
+
className: z(_.questionInput, G && _.sidebar),
|
|
93
|
+
children: [/* @__PURE__ */ u(q, {
|
|
86
94
|
ref: a,
|
|
87
|
-
className:
|
|
88
|
-
"data-target-id":
|
|
95
|
+
className: _.textArea,
|
|
96
|
+
"data-target-id": nt,
|
|
89
97
|
"data-testid": "content-answers-question-input",
|
|
90
|
-
error: K &&
|
|
91
|
-
characterLimit:
|
|
98
|
+
error: K && l.formatMessage(m.maxCharactersReachedError, {
|
|
99
|
+
characterLimit: n.MAX_LENGTH
|
|
92
100
|
}),
|
|
93
101
|
hideLabel: !0,
|
|
94
|
-
label:
|
|
95
|
-
maxLength:
|
|
96
|
-
maxRows:
|
|
97
|
-
onChange:
|
|
98
|
-
onKeyDown:
|
|
99
|
-
placeholder:
|
|
100
|
-
}),
|
|
101
|
-
lastQuestion:
|
|
102
|
+
label: l.formatMessage(m.askQuestionPlaceholder),
|
|
103
|
+
maxLength: n.MAX_LENGTH,
|
|
104
|
+
maxRows: I,
|
|
105
|
+
onChange: j,
|
|
106
|
+
onKeyDown: P,
|
|
107
|
+
placeholder: l.formatMessage(m.askQuestionPlaceholder)
|
|
108
|
+
}), U ? /* @__PURE__ */ u(et, {
|
|
109
|
+
lastQuestion: E,
|
|
102
110
|
onStopQuestion: X,
|
|
103
|
-
recordAction:
|
|
104
|
-
}) : /* @__PURE__ */ u(
|
|
105
|
-
content:
|
|
111
|
+
recordAction: i
|
|
112
|
+
}) : /* @__PURE__ */ u(Q, {
|
|
113
|
+
content: l.formatMessage(m.ask),
|
|
106
114
|
"data-testid": "ask-tooltip",
|
|
107
115
|
variant: "standard",
|
|
108
|
-
children: /* @__PURE__ */ u(
|
|
109
|
-
"aria-label":
|
|
110
|
-
className:
|
|
116
|
+
children: /* @__PURE__ */ u(g, {
|
|
117
|
+
"aria-label": l.formatMessage(m.ask),
|
|
118
|
+
className: _.inputAreaButton,
|
|
111
119
|
"data-testid": "content-answers-submit-button",
|
|
112
|
-
disabled:
|
|
113
|
-
icon:
|
|
120
|
+
disabled: f || o,
|
|
121
|
+
icon: tt,
|
|
114
122
|
loading: !1,
|
|
115
|
-
loadingAriaLabel:
|
|
116
|
-
onClick:
|
|
123
|
+
loadingAriaLabel: l.formatMessage(m.askDisabledTooltip),
|
|
124
|
+
onClick: D,
|
|
117
125
|
size: "large",
|
|
118
126
|
"data-target-id": "Button-ask"
|
|
119
127
|
})
|
|
@@ -122,5 +130,5 @@ const Mt = ({
|
|
|
122
130
|
});
|
|
123
131
|
};
|
|
124
132
|
export {
|
|
125
|
-
|
|
133
|
+
Nt as Footer
|
|
126
134
|
};
|
|
@@ -1,74 +1,79 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { Gray65 as
|
|
4
|
-
import
|
|
5
|
-
import * as
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import { Suggestions as
|
|
1
|
+
import { Text as N, LoadingIndicator as O } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Gray65 as C, Size4 as _ } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import f from "clsx";
|
|
5
|
+
import * as G from "react";
|
|
6
|
+
import { useIntl as w } from "react-intl";
|
|
7
|
+
import { Suggestions as T } from "./suggestions.js";
|
|
8
8
|
import { R as a } from "../../../../chunks/types.js";
|
|
9
|
-
import { LOGGER_BASE_CONFIG as
|
|
10
|
-
import
|
|
11
|
-
import { jsxs as
|
|
12
|
-
import '../../../../styles/suggested-questions.css';const
|
|
13
|
-
wrapper:
|
|
14
|
-
label:
|
|
15
|
-
sidebar:
|
|
16
|
-
loadingIndicator:
|
|
17
|
-
alertIcon:
|
|
18
|
-
},
|
|
19
|
-
askSuggestedQuestion:
|
|
20
|
-
hasCustomSuggestedQuestions:
|
|
21
|
-
isLoading:
|
|
22
|
-
onSuggestedQuestionInteraction:
|
|
9
|
+
import { LOGGER_BASE_CONFIG as y } from "../common/constants.js";
|
|
10
|
+
import l from "./messages.js";
|
|
11
|
+
import { jsxs as L, jsx as i } from "react/jsx-runtime";
|
|
12
|
+
import '../../../../styles/suggested-questions.css';const P = "_wrapper_1peth_1", U = "_label_1peth_1", j = "_sidebar_1peth_6", v = "_loadingIndicator_1peth_10", F = "_alertIcon_1peth_18", r = {
|
|
13
|
+
wrapper: P,
|
|
14
|
+
label: U,
|
|
15
|
+
sidebar: j,
|
|
16
|
+
loadingIndicator: v,
|
|
17
|
+
alertIcon: F
|
|
18
|
+
}, W = ({
|
|
19
|
+
askSuggestedQuestion: g,
|
|
20
|
+
hasCustomSuggestedQuestions: d,
|
|
21
|
+
isLoading: S,
|
|
22
|
+
onSuggestedQuestionInteraction: I,
|
|
23
23
|
recordAction: n,
|
|
24
|
-
setAskSuggestedQuestion:
|
|
25
|
-
suggestedQuestions:
|
|
24
|
+
setAskSuggestedQuestion: e,
|
|
25
|
+
suggestedQuestions: b,
|
|
26
26
|
suggestedQuestionsRequestState: o = a.SUCCESS,
|
|
27
|
-
variant:
|
|
27
|
+
variant: s = "modal"
|
|
28
28
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
formatMessage:
|
|
31
|
-
} =
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const c = s === "sidebar", {
|
|
30
|
+
formatMessage: t
|
|
31
|
+
} = w(), h = G.useCallback((m) => {
|
|
32
|
+
const {
|
|
33
|
+
prompt: p,
|
|
34
|
+
type: R
|
|
35
|
+
} = m;
|
|
36
|
+
e && (e(m), n && p && n({
|
|
37
|
+
...y,
|
|
34
38
|
target: "suggested_questions",
|
|
35
39
|
data: {
|
|
36
|
-
selectedQuestion:
|
|
40
|
+
selectedQuestion: d ? "dynamic" : p,
|
|
41
|
+
type: R
|
|
37
42
|
}
|
|
38
43
|
}));
|
|
39
|
-
}, [
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
className:
|
|
42
|
-
children: [(o === a.IN_PROGRESS || o === a.ERROR) && /* @__PURE__ */ i(
|
|
44
|
+
}, [e, n, d]), E = () => o === a.IN_PROGRESS ? t(l.loadingSuggestedQuestions) : t(l.loadingSuggestedQuestionsFailed);
|
|
45
|
+
return /* @__PURE__ */ L("div", {
|
|
46
|
+
className: f(r.wrapper, c && r.sidebar),
|
|
47
|
+
children: [(o === a.IN_PROGRESS || o === a.ERROR) && /* @__PURE__ */ i(N, {
|
|
43
48
|
as: "p",
|
|
44
|
-
className:
|
|
49
|
+
className: f(r.label, c && r.sidebar),
|
|
45
50
|
color: "textOnLightSecondary",
|
|
46
|
-
children:
|
|
47
|
-
}), o === a.SUCCESS && /* @__PURE__ */ i(
|
|
48
|
-
askSuggestedQuestion:
|
|
49
|
-
isLoading:
|
|
50
|
-
onSuggestedQuestionClick:
|
|
51
|
-
onSuggestedQuestionInteraction:
|
|
52
|
-
suggestedQuestions:
|
|
53
|
-
variant:
|
|
51
|
+
children: E()
|
|
52
|
+
}), o === a.SUCCESS && /* @__PURE__ */ i(T, {
|
|
53
|
+
askSuggestedQuestion: g,
|
|
54
|
+
isLoading: S,
|
|
55
|
+
onSuggestedQuestionClick: h,
|
|
56
|
+
onSuggestedQuestionInteraction: I,
|
|
57
|
+
suggestedQuestions: b,
|
|
58
|
+
variant: s
|
|
54
59
|
}), o === a.IN_PROGRESS && /* @__PURE__ */ i("div", {
|
|
55
60
|
className: r.loadingIndicator,
|
|
56
|
-
children: /* @__PURE__ */ i(
|
|
57
|
-
"aria-label":
|
|
61
|
+
children: /* @__PURE__ */ i(O, {
|
|
62
|
+
"aria-label": t(l.loadingSuggestedQuestions),
|
|
58
63
|
className: r.loadingIndicator,
|
|
59
64
|
variant: "dark"
|
|
60
65
|
})
|
|
61
|
-
}), o === a.ERROR && /* @__PURE__ */ i(
|
|
66
|
+
}), o === a.ERROR && /* @__PURE__ */ i(x, {
|
|
62
67
|
className: r.alertIcon,
|
|
63
|
-
color:
|
|
68
|
+
color: C,
|
|
64
69
|
"data-testid": "content-answers-suggested-questions-failed-alert-icon",
|
|
65
|
-
height:
|
|
70
|
+
height: _,
|
|
66
71
|
role: "presentation",
|
|
67
|
-
width:
|
|
72
|
+
width: _
|
|
68
73
|
})]
|
|
69
74
|
});
|
|
70
75
|
};
|
|
71
76
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
W as SuggestedQuestions,
|
|
78
|
+
W as default
|
|
74
79
|
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { FilterChip as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { FilterChip as r } from "@box/blueprint-web";
|
|
2
|
+
import d from "clsx";
|
|
3
|
+
import u from "lodash/noop";
|
|
4
4
|
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
-
import '../../../../styles/suggestions.css';const
|
|
6
|
-
suggestions:
|
|
7
|
-
suggestion:
|
|
8
|
-
},
|
|
9
|
-
askSuggestedQuestion:
|
|
10
|
-
isLoading:
|
|
5
|
+
import '../../../../styles/suggestions.css';const w = "_suggestions_1d1b9_1", y = "_suggestion_1d1b9_1", n = {
|
|
6
|
+
suggestions: w,
|
|
7
|
+
suggestion: y
|
|
8
|
+
}, A = ({
|
|
9
|
+
askSuggestedQuestion: s,
|
|
10
|
+
isLoading: p,
|
|
11
11
|
onSuggestedQuestionClick: a,
|
|
12
|
-
onSuggestedQuestionInteraction:
|
|
12
|
+
onSuggestedQuestionInteraction: e = u,
|
|
13
13
|
suggestedQuestions: l,
|
|
14
|
-
variant:
|
|
14
|
+
variant: g = "modal"
|
|
15
15
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
(
|
|
16
|
+
const c = s == null ? void 0 : s.prompt, m = (o) => {
|
|
17
|
+
(o.key === "ArrowUp" || o.key === "ArrowDown" || o.key === "ArrowLeft" || o.key === "ArrowRight") && o.stopPropagation();
|
|
18
18
|
};
|
|
19
|
-
return /* @__PURE__ */ t(
|
|
20
|
-
className:
|
|
19
|
+
return /* @__PURE__ */ t(r.Group, {
|
|
20
|
+
className: d(n.suggestions, g === "sidebar" && n.sidebar),
|
|
21
21
|
"data-testid": "content-answers-suggested-questions",
|
|
22
22
|
name: "Singleselect SuggestedQuestions",
|
|
23
|
-
onKeyDown:
|
|
23
|
+
onKeyDown: m,
|
|
24
24
|
type: "single",
|
|
25
|
-
value:
|
|
26
|
-
children: l.map((
|
|
27
|
-
const
|
|
28
|
-
return /* @__PURE__ */ t(
|
|
29
|
-
className:
|
|
30
|
-
"data-testid": `content-answers-${
|
|
31
|
-
disabled:
|
|
32
|
-
onClick: () => a(
|
|
33
|
-
onFocus:
|
|
34
|
-
onMouseEnter:
|
|
35
|
-
value:
|
|
36
|
-
children: /* @__PURE__ */ t(
|
|
37
|
-
children:
|
|
25
|
+
value: c,
|
|
26
|
+
children: l.map((o) => {
|
|
27
|
+
const i = o.label || o.prompt;
|
|
28
|
+
return /* @__PURE__ */ t(r.ChipButton, {
|
|
29
|
+
className: n.suggestion,
|
|
30
|
+
"data-testid": `content-answers-${o.id}`,
|
|
31
|
+
disabled: p,
|
|
32
|
+
onClick: () => a(o),
|
|
33
|
+
onFocus: e,
|
|
34
|
+
onMouseEnter: e,
|
|
35
|
+
value: i,
|
|
36
|
+
children: /* @__PURE__ */ t(r.Label, {
|
|
37
|
+
children: i
|
|
38
38
|
})
|
|
39
|
-
},
|
|
39
|
+
}, o.id);
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
A as Suggestions,
|
|
45
|
+
A as default
|
|
46
46
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ANSWER_ERROR, CitationType, FeedbackFormData, FeedbackValue, ItemClickHandler, ItemType, RecordActionType, StyleVariant } from '../../types';
|
|
1
|
+
import { ANSWER_ERROR, CitationType, FeedbackFormData, FeedbackValue, ItemClickHandler, ItemType, PromptType, RecordActionType, StyleVariant } from '../../types';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export interface AnswerProps {
|
|
4
4
|
answer?: string;
|
|
@@ -28,6 +28,7 @@ export interface AnswerProps {
|
|
|
28
28
|
isMarkdownEnabled?: boolean;
|
|
29
29
|
/** Items for each we will show the ka */
|
|
30
30
|
items?: Array<ItemType>;
|
|
31
|
+
promptType?: PromptType;
|
|
31
32
|
/** Callback function when the user clicks on the answer copy button */
|
|
32
33
|
onAnswerCopy?: (answer: string) => void;
|
|
33
34
|
/** Callback function when citation button is clicked */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeedbackFormData, FeedbackValue, ItemType, RecordActionType, StyleVariant } from '../../types';
|
|
1
|
+
import { FeedbackFormData, FeedbackValue, ItemType, PromptType, RecordActionType, StyleVariant } from '../../types';
|
|
2
2
|
export type ThumbButtonsProps = {
|
|
3
3
|
feedbackValue?: FeedbackValue;
|
|
4
4
|
hostAppName: string;
|
|
@@ -6,6 +6,7 @@ export type ThumbButtonsProps = {
|
|
|
6
6
|
isFeedbackTooltipOpen?: boolean;
|
|
7
7
|
items: ItemType[];
|
|
8
8
|
onFeedbackTooltipOpenChange?: (isOpen: boolean, questionId: string) => void;
|
|
9
|
+
promptType?: PromptType;
|
|
9
10
|
questionId: string;
|
|
10
11
|
onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;
|
|
11
12
|
recordAction?: (params: RecordActionType) => void;
|
|
@@ -13,5 +14,5 @@ export type ThumbButtonsProps = {
|
|
|
13
14
|
shouldFeedbackFormIncludeFeedbackText?: boolean;
|
|
14
15
|
variant: StyleVariant;
|
|
15
16
|
};
|
|
16
|
-
export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, questionId, recordAction, setAnswerFeedback, shouldFeedbackFormIncludeFeedbackText, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, promptType, questionId, recordAction, setAnswerFeedback, shouldFeedbackFormIncludeFeedbackText, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export default ThumbButtons;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QuestionType, RetryQuestion, StopQuestion, StyleVariant, SubmitQuestion } from '../../types';
|
|
1
|
+
import { SuggestedQuestionType, QuestionType, RetryQuestion, StopQuestion, StyleVariant, SubmitQuestion } from '../../types';
|
|
2
2
|
export interface FooterProps {
|
|
3
3
|
/** Selected suggested question */
|
|
4
|
-
askSuggestedQuestion:
|
|
4
|
+
askSuggestedQuestion: SuggestedQuestionType | undefined;
|
|
5
5
|
/** Whether to allow CTRL+SHIFT+X feature or not */
|
|
6
6
|
enableDebugMode?: boolean;
|
|
7
7
|
/** Whether to indicate if there is a request in progress like an answer being fetched or streamed */
|
|
@@ -27,7 +27,7 @@ export interface FooterProps {
|
|
|
27
27
|
/** Callback when the user clicks on ask question or a suggested question */
|
|
28
28
|
sendQuestion: SubmitQuestion;
|
|
29
29
|
/** Callback function to handle selection of suggested question */
|
|
30
|
-
setAskSuggestedQuestion: ((value:
|
|
30
|
+
setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
|
|
31
31
|
/** Callback function to toggle the CTRL+SHIFT+X feature */
|
|
32
32
|
toggleDebugMode?: () => void;
|
|
33
33
|
variant?: StyleVariant;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { REQUEST_STATE, StyleVariant, SuggestedQuestionType } from '../../types';
|
|
2
2
|
export type SuggestedQuestionsProps = {
|
|
3
3
|
/** Selected suggested question. DEPRECATE - Not longer needed */
|
|
4
|
-
askSuggestedQuestion:
|
|
4
|
+
askSuggestedQuestion: SuggestedQuestionType | undefined;
|
|
5
5
|
/** Flag to indicate if the host application has custom suggested questions */
|
|
6
6
|
hasCustomSuggestedQuestions?: boolean;
|
|
7
7
|
/** Whether to indicate if there is a request in progress like an answer being fetched or streamed so we can disable the buttons */
|
|
@@ -11,7 +11,7 @@ export type SuggestedQuestionsProps = {
|
|
|
11
11
|
/** Callback function to handle logging events */
|
|
12
12
|
recordAction?: (payload: Record<string, unknown>) => void;
|
|
13
13
|
/** Callback function to handle selection of suggested question */
|
|
14
|
-
setAskSuggestedQuestion: (value:
|
|
14
|
+
setAskSuggestedQuestion: (value: SuggestedQuestionType | null) => void;
|
|
15
15
|
/** Suggested Questions list */
|
|
16
16
|
suggestedQuestions: SuggestedQuestionType[];
|
|
17
17
|
/** Object to indicate if there is a request in progress to fetch suggested questions and handle their state */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StyleVariant, SuggestedQuestionType } from '../../types';
|
|
2
2
|
export type SuggestionsProps = {
|
|
3
3
|
/** Selected suggested question. DEPRECATE - Not longer needed */
|
|
4
|
-
askSuggestedQuestion:
|
|
4
|
+
askSuggestedQuestion: SuggestedQuestionType | undefined;
|
|
5
5
|
/** Whether to indicate if there is a request in progress like an answer being fetched or streamed so we can disable the buttons */
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
/** Callback function to handle selection of suggested question */
|
|
8
|
-
onSuggestedQuestionClick: (value:
|
|
8
|
+
onSuggestedQuestionClick: (value: SuggestedQuestionType | null) => void;
|
|
9
9
|
/** Callback when the user interacts with suggested question */
|
|
10
10
|
onSuggestedQuestionInteraction?: () => void;
|
|
11
11
|
/** Suggested Questions list */
|
|
@@ -22,6 +22,13 @@ export declare enum REQUEST_STATE {
|
|
|
22
22
|
ERROR = "error",
|
|
23
23
|
CANCELLED = "cancelled"
|
|
24
24
|
}
|
|
25
|
+
export declare enum SUGGESTED_QUESTION_PROMPT_TYPE {
|
|
26
|
+
CUSTOM = "suggested_question_custom",
|
|
27
|
+
INTELLIGENT = "suggested_question_intelligent",
|
|
28
|
+
STATIC = "suggested_question_static"
|
|
29
|
+
}
|
|
30
|
+
export declare const USER_INPUT_PROMPT_TYPE = "user_input";
|
|
31
|
+
export type PromptType = SUGGESTED_QUESTION_PROMPT_TYPE | typeof USER_INPUT_PROMPT_TYPE;
|
|
25
32
|
export type StyleVariant = 'modal' | 'sidebar';
|
|
26
33
|
export type RetryQuestion = (question: QuestionType, aiAgent?: unknown | undefined) => void;
|
|
27
34
|
export type SendErrorLog = ({ eventType, message, origin, sendTrace }: EventLogOptions) => void;
|
|
@@ -101,9 +108,9 @@ export type ChatProps = WelcomeMessageProps & {
|
|
|
101
108
|
/** Suggested Questions Request state */
|
|
102
109
|
suggestedQuestionsRequestState?: REQUEST_STATE;
|
|
103
110
|
/** Selected suggested question */
|
|
104
|
-
askSuggestedQuestion:
|
|
111
|
+
askSuggestedQuestion: SuggestedQuestionType | undefined;
|
|
105
112
|
/** Callback function to handle selection of suggested question */
|
|
106
|
-
setAskSuggestedQuestion: ((value:
|
|
113
|
+
setAskSuggestedQuestion: ((value: SuggestedQuestionType | null) => void) | undefined;
|
|
107
114
|
/** Callback function to handle answer thumb feedback click */
|
|
108
115
|
setAnswerFeedback: ((questionId: string, feedbackValue: FeedbackValue) => void) | undefined;
|
|
109
116
|
/** Whether to indicate if there is a request in progress like an answer being fetched or streamed */
|
|
@@ -166,6 +173,7 @@ export type RecordActionType = {
|
|
|
166
173
|
file_types: string[];
|
|
167
174
|
has_feedback: boolean;
|
|
168
175
|
issue_type: FeedbackIssueType | '';
|
|
176
|
+
prompt_type?: string;
|
|
169
177
|
question_id: string;
|
|
170
178
|
};
|
|
171
179
|
component: string;
|
|
@@ -193,6 +201,7 @@ export type QuestionType = {
|
|
|
193
201
|
created_at?: string;
|
|
194
202
|
type?: 'question';
|
|
195
203
|
feedbackValue?: FeedbackValue;
|
|
204
|
+
promptType?: PromptType;
|
|
196
205
|
};
|
|
197
206
|
export type ItemType = {
|
|
198
207
|
id: string;
|
|
@@ -214,6 +223,7 @@ export type SuggestedQuestionType = {
|
|
|
214
223
|
label?: string;
|
|
215
224
|
prompt: string;
|
|
216
225
|
id: string;
|
|
226
|
+
type?: SUGGESTED_QUESTION_PROMPT_TYPE;
|
|
217
227
|
};
|
|
218
228
|
export type CitationResponseRecordType = string | number;
|
|
219
229
|
export type CitationResponse = Record<string, CitationResponseRecordType>;
|