@box/box-ai-content-answers 1.43.28 → 1.43.30
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 +2 -2
- package/dist/esm/index.js +12 -12
- package/dist/esm/lib/box-ai-content-answers.js +5 -5
- package/dist/esm/lib/components/answer/answer-content.js +1 -1
- package/dist/esm/lib/components/answer/citation.js +1 -1
- package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +16 -16
- package/dist/esm/lib/components/api-wrapper/reducer.js +3 -3
- package/dist/esm/lib/components/common/markdown.js +3000 -2151
- package/dist/esm/lib/components/common/mock-data.js +3 -3
- package/dist/esm/lib/components/content/content.js +7 -7
- package/dist/esm/lib/components/footer/footer.js +1 -1
- package/dist/esm/lib/components/modal-error/modal-error.js +1 -1
- package/dist/esm/lib/components/sidebar/content.js +1 -1
- package/package.json +11 -11
package/dist/chunks/types.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
|
|
2
|
-
import { AnswerContent as
|
|
3
|
-
import { References as
|
|
4
|
-
import {
|
|
2
|
+
import { AnswerContent as s } from "./lib/components/answer/answer-content.js";
|
|
3
|
+
import { References as a } from "./lib/components/answer/references.js";
|
|
4
|
+
import { default as p } from "./lib/components/api-wrapper/api-wrapper.js";
|
|
5
5
|
import { C as _ } from "../chunks/clear-conversation-button.js";
|
|
6
6
|
import { IntelligenceModal as A } from "./lib/components/modal/modal.js";
|
|
7
|
-
import { IntelligenceSidebar as
|
|
7
|
+
import { IntelligenceSidebar as S } from "./lib/components/sidebar/sidebar.js";
|
|
8
8
|
import { AI_AGENTS_LOCAL_STORAGE_KEY as x, APP_MODE as O } from "./lib/constants.js";
|
|
9
9
|
import { usePromptFocus as P } from "./lib/hooks/usePromptFocus.js";
|
|
10
|
-
import { A as i,
|
|
10
|
+
import { A as i, C as l, a as N, F as U, R as c, S as u, U as d } from "../chunks/types.js";
|
|
11
11
|
export {
|
|
12
12
|
x as AI_AGENTS_LOCAL_STORAGE_KEY,
|
|
13
13
|
i as ANSWER_ERROR,
|
|
14
14
|
O as APP_MODE,
|
|
15
|
-
|
|
15
|
+
s as AnswerContent,
|
|
16
16
|
r as BoxAiContentAnswers,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
l as CITATION_SOURCE,
|
|
18
|
+
N as CONTENT_ERROR,
|
|
19
19
|
_ as ClearConversationButton,
|
|
20
|
-
|
|
20
|
+
U as FeedbackIssueType,
|
|
21
21
|
A as IntelligenceModal,
|
|
22
|
-
|
|
22
|
+
S as IntelligenceSidebar,
|
|
23
23
|
c as REQUEST_STATE,
|
|
24
|
-
|
|
24
|
+
a as References,
|
|
25
25
|
u as SUGGESTED_QUESTION_PROMPT_TYPE,
|
|
26
|
-
|
|
26
|
+
d as USER_INPUT_PROMPT_TYPE,
|
|
27
27
|
P as usePromptFocus,
|
|
28
28
|
p as withApiWrapper
|
|
29
29
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "clsx";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { a as Y } from "../../chunks/types.js";
|
|
4
4
|
import { jsx as r, jsxs as Z } from "react/jsx-runtime";
|
|
5
5
|
import { Content as $ } from "./components/content/content.js";
|
|
6
6
|
import { Footer as v } from "./components/footer/footer.js";
|
|
@@ -23,8 +23,8 @@ import '../../styles/box-ai-content-answers.css';const P = "_container_h5a00_1",
|
|
|
23
23
|
promptValue: x,
|
|
24
24
|
questions: i,
|
|
25
25
|
recordAction: l,
|
|
26
|
-
retryQuestion:
|
|
27
|
-
setPromptValue:
|
|
26
|
+
retryQuestion: F,
|
|
27
|
+
setPromptValue: C,
|
|
28
28
|
showLoadingIndicator: g,
|
|
29
29
|
stopQuestion: D,
|
|
30
30
|
submitQuestion: N,
|
|
@@ -88,7 +88,7 @@ import '../../styles/box-ai-content-answers.css';const P = "_container_h5a00_1",
|
|
|
88
88
|
isStopResponseEnabled: M,
|
|
89
89
|
isStreamingEnabled: n,
|
|
90
90
|
lastQuestion: i[i.length - 1],
|
|
91
|
-
onRetryQuestion:
|
|
91
|
+
onRetryQuestion: F,
|
|
92
92
|
onStopQuestion: D,
|
|
93
93
|
onUserInteraction: X,
|
|
94
94
|
promptButtonClickHandler: y,
|
|
@@ -96,7 +96,7 @@ import '../../styles/box-ai-content-answers.css';const P = "_container_h5a00_1",
|
|
|
96
96
|
recordAction: S,
|
|
97
97
|
sendQuestion: N,
|
|
98
98
|
setAskSuggestedQuestion: m,
|
|
99
|
-
setPromptValue:
|
|
99
|
+
setPromptValue: C,
|
|
100
100
|
toggleDebugMode: () => {
|
|
101
101
|
H(!c);
|
|
102
102
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i from "clsx";
|
|
2
|
-
import
|
|
2
|
+
import k from "../../utils/inlineCitationsUtils.js";
|
|
3
3
|
import { markdownToHtmlString as x } from "../common/markdown.js";
|
|
4
4
|
import M from "../common/markdown-react.js";
|
|
5
5
|
import { jsxs as u, Fragment as b, jsx as r } from "react/jsx-runtime";
|
|
@@ -5,7 +5,7 @@ import D from "lodash/debounce";
|
|
|
5
5
|
import R from "lodash/truncate";
|
|
6
6
|
import { useState as I, useRef as G, useCallback as F, useEffect as U } from "react";
|
|
7
7
|
import { useIntl as j } from "react-intl";
|
|
8
|
-
import {
|
|
8
|
+
import { C as H } from "../../../../chunks/types.js";
|
|
9
9
|
import { LOGGER_BASE_CONFIG as S, LOGGER_ACTION_CLICK as K } from "../common/constants.js";
|
|
10
10
|
import { MAX_CITATION_LENGTH as P } from "./constants.js";
|
|
11
11
|
import s from "./messages.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useAgentsDispatch as ae, ACTIONS as le } from "@box/box-ai-agent-selector";
|
|
2
2
|
import ie from "lodash/camelCase";
|
|
3
3
|
import r, { useMemo as ce, useCallback as ue } from "react";
|
|
4
|
-
import { A as
|
|
5
|
-
import { SET_NEW_ITEM as fe, UPDATE_QUESTION as
|
|
4
|
+
import { A as C, a as Ee, R as J } from "../../../../../chunks/types.js";
|
|
5
|
+
import { SET_NEW_ITEM as fe, UPDATE_QUESTION as _e, SET_MODAL_ERROR as Ce, SET_MODAL_SUCCESS as Te, SET_IS_LOADING as V, SET_ANSWER_FEEDBACK as Re, CLEAR_CONVERSATION_HISTORY as de, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as X, SET_SUGGESTED_QUESTIONS as Ae } from "../actions.js";
|
|
6
6
|
import { QuestionRecord as Ne } from "../records.js";
|
|
7
7
|
import { defaultFormatCitations as Oe, defaultFormatSuggestions as ye } from "../utils/format.js";
|
|
8
8
|
import { getAnswerRequest as Se } from "../utils/request.js";
|
|
@@ -41,13 +41,13 @@ function Fe({
|
|
|
41
41
|
);
|
|
42
42
|
const c = r.useCallback((e, s) => {
|
|
43
43
|
o({
|
|
44
|
-
type:
|
|
44
|
+
type: _e,
|
|
45
45
|
newQuestion: e,
|
|
46
46
|
session: s
|
|
47
47
|
}), A.current = e;
|
|
48
48
|
}, [o]), B = r.useCallback((e) => {
|
|
49
49
|
o({
|
|
50
|
-
type:
|
|
50
|
+
type: Ce,
|
|
51
51
|
error: e
|
|
52
52
|
});
|
|
53
53
|
}, [o]), I = r.useCallback((e, s, t) => {
|
|
@@ -57,7 +57,7 @@ function Fe({
|
|
|
57
57
|
error: n,
|
|
58
58
|
citations: f = [],
|
|
59
59
|
createdAt: T = null,
|
|
60
|
-
encodedSession:
|
|
60
|
+
encodedSession: _ = void 0,
|
|
61
61
|
contextSession: b = void 0
|
|
62
62
|
} = e, M = s.set("citations", $(f)).merge({
|
|
63
63
|
answer: a,
|
|
@@ -68,20 +68,20 @@ function Fe({
|
|
|
68
68
|
isCompleted: t
|
|
69
69
|
});
|
|
70
70
|
let N;
|
|
71
|
-
|
|
72
|
-
encodedSession:
|
|
71
|
+
_ && (N = {
|
|
72
|
+
encodedSession: _
|
|
73
73
|
}), b && (N = {
|
|
74
74
|
contextSession: b
|
|
75
75
|
}), c(M, N);
|
|
76
76
|
}, [c, $]), G = r.useCallback(
|
|
77
77
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
78
|
(e, s) => {
|
|
79
|
-
const t = e?.message || "", a = e?.response?.status === 429 || Le.test(t), E = e?.code === Y || e?.errorCode === Y, n = e?.response?.status === 204, f = e?.response?.status === 412, T = n ?
|
|
79
|
+
const t = e?.message || "", a = e?.response?.status === 429 || Le.test(t), E = e?.code === Y || e?.errorCode === Y, n = e?.response?.status === 204, f = e?.response?.status === 412, T = n ? C.NO_CONTENT : a ? C.RATE_LIMITING : f ? C.PRECONDITION_FAILED : E ? C.AGENT_NOT_FOUND : C.GENERAL, _ = s.merge({
|
|
80
80
|
error: T,
|
|
81
81
|
isLoading: !1,
|
|
82
82
|
isCompleted: !0
|
|
83
83
|
});
|
|
84
|
-
c(
|
|
84
|
+
c(_, void 0);
|
|
85
85
|
},
|
|
86
86
|
[c]
|
|
87
87
|
), S = r.useCallback(async (e, s) => {
|
|
@@ -98,7 +98,7 @@ function Fe({
|
|
|
98
98
|
O ? F.receiveStreamedResponse(a, n, (f) => {
|
|
99
99
|
const {
|
|
100
100
|
code: T,
|
|
101
|
-
data:
|
|
101
|
+
data: _,
|
|
102
102
|
error: b,
|
|
103
103
|
citations: M,
|
|
104
104
|
contextSession: N,
|
|
@@ -107,7 +107,7 @@ function Fe({
|
|
|
107
107
|
thinkingAnswer: ne
|
|
108
108
|
} = f, te = {
|
|
109
109
|
thinkingAnswer: ne,
|
|
110
|
-
answer:
|
|
110
|
+
answer: _,
|
|
111
111
|
citations: M,
|
|
112
112
|
error: b,
|
|
113
113
|
contextSession: N,
|
|
@@ -120,13 +120,13 @@ function Fe({
|
|
|
120
120
|
code: T
|
|
121
121
|
}, e);
|
|
122
122
|
}, void 0, g, m) : (Object.entries(n).forEach(([f, T]) => {
|
|
123
|
-
const
|
|
124
|
-
delete n[f], n[
|
|
123
|
+
const _ = ie(f);
|
|
124
|
+
delete n[f], n[_] = T;
|
|
125
125
|
}), I(n, e, !0));
|
|
126
126
|
} catch (t) {
|
|
127
127
|
if (x && t instanceof Error && t.name === "AbortError") {
|
|
128
128
|
const a = e.set("error", []).merge({
|
|
129
|
-
error:
|
|
129
|
+
error: C.RESPONSE_STOPPED,
|
|
130
130
|
isLoading: !1,
|
|
131
131
|
isCompleted: !0
|
|
132
132
|
});
|
|
@@ -163,7 +163,7 @@ function Fe({
|
|
|
163
163
|
type: V,
|
|
164
164
|
isLoading: !1
|
|
165
165
|
}), A.current)) {
|
|
166
|
-
const a = A.current.set("error",
|
|
166
|
+
const a = A.current.set("error", C.GENERAL).merge({
|
|
167
167
|
isLoading: !1,
|
|
168
168
|
isCompleted: !0
|
|
169
169
|
});
|
|
@@ -172,7 +172,7 @@ function Fe({
|
|
|
172
172
|
}
|
|
173
173
|
}, [d, l, u, H, o, R, B, c]), p = r.useCallback((e, s, t = !0) => {
|
|
174
174
|
const a = !i.isLoading && !i.encodedSession && !y && d, E = i?.questions || [];
|
|
175
|
-
t && (e.id = `${E.length}`), !R && a && (e.error =
|
|
175
|
+
t && (e.id = `${E.length}`), !R && a && (e.error = C.GENERAL, e.isLoading = !1, e.isCompleted = !0);
|
|
176
176
|
const n = new Ne(e);
|
|
177
177
|
return c(n), R || i.encodedSession ? S(n, s) : !i.isLoading && !R && d && Q(!0, !1), n;
|
|
178
178
|
}, [i.encodedSession, i.isLoading, i?.questions, Q, d, y, S, R, c]), z = r.useCallback((e, s) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as E,
|
|
1
|
+
import { R as E, a as d } from "../../../../chunks/types.js";
|
|
2
2
|
import { SET_ANSWER_FEEDBACK as T, SET_SUGGESTED_QUESTIONS as g, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as _, SET_MODAL_SUCCESS as I, SET_MODAL_ERROR as R, UPDATE_QUESTION as l, CLEAR_CONVERSATION_HISTORY as c, SET_IS_LOADING as w, SET_NEW_ITEM as f } from "./actions.js";
|
|
3
3
|
import { ContentAnswersRecord as A, ContentAnswersItemRecord as h } from "./records.js";
|
|
4
|
-
const
|
|
4
|
+
const Q = (t, s) => {
|
|
5
5
|
switch (s.type) {
|
|
6
6
|
case f:
|
|
7
7
|
return new A({
|
|
@@ -61,5 +61,5 @@ const O = (t, s) => {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
64
|
-
|
|
64
|
+
Q as default
|
|
65
65
|
};
|