@box/box-ai-content-answers 0.118.0 → 0.119.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/esm/lib/box-ai-content-answers.js +74 -81
- package/dist/esm/lib/components/api-wrapper/api-wrapper.js +1 -1
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +89 -91
- package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +109 -116
- package/dist/esm/lib/components/common/agentUtils.js +6 -6
- package/dist/esm/lib/components/footer/footer.js +88 -92
- package/dist/esm/lib/components/modal/modal.js +118 -115
- package/dist/i18n/bn-IN.js +0 -2
- package/dist/i18n/bn-IN.properties +0 -4
- package/dist/i18n/da-DK.js +0 -2
- package/dist/i18n/da-DK.properties +0 -4
- package/dist/i18n/de-DE.js +0 -2
- package/dist/i18n/de-DE.properties +0 -4
- package/dist/i18n/en-AU.js +0 -2
- package/dist/i18n/en-AU.properties +1 -4
- package/dist/i18n/en-CA.js +0 -2
- package/dist/i18n/en-CA.properties +0 -4
- package/dist/i18n/en-GB.js +0 -2
- package/dist/i18n/en-GB.properties +2 -4
- package/dist/i18n/en-US.js +0 -2
- package/dist/i18n/en-US.properties +0 -4
- package/dist/i18n/en-x-pseudo.js +1 -3
- package/dist/i18n/en-x-pseudo.properties +1 -5
- package/dist/i18n/es-419.js +0 -2
- package/dist/i18n/es-419.properties +0 -4
- package/dist/i18n/es-ES.js +0 -2
- package/dist/i18n/es-ES.properties +0 -4
- package/dist/i18n/fi-FI.js +0 -2
- package/dist/i18n/fi-FI.properties +0 -4
- package/dist/i18n/fr-CA.js +0 -2
- package/dist/i18n/fr-CA.properties +0 -4
- package/dist/i18n/fr-FR.js +0 -2
- package/dist/i18n/fr-FR.properties +0 -4
- package/dist/i18n/hi-IN.js +0 -2
- package/dist/i18n/hi-IN.properties +0 -4
- package/dist/i18n/it-IT.js +0 -2
- package/dist/i18n/it-IT.properties +0 -4
- package/dist/i18n/ja-JP.js +0 -2
- package/dist/i18n/ja-JP.properties +0 -4
- package/dist/i18n/ko-KR.js +0 -2
- package/dist/i18n/ko-KR.properties +0 -4
- package/dist/i18n/nb-NO.js +0 -2
- package/dist/i18n/nb-NO.properties +0 -4
- package/dist/i18n/nl-NL.js +0 -2
- package/dist/i18n/nl-NL.properties +0 -4
- package/dist/i18n/pl-PL.js +0 -2
- package/dist/i18n/pl-PL.properties +0 -4
- package/dist/i18n/pt-BR.js +0 -2
- package/dist/i18n/pt-BR.properties +0 -4
- package/dist/i18n/ru-RU.js +0 -2
- package/dist/i18n/ru-RU.properties +0 -4
- package/dist/i18n/sv-SE.js +0 -2
- package/dist/i18n/sv-SE.properties +0 -4
- package/dist/i18n/tr-TR.js +0 -2
- package/dist/i18n/tr-TR.properties +0 -4
- package/dist/i18n/zh-CN.js +0 -2
- package/dist/i18n/zh-CN.properties +0 -4
- package/dist/i18n/zh-TW.js +0 -2
- package/dist/i18n/zh-TW.properties +0 -4
- package/dist/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +3 -2
- package/dist/types/lib/components/common/agentUtils.d.ts +1 -1
- package/dist/types/lib/components/footer/footer.d.ts +1 -7
- package/dist/types/lib/components/modal/modal.d.ts +0 -6
- package/package.json +4 -4
- package/dist/esm/lib/components/agents/agent-editor.js +0 -55
- package/dist/esm/lib/components/agents/agent-selector.js +0 -84
- package/dist/esm/lib/components/agents/messages.js +0 -14
- package/dist/esm/lib/contexts/AgentsContext.js +0 -59
- package/dist/i18n/json/src/lib/components/agents/messages.json +0 -1
- package/dist/styles/agent-editor.css +0 -1
- package/dist/styles/agent-selector.css +0 -1
- package/dist/types/lib/components/agents/agent-editor.d.ts +0 -8
- package/dist/types/lib/components/agents/agent-selector.d.ts +0 -6
- package/dist/types/lib/components/agents/messages.d.ts +0 -13
- package/dist/types/lib/components/agents/stories/shared.d.ts +0 -12
- package/dist/types/lib/contexts/AgentsContext.d.ts +0 -15
|
@@ -1,99 +1,92 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
contentName: A,
|
|
1
|
+
import p from "clsx";
|
|
2
|
+
import * as s from "react";
|
|
3
|
+
import { C as H } from "../../chunks/types.js";
|
|
4
|
+
import { jsx as u, jsxs as J } from "react/jsx-runtime";
|
|
5
|
+
import { Content as K } from "./components/content/content.js";
|
|
6
|
+
import { Footer as V } from "./components/footer/footer.js";
|
|
7
|
+
import '../../styles/box-ai-content-answers.css';const W = "_container_1p5tb_1", X = "_contentAnswers_1p5tb_8", Y = "_sidebar_1p5tb_19", a = {
|
|
8
|
+
container: W,
|
|
9
|
+
contentAnswers: X,
|
|
10
|
+
sidebar: Y
|
|
11
|
+
}, I = ({
|
|
12
|
+
className: _,
|
|
13
|
+
contentType: h,
|
|
14
|
+
contentName: Q,
|
|
16
15
|
error: t,
|
|
17
16
|
hasCustomSuggestedQuestions: w,
|
|
18
|
-
hasRequestInProgress:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
onAgentEditorToggle: j,
|
|
17
|
+
hasRequestInProgress: d,
|
|
18
|
+
isAIStudioAgentSelectorEnabled: A,
|
|
19
|
+
isDebugModeEnabled: E,
|
|
20
|
+
isStopResponseEnabled: M,
|
|
21
|
+
isStreamingEnabled: n,
|
|
22
|
+
questions: i,
|
|
23
|
+
recordAction: l,
|
|
24
|
+
retryQuestion: R,
|
|
25
|
+
showLoadingIndicator: g,
|
|
26
|
+
stopQuestion: x,
|
|
27
|
+
submitQuestion: C,
|
|
28
|
+
suggestedQuestions: F,
|
|
29
|
+
useAnimation: D,
|
|
30
|
+
onAgentEditorToggle: Z,
|
|
33
31
|
onUserIntentToUseAI: e,
|
|
34
32
|
variant: o = "modal",
|
|
35
|
-
hostAppName:
|
|
36
|
-
...
|
|
33
|
+
hostAppName: N,
|
|
34
|
+
...k
|
|
37
35
|
}) => {
|
|
38
|
-
const [f,
|
|
39
|
-
|
|
40
|
-
...
|
|
36
|
+
const [f, m] = s.useState(null), [S, j] = s.useState(t != null), [c, y] = s.useState(!1), O = t === H.LARGE_FILE, z = (!S || O) && !g, b = (r) => {
|
|
37
|
+
l && l({
|
|
38
|
+
...r,
|
|
41
39
|
component: o
|
|
42
40
|
});
|
|
43
|
-
},
|
|
41
|
+
}, B = () => {
|
|
44
42
|
e && e(!1);
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
},
|
|
43
|
+
}, G = (r) => {
|
|
44
|
+
m(r), e && e(!0);
|
|
45
|
+
}, L = () => {
|
|
48
46
|
e && e(!0);
|
|
49
47
|
};
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
}, [t]), /* @__PURE__ */
|
|
53
|
-
className: _
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
className:
|
|
56
|
-
children: [!
|
|
57
|
-
...
|
|
48
|
+
return s.useEffect(() => {
|
|
49
|
+
j(t != null);
|
|
50
|
+
}, [t]), /* @__PURE__ */ u("div", {
|
|
51
|
+
className: p(_, a.container),
|
|
52
|
+
children: /* @__PURE__ */ J("div", {
|
|
53
|
+
className: p(a.contentAnswers, o === "sidebar" && a.sidebar),
|
|
54
|
+
children: [!c && /* @__PURE__ */ u(K, {
|
|
55
|
+
...k,
|
|
58
56
|
askSuggestedQuestion: f,
|
|
59
|
-
contentName:
|
|
60
|
-
contentType:
|
|
57
|
+
contentName: Q,
|
|
58
|
+
contentType: h,
|
|
61
59
|
error: t,
|
|
62
60
|
hasCustomSuggestedQuestions: w,
|
|
63
|
-
hasRequestInProgress:
|
|
64
|
-
hostAppName:
|
|
61
|
+
hasRequestInProgress: d,
|
|
62
|
+
hostAppName: N,
|
|
65
63
|
isErrorMessageShown: S,
|
|
66
|
-
isStreamingEnabled:
|
|
67
|
-
onSuggestedQuestionInteraction:
|
|
68
|
-
questions:
|
|
69
|
-
recordAction:
|
|
70
|
-
setAskSuggestedQuestion:
|
|
71
|
-
showLoadingIndicator:
|
|
72
|
-
suggestedQuestions:
|
|
73
|
-
useAnimation:
|
|
64
|
+
isStreamingEnabled: n,
|
|
65
|
+
onSuggestedQuestionInteraction: B,
|
|
66
|
+
questions: i,
|
|
67
|
+
recordAction: b,
|
|
68
|
+
setAskSuggestedQuestion: G,
|
|
69
|
+
showLoadingIndicator: g,
|
|
70
|
+
suggestedQuestions: F,
|
|
71
|
+
useAnimation: n && D,
|
|
74
72
|
variant: o
|
|
75
|
-
}),
|
|
76
|
-
onAgentEditorToggle: j,
|
|
77
|
-
recordAction: u,
|
|
78
|
-
setIsDebugModeShown: b
|
|
79
|
-
}), G && /* @__PURE__ */ i(Y, {
|
|
73
|
+
}), z && /* @__PURE__ */ u(V, {
|
|
80
74
|
askSuggestedQuestion: f,
|
|
81
|
-
enableDebugMode:
|
|
82
|
-
hasRequestInProgress:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
setAskSuggestedQuestion: p,
|
|
75
|
+
enableDebugMode: E,
|
|
76
|
+
hasRequestInProgress: d,
|
|
77
|
+
isAIStudioAgentSelectorEnabled: A,
|
|
78
|
+
isDebugModeShown: c,
|
|
79
|
+
isStopResponseEnabled: M,
|
|
80
|
+
isStreamingEnabled: n,
|
|
81
|
+
lastQuestion: i[i.length - 1],
|
|
82
|
+
onRetryQuestion: R,
|
|
83
|
+
onStopQuestion: x,
|
|
84
|
+
onUserInteraction: L,
|
|
85
|
+
recordAction: b,
|
|
86
|
+
sendQuestion: C,
|
|
87
|
+
setAskSuggestedQuestion: m,
|
|
95
88
|
toggleDebugMode: () => {
|
|
96
|
-
|
|
89
|
+
y(!c);
|
|
97
90
|
},
|
|
98
91
|
variant: o
|
|
99
92
|
})]
|
|
@@ -101,6 +94,6 @@ import '../../styles/box-ai-content-answers.css';const Z = "_container_1p5tb_1",
|
|
|
101
94
|
});
|
|
102
95
|
};
|
|
103
96
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
I as BoxAiContentAnswers,
|
|
98
|
+
I as default
|
|
106
99
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentsProvider as e } from "
|
|
1
|
+
import { AgentsProvider as e } from "@box/box-ai-agent-selector";
|
|
2
2
|
import { ContentAnswersComponent as n } from "./content-answers-component.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
const s = (t) => (o) => /* @__PURE__ */ r(e, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useReducer as
|
|
1
|
+
import { useReducer as oe, useEffect as ie } from "react";
|
|
2
2
|
import { R as m } from "../../../../chunks/types.js";
|
|
3
|
-
import { useContentAnswers as
|
|
4
|
-
import { ContentAnswersRecord as
|
|
3
|
+
import { useContentAnswers as re } from "./hooks/useContentAnswers.js";
|
|
4
|
+
import { ContentAnswersRecord as de, ContentAnswersItemRecord as ae } from "./records.js";
|
|
5
5
|
import ue from "./reducer.js";
|
|
6
|
-
import { jsx as
|
|
7
|
-
const
|
|
6
|
+
import { jsx as ge } from "react/jsx-runtime";
|
|
7
|
+
const pe = (t) => {
|
|
8
8
|
const {
|
|
9
9
|
WrappedComponent: f,
|
|
10
10
|
cachedSuggestedQuestions: r = [],
|
|
@@ -13,127 +13,125 @@ const we = (t) => {
|
|
|
13
13
|
formatCitations: C,
|
|
14
14
|
getAIStudioAgents: p,
|
|
15
15
|
getAgentConfig: w,
|
|
16
|
-
getAnswer:
|
|
17
|
-
getAnswerStreaming:
|
|
16
|
+
getAnswer: Q,
|
|
17
|
+
getAnswerStreaming: E,
|
|
18
18
|
getSuggestedQuestions: s,
|
|
19
|
-
hostAppName:
|
|
20
|
-
isAIStudioAgentSelectorEnabled:
|
|
21
|
-
isAgentSelectorEnabled: q,
|
|
19
|
+
hostAppName: R,
|
|
20
|
+
isAIStudioAgentSelectorEnabled: b,
|
|
22
21
|
isCitationsEnabled: d,
|
|
23
|
-
isDebugModeEnabled:
|
|
24
|
-
isMarkdownEnabled:
|
|
22
|
+
isDebugModeEnabled: q,
|
|
23
|
+
isMarkdownEnabled: T,
|
|
25
24
|
isOpen: n,
|
|
26
|
-
isResetChatEnabled:
|
|
27
|
-
isStopResponseEnabled:
|
|
25
|
+
isResetChatEnabled: I,
|
|
26
|
+
isStopResponseEnabled: L,
|
|
28
27
|
isStreamingEnabled: a,
|
|
29
28
|
itemID: o,
|
|
30
|
-
items:
|
|
31
|
-
onCitationClick:
|
|
32
|
-
onCloseModal:
|
|
33
|
-
onItemClick:
|
|
34
|
-
onSuggestedQuestionsFetched:
|
|
35
|
-
parentItem:
|
|
36
|
-
restoredQuestions:
|
|
37
|
-
restoredSession:
|
|
38
|
-
restoredShouldShowLandingPage:
|
|
39
|
-
sendErrorLog:
|
|
40
|
-
shouldRenderProviders:
|
|
41
|
-
suggestedQuestions:
|
|
42
|
-
warningNotice:
|
|
43
|
-
warningNoticeAriaLabel:
|
|
44
|
-
} = t, [
|
|
45
|
-
item: new
|
|
29
|
+
items: u,
|
|
30
|
+
onCitationClick: P,
|
|
31
|
+
onCloseModal: k,
|
|
32
|
+
onItemClick: D,
|
|
33
|
+
onSuggestedQuestionsFetched: N,
|
|
34
|
+
parentItem: O,
|
|
35
|
+
restoredQuestions: j = [],
|
|
36
|
+
restoredSession: v = null,
|
|
37
|
+
restoredShouldShowLandingPage: M = !0,
|
|
38
|
+
sendErrorLog: U,
|
|
39
|
+
shouldRenderProviders: _ = !0,
|
|
40
|
+
suggestedQuestions: x,
|
|
41
|
+
warningNotice: F,
|
|
42
|
+
warningNoticeAriaLabel: y
|
|
43
|
+
} = t, [g, W] = oe(ue, new de({
|
|
44
|
+
item: new ae({
|
|
46
45
|
id: o
|
|
47
46
|
}),
|
|
48
|
-
questions:
|
|
49
|
-
encodedSession:
|
|
50
|
-
shouldShowLandingPage:
|
|
47
|
+
questions: j,
|
|
48
|
+
encodedSession: v,
|
|
49
|
+
shouldShowLandingPage: M
|
|
51
50
|
})), {
|
|
52
|
-
clearConversation:
|
|
53
|
-
createSession:
|
|
51
|
+
clearConversation: z,
|
|
52
|
+
createSession: B,
|
|
54
53
|
fetchAgentConfig: c,
|
|
55
54
|
fetchSuggestedQuestions: S,
|
|
56
|
-
retryQuestion:
|
|
57
|
-
sendQuestion:
|
|
58
|
-
setAnswerFeedback:
|
|
59
|
-
stopQuestion:
|
|
60
|
-
} =
|
|
61
|
-
contentAnswers:
|
|
55
|
+
retryQuestion: G,
|
|
56
|
+
sendQuestion: H,
|
|
57
|
+
setAnswerFeedback: J,
|
|
58
|
+
stopQuestion: K
|
|
59
|
+
} = re({
|
|
60
|
+
contentAnswers: g,
|
|
62
61
|
createSessionRequest: A,
|
|
63
|
-
dispatchStateUpdate:
|
|
62
|
+
dispatchStateUpdate: W,
|
|
64
63
|
fetchTimeout: h,
|
|
65
64
|
formatCitations: C,
|
|
66
65
|
getAgentConfig: w,
|
|
67
|
-
getAnswerStreaming:
|
|
68
|
-
getAnswer:
|
|
66
|
+
getAnswerStreaming: E,
|
|
67
|
+
getAnswer: Q,
|
|
69
68
|
getSuggestedQuestions: s,
|
|
70
69
|
isCitationsEnabled: d,
|
|
71
|
-
isStopResponseEnabled:
|
|
70
|
+
isStopResponseEnabled: L,
|
|
72
71
|
isStreamingEnabled: a,
|
|
73
72
|
itemID: o,
|
|
74
|
-
items:
|
|
75
|
-
onSuggestedQuestionsFetched:
|
|
76
|
-
sendErrorLog:
|
|
73
|
+
items: u,
|
|
74
|
+
onSuggestedQuestionsFetched: N,
|
|
75
|
+
sendErrorLog: U,
|
|
77
76
|
...t
|
|
78
77
|
}), {
|
|
79
|
-
encodedSession:
|
|
80
|
-
error:
|
|
81
|
-
isLoading:
|
|
82
|
-
hasRequestInProgress:
|
|
83
|
-
questions:
|
|
84
|
-
shouldShowLandingPage:
|
|
78
|
+
encodedSession: V,
|
|
79
|
+
error: X,
|
|
80
|
+
isLoading: Y,
|
|
81
|
+
hasRequestInProgress: Z = !1,
|
|
82
|
+
questions: $,
|
|
83
|
+
shouldShowLandingPage: ee,
|
|
85
84
|
suggestedQuestions: e
|
|
86
|
-
} =
|
|
87
|
-
|
|
85
|
+
} = g;
|
|
86
|
+
ie(() => {
|
|
88
87
|
n && e.requestState === m.NOT_STARTED && S();
|
|
89
88
|
}, [n, S, e.requestState]);
|
|
90
|
-
const
|
|
91
|
-
let i =
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
createSession:
|
|
95
|
-
encodedSession:
|
|
96
|
-
error:
|
|
89
|
+
const te = r.length > 0;
|
|
90
|
+
let i = x, l = m.SUCCESS;
|
|
91
|
+
te ? i = r : s && (i = e.suggestions, l = e.requestState);
|
|
92
|
+
const se = Object.fromEntries(Object.entries({
|
|
93
|
+
createSession: B,
|
|
94
|
+
encodedSession: V,
|
|
95
|
+
error: X,
|
|
97
96
|
getAIStudioAgents: p,
|
|
98
|
-
hostAppName:
|
|
97
|
+
hostAppName: R,
|
|
99
98
|
hasCustomSuggestedQuestions: !!s,
|
|
100
|
-
hasRequestInProgress:
|
|
101
|
-
|
|
102
|
-
isAIStudioAgentSelectorEnabled: R,
|
|
99
|
+
hasRequestInProgress: Z,
|
|
100
|
+
isAIStudioAgentSelectorEnabled: b,
|
|
103
101
|
isCitationsEnabled: d,
|
|
104
|
-
isDebugModeEnabled:
|
|
105
|
-
isMarkdownEnabled:
|
|
106
|
-
isLoading:
|
|
102
|
+
isDebugModeEnabled: q,
|
|
103
|
+
isMarkdownEnabled: T,
|
|
104
|
+
isLoading: Y,
|
|
107
105
|
isOpen: n,
|
|
108
|
-
isResetChatEnabled:
|
|
106
|
+
isResetChatEnabled: I,
|
|
109
107
|
isStreamingEnabled: a,
|
|
110
108
|
itemID: o,
|
|
111
|
-
items:
|
|
112
|
-
onClearAction:
|
|
113
|
-
onCloseModal:
|
|
114
|
-
onCitationClick:
|
|
115
|
-
onItemClick:
|
|
109
|
+
items: u,
|
|
110
|
+
onClearAction: z,
|
|
111
|
+
onCloseModal: k,
|
|
112
|
+
onCitationClick: P,
|
|
113
|
+
onItemClick: D,
|
|
116
114
|
onSelectAgent: c,
|
|
117
115
|
onAgentEditorToggle: c,
|
|
118
|
-
parentItem:
|
|
119
|
-
questions:
|
|
120
|
-
retryQuestion:
|
|
121
|
-
sendQuestion:
|
|
122
|
-
setAnswerFeedback:
|
|
123
|
-
shouldRenderProviders:
|
|
124
|
-
shouldShowLandingPage:
|
|
125
|
-
stopQuestion:
|
|
116
|
+
parentItem: O,
|
|
117
|
+
questions: $,
|
|
118
|
+
retryQuestion: G,
|
|
119
|
+
sendQuestion: H,
|
|
120
|
+
setAnswerFeedback: J,
|
|
121
|
+
shouldRenderProviders: _,
|
|
122
|
+
shouldShowLandingPage: ee,
|
|
123
|
+
stopQuestion: K,
|
|
126
124
|
suggestedQuestionsRequestState: l,
|
|
127
125
|
suggestedQuestions: i,
|
|
128
|
-
warningNotice:
|
|
129
|
-
warningNoticeAriaLabel:
|
|
130
|
-
}).filter(([
|
|
131
|
-
return /* @__PURE__ */
|
|
126
|
+
warningNotice: F,
|
|
127
|
+
warningNoticeAriaLabel: y
|
|
128
|
+
}).filter(([Se, ne]) => ne !== void 0));
|
|
129
|
+
return /* @__PURE__ */ ge(f, {
|
|
132
130
|
...t,
|
|
133
|
-
...
|
|
131
|
+
...se
|
|
134
132
|
});
|
|
135
133
|
};
|
|
136
134
|
export {
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
pe as ContentAnswersComponent,
|
|
136
|
+
pe as default
|
|
139
137
|
};
|