@box/box-ai-content-answers 0.154.4 → 0.156.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.
Files changed (50) hide show
  1. package/dist/esm/lib/components/answer/constants.js +3 -3
  2. package/dist/esm/lib/components/answer/feedback-tooltip.js +87 -84
  3. package/dist/esm/lib/components/answer/messages.js +1 -1
  4. package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +113 -109
  5. package/dist/esm/lib/components/api-wrapper/records.js +10 -8
  6. package/dist/esm/lib/components/api-wrapper/utils/stream.js +27 -27
  7. package/dist/esm/lib/components/chat/chat.js +90 -84
  8. package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +235 -0
  9. package/dist/esm/lib/components/thinkingBubble/messages.js +26 -0
  10. package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +122 -0
  11. package/dist/i18n/bn-IN.js +5 -0
  12. package/dist/i18n/da-DK.js +5 -0
  13. package/dist/i18n/de-DE.js +5 -0
  14. package/dist/i18n/en-AU.js +5 -0
  15. package/dist/i18n/en-CA.js +5 -0
  16. package/dist/i18n/en-GB.js +5 -0
  17. package/dist/i18n/en-US.js +6 -1
  18. package/dist/i18n/en-US.properties +12 -2
  19. package/dist/i18n/en-x-pseudo.js +5 -0
  20. package/dist/i18n/es-419.js +5 -0
  21. package/dist/i18n/es-ES.js +5 -0
  22. package/dist/i18n/fi-FI.js +5 -0
  23. package/dist/i18n/fr-CA.js +5 -0
  24. package/dist/i18n/fr-FR.js +5 -0
  25. package/dist/i18n/hi-IN.js +5 -0
  26. package/dist/i18n/it-IT.js +5 -0
  27. package/dist/i18n/ja-JP.js +5 -0
  28. package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
  29. package/dist/i18n/json/src/lib/components/thinkingBubble/messages.json +1 -0
  30. package/dist/i18n/ko-KR.js +5 -0
  31. package/dist/i18n/nb-NO.js +5 -0
  32. package/dist/i18n/nl-NL.js +5 -0
  33. package/dist/i18n/pl-PL.js +5 -0
  34. package/dist/i18n/pt-BR.js +5 -0
  35. package/dist/i18n/ru-RU.js +5 -0
  36. package/dist/i18n/sv-SE.js +5 -0
  37. package/dist/i18n/tr-TR.js +5 -0
  38. package/dist/i18n/zh-CN.js +5 -0
  39. package/dist/i18n/zh-TW.js +5 -0
  40. package/dist/styles/boxAILoadingIndicator.css +1 -0
  41. package/dist/styles/feedback-tooltip.css +1 -1
  42. package/dist/styles/thinkingBubble.css +1 -0
  43. package/dist/types/lib/components/answer/constants.d.ts +1 -1
  44. package/dist/types/lib/components/api-wrapper/records.d.ts +1 -0
  45. package/dist/types/lib/components/api-wrapper/types.d.ts +1 -0
  46. package/dist/types/lib/components/thinkingBubble/boxAILoadingIndicator.d.ts +3 -0
  47. package/dist/types/lib/components/thinkingBubble/messages.d.ts +28 -0
  48. package/dist/types/lib/components/thinkingBubble/thinkingBubble.d.ts +26 -0
  49. package/dist/types/lib/types.d.ts +1 -0
  50. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- const o = "abuse@box.com", A = 500;
1
+ const o = "/report-abuse", t = 500;
2
2
  export {
3
- o as ABUSE_REPORT_EMAIL,
4
- A as MAX_CITATION_LENGTH
3
+ o as ABUSE_FORM_PATH,
4
+ t as MAX_CITATION_LENGTH
5
5
  };
@@ -1,44 +1,53 @@
1
- import { Formik as F, Form as g } from "formik";
2
- import { GuidedTooltip as l, Radio as c, TextArea as I, Checkbox as L, Text as P, Link as v } from "@box/blueprint-web";
3
- import { useIntl as y, FormattedMessage as N } from "react-intl";
4
- import { F as n } from "../../../../chunks/types.js";
5
- import { ABUSE_REPORT_EMAIL as k } from "./constants.js";
6
- import j from "../../messages.js";
7
- import a from "./messages.js";
8
- import { jsx as e, jsxs as s, Fragment as E } from "react/jsx-runtime";
9
- import '../../../../styles/feedback-tooltip.css';const R = "_feedbackTooltip_hjxds_1", B = "_feedbackTooltipForm_hjxds_8", D = "_feedbackTooltipTitle_hjxds_12", w = "_feedbackTooltipTextarea_hjxds_15", O = "_feedbackTooltipSubmitBtn_hjxds_18", M = "_feedbackTooltipPromptShareConsent_hjxds_21", U = "_feedbackTooltipAbuseDisclaimer_hjxds_24", z = "_feedbackTooltipAbuseLink_hjxds_28", t = {
10
- feedbackTooltip: R,
11
- feedbackTooltipForm: B,
12
- feedbackTooltipTitle: D,
13
- feedbackTooltipTextarea: w,
1
+ import { Formik as y, Form as F } from "formik";
2
+ import { GuidedTooltip as l, Radio as c, TextArea as g, Checkbox as x, Text as I, Link as L } from "@box/blueprint-web";
3
+ import { useIntl as P, FormattedMessage as v } from "react-intl";
4
+ import { F as p } from "../../../../chunks/types.js";
5
+ import { ABUSE_FORM_PATH as N } from "./constants.js";
6
+ import R from "../../messages.js";
7
+ import t from "./messages.js";
8
+ import { jsx as e, jsxs as r, Fragment as w } from "react/jsx-runtime";
9
+ import '../../../../styles/feedback-tooltip.css';const B = "_feedbackTooltip_1y93t_1", D = "_feedbackTooltipForm_1y93t_8", E = "_feedbackTooltipTitle_1y93t_12", U = "_feedbackTooltipTextarea_1y93t_15", O = "_feedbackTooltipSubmitBtn_1y93t_18", M = "_feedbackTooltipPromptShareConsent_1y93t_21", $ = "_feedbackTooltipAbuseDisclaimer_1y93t_24", j = "_feedbackTooltipAbuseLink_1y93t_28", a = {
10
+ feedbackTooltip: B,
11
+ feedbackTooltipForm: D,
12
+ feedbackTooltipTitle: E,
13
+ feedbackTooltipTextarea: U,
14
14
  feedbackTooltipSubmitBtn: O,
15
15
  feedbackTooltipPromptShareConsent: M,
16
- feedbackTooltipAbuseDisclaimer: U,
17
- feedbackTooltipAbuseLink: z
18
- }, K = ({
19
- children: b,
20
- isOpen: f,
21
- onOpenChange: p,
22
- onSubmit: u,
23
- shouldIncludeFeedbackText: T,
24
- shouldIncludePromptShareConsent: h,
25
- shouldShow: _
16
+ feedbackTooltipAbuseDisclaimer: $,
17
+ feedbackTooltipAbuseLink: j
18
+ }, z = (s) => {
19
+ const n = encodeURIComponent(window.location.href);
20
+ return /* @__PURE__ */ e(L, {
21
+ className: a.feedbackTooltipAbuseLink,
22
+ href: `${N}/${n}`,
23
+ rel: "noopener noreferrer",
24
+ target: "_blank",
25
+ children: s
26
+ });
27
+ }, X = ({
28
+ children: s,
29
+ isOpen: n,
30
+ onOpenChange: T,
31
+ onSubmit: f,
32
+ shouldIncludeFeedbackText: m,
33
+ shouldIncludePromptShareConsent: u,
34
+ shouldShow: h
26
35
  }) => {
27
36
  const {
28
37
  formatMessage: o
29
- } = y();
30
- if (!_)
31
- return b;
32
- const x = () => {
33
- p(!1);
34
- }, A = (r) => {
35
- u(r);
38
+ } = P();
39
+ if (!h)
40
+ return s;
41
+ const _ = () => {
42
+ T(!1);
43
+ }, A = (d) => {
44
+ f(d);
36
45
  };
37
46
  return /* @__PURE__ */ e(l, {
38
47
  align: "end",
39
- className: t.feedbackTooltip,
40
- closeLabel: o(j.closeButtonText),
41
- content: /* @__PURE__ */ e(F, {
48
+ className: a.feedbackTooltip,
49
+ closeLabel: o(R.closeButtonText),
50
+ content: /* @__PURE__ */ e(y, {
42
51
  initialValues: {
43
52
  feedback: "",
44
53
  feedbackPromptShareConsent: !0,
@@ -47,97 +56,91 @@ import '../../../../styles/feedback-tooltip.css';const R = "_feedbackTooltip_hjx
47
56
  },
48
57
  onSubmit: A,
49
58
  children: ({
50
- submitForm: r,
51
- setFieldValue: d,
59
+ submitForm: d,
60
+ setFieldValue: b,
52
61
  values: {
53
62
  feedback: C,
54
63
  feedbackPromptShareConsent: S,
55
- issueType: m
64
+ issueType: k
56
65
  }
57
- }) => /* @__PURE__ */ s(E, {
58
- children: [/* @__PURE__ */ s(l.Body, {
66
+ }) => /* @__PURE__ */ r(w, {
67
+ children: [/* @__PURE__ */ r(l.Body, {
59
68
  children: [/* @__PURE__ */ e(l.Title, {
60
- className: t.feedbackTooltipTitle,
61
- children: o(a.feedbackTooltipTitle)
62
- }), /* @__PURE__ */ s(g, {
63
- className: t.feedbackTooltipForm,
69
+ className: a.feedbackTooltipTitle,
70
+ children: o(t.feedbackTooltipTitle)
71
+ }), /* @__PURE__ */ r(F, {
72
+ className: a.feedbackTooltipForm,
64
73
  children: [/* @__PURE__ */ e(c.Legend, {
65
- header: o(a.feedbackTooltipIssueTypeLabel),
66
- children: /* @__PURE__ */ s(c.Group, {
74
+ header: o(t.feedbackTooltipIssueTypeLabel),
75
+ children: /* @__PURE__ */ r(c.Group, {
67
76
  defaultValue: "",
68
77
  loop: !0,
69
78
  name: "issueType",
70
- onValueChange: (i) => d("issueType", i),
79
+ onValueChange: (i) => b("issueType", i),
71
80
  orientation: "vertical",
72
- value: m,
81
+ value: k,
73
82
  children: [/* @__PURE__ */ e(c.Item, {
74
- label: o(a.feedbackTooltipIssueTypeAnswer1),
75
- value: n.INACCURATE_ANSWER
83
+ label: o(t.feedbackTooltipIssueTypeAnswer1),
84
+ value: p.INACCURATE_ANSWER
76
85
  }), /* @__PURE__ */ e(c.Item, {
77
- label: o(a.feedbackTooltipIssueTypeAnswer2),
78
- value: n.DID_NOT_FOLLOW_REQUEST
86
+ label: o(t.feedbackTooltipIssueTypeAnswer2),
87
+ value: p.DID_NOT_FOLLOW_REQUEST
79
88
  }), /* @__PURE__ */ e(c.Item, {
80
- label: o(a.feedbackTooltipIssueTypeAnswer3),
81
- value: n.OTHER
89
+ label: o(t.feedbackTooltipIssueTypeAnswer3),
90
+ value: p.OTHER
82
91
  })]
83
92
  })
84
- }), T && /* @__PURE__ */ e(I, {
85
- className: t.feedbackTooltipTextarea,
86
- label: o(a.feedbackTooltipFeedbackLabel),
93
+ }), m && /* @__PURE__ */ e(g, {
94
+ className: a.feedbackTooltipTextarea,
95
+ label: o(t.feedbackTooltipFeedbackLabel),
87
96
  maxRows: 4,
88
97
  minRows: 4,
89
- onChange: (i) => d("feedback", i.target.value),
90
- placeholder: o(a.feedbackTooltipFeedbackPlaceholder),
98
+ onChange: (i) => b("feedback", i.target.value),
99
+ placeholder: o(t.feedbackTooltipFeedbackPlaceholder),
91
100
  value: C
92
- }), h && /* @__PURE__ */ e(L.Item, {
101
+ }), u && /* @__PURE__ */ e(x.Item, {
93
102
  checked: S,
94
- className: t.feedbackTooltipPromptShareConsent,
103
+ className: a.feedbackTooltipPromptShareConsent,
95
104
  "data-target-id": "Checkbox.Item-boxAiFeedbackPromptShareConsent",
96
- label: o(a.feedbackTooltipPromptShareConsent),
105
+ label: o(t.feedbackTooltipPromptShareConsent),
97
106
  onCheckedChange: (i) => {
98
- d("feedbackPromptShareConsent", i);
107
+ b("feedbackPromptShareConsent", i);
99
108
  },
100
109
  value: "feedbackPromptShareConsent"
101
- }), T && /* @__PURE__ */ e(P, {
110
+ }), m && /* @__PURE__ */ e(I, {
102
111
  as: "p",
103
- className: t.feedbackTooltipAbuseDisclaimer,
112
+ className: a.feedbackTooltipAbuseDisclaimer,
104
113
  variant: "caption",
105
- children: /* @__PURE__ */ e(N, {
106
- ...a.feedbackTooltipAbuseDisclaimer,
114
+ children: /* @__PURE__ */ e(v, {
115
+ ...t.feedbackTooltipAbuseDisclaimer,
107
116
  values: {
108
- abuseEmailLink: /* @__PURE__ */ e(v, {
109
- className: t.feedbackTooltipAbuseLink,
110
- href: `mailto:${k}`,
111
- rel: "noopener noreferrer",
112
- target: "_blank",
113
- children: k
114
- })
117
+ abuseFormLink: z
115
118
  }
116
119
  })
117
120
  })]
118
121
  })]
119
- }), /* @__PURE__ */ s(l.Footer, {
122
+ }), /* @__PURE__ */ r(l.Footer, {
120
123
  children: [/* @__PURE__ */ e(l.Footer.SecondaryAction, {
121
- onClick: x,
124
+ onClick: _,
122
125
  size: "large",
123
- children: o(a.feedbackTooltipCancel)
126
+ children: o(t.feedbackTooltipCancel)
124
127
  }), /* @__PURE__ */ e(l.Footer.PrimaryAction, {
125
- className: t.feedbackTooltipSubmitBtn,
126
- disabled: !m,
127
- onClick: () => r(),
128
+ className: a.feedbackTooltipSubmitBtn,
129
+ disabled: !k,
130
+ onClick: () => d(),
128
131
  size: "large",
129
- children: o(a.feedbackTooltipSubmit)
132
+ children: o(t.feedbackTooltipSubmit)
130
133
  })]
131
134
  })]
132
135
  })
133
136
  }),
134
- onOpenChange: p,
135
- open: f,
137
+ onOpenChange: T,
138
+ open: n,
136
139
  side: "left",
137
- children: b
140
+ children: s
138
141
  });
139
142
  };
140
143
  export {
141
- K as FeedbackTooltip,
142
- K as default
144
+ X as FeedbackTooltip,
145
+ X as default
143
146
  };
@@ -38,7 +38,7 @@ const t = e({
38
38
  },
39
39
  feedbackTooltipAbuseDisclaimer: {
40
40
  id: "boxAI.contentAnswers.feedbackTooltipAbuseDisclaimer",
41
- defaultMessage: "To report inappropriate content, email {abuseEmailLink}"
41
+ defaultMessage: "To report inappropriate content, submit <abuseFormLink>this form</abuseFormLink>."
42
42
  },
43
43
  feedbackTooltipFeedbackLabel: {
44
44
  id: "boxAI.contentAnswers.feedbackTooltipFeedback",
@@ -1,37 +1,37 @@
1
- import { useAgentsDispatch as as, ACTIONS as ns } from "@box/box-ai-agent-selector";
1
+ import { useAgentsDispatch as as, ACTIONS as is } from "@box/box-ai-agent-selector";
2
2
  import us from "lodash/camelCase";
3
- import t, { useMemo as is, useCallback as cs } from "react";
4
- import { A as R, C as Es, R as V } from "../../../../../chunks/types.js";
5
- import { SET_NEW_ITEM as fs, UPDATE_QUESTION as rs, SET_MODAL_ERROR as Cs, SET_MODAL_SUCCESS as _s, SET_IS_LOADING as X, SET_ANSWER_FEEDBACK as Ts, CLEAR_CONVERSATION_HISTORY as Rs, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as Y, SET_SUGGESTED_QUESTIONS as ds } from "../actions.js";
6
- import { QuestionRecord as Ns } from "../records.js";
7
- import { defaultFormatSuggestions as Os, defaultFormatCitations as ys } from "../utils/format.js";
8
- import { getAnswerRequest as Ss } from "../utils/request.js";
3
+ import t, { useMemo as cs, useCallback as Es } from "react";
4
+ import { A as T, C as fs, R as V } from "../../../../../chunks/types.js";
5
+ import { SET_NEW_ITEM as rs, UPDATE_QUESTION as Cs, SET_MODAL_ERROR as _s, SET_MODAL_SUCCESS as Ts, SET_IS_LOADING as X, SET_ANSWER_FEEDBACK as Rs, CLEAR_CONVERSATION_HISTORY as ds, SET_SUGGESTED_QUESTIONS_REQUEST_STATE as Y, SET_SUGGESTED_QUESTIONS as Ns } from "../actions.js";
6
+ import { QuestionRecord as Os } from "../records.js";
7
+ import { defaultFormatSuggestions as ys, defaultFormatCitations as Ss } from "../utils/format.js";
8
+ import { getAnswerRequest as As } from "../utils/request.js";
9
9
  import F from "../utils/stream.js";
10
10
  const Ls = /Too Many Requests/i, z = "Agent not found";
11
- function Ms({
12
- contentAnswers: n,
13
- createSessionRequest: O,
11
+ function Fs({
12
+ contentAnswers: a,
13
+ createSessionRequest: y,
14
14
  dispatchStateUpdate: o,
15
15
  enterpriseId: D,
16
- fetchTimeout: k,
17
- formatCitations: v = ys,
16
+ fetchTimeout: m,
17
+ formatCitations: v = Ss,
18
18
  getAnswerStreaming: j,
19
19
  getAnswer: x,
20
20
  getSuggestedQuestions: I,
21
21
  isStopResponseEnabled: K,
22
- isStreamingEnabled: S,
22
+ isStreamingEnabled: A,
23
23
  itemID: E,
24
- items: i,
24
+ items: u,
25
25
  onSuggestedQuestionsFetched: P,
26
- sendErrorLog: G,
27
- shouldPreinitSession: d = !0,
26
+ sendErrorLog: g,
27
+ shouldPreinitSession: N = !0,
28
28
  userId: W
29
29
  }) {
30
- const y = t.useRef(null), $ = as(), L = is(() => Array.isArray(i) && i.length > 1, [i]), B = cs((s) => Array.isArray(s) ? v(s) : null, [v]);
30
+ const S = t.useRef(null), $ = as(), L = cs(() => Array.isArray(u) && u.length > 1, [u]), B = Es((s) => Array.isArray(s) ? v(s) : null, [v]);
31
31
  t.useEffect(
32
32
  (s) => {
33
- E && E !== n.item.id && o({
34
- type: fs,
33
+ E && E !== a.item.id && o({
34
+ type: rs,
35
35
  itemID: E,
36
36
  fileVersionID: s
37
37
  });
@@ -41,109 +41,113 @@ function Ms({
41
41
  );
42
42
  const c = t.useCallback((s, e) => {
43
43
  o({
44
- type: rs,
44
+ type: Cs,
45
45
  newQuestion: s,
46
46
  session: e
47
- }), y.current = s;
47
+ }), S.current = s;
48
48
  }, [o]), H = t.useCallback((s) => {
49
49
  o({
50
- type: Cs,
50
+ type: _s,
51
51
  error: s
52
52
  });
53
- }, [o]), Q = t.useCallback((s, e, a) => {
53
+ }, [o]), G = t.useCallback((s, e, l) => {
54
54
  const {
55
- answer: u,
56
- error: f,
57
- citations: l = [],
58
- createdAt: r = null,
55
+ answer: i,
56
+ thinkingAnswer: f,
57
+ error: n,
58
+ citations: r = [],
59
+ createdAt: R = null,
59
60
  encodedSession: C = void 0,
60
- contextSession: _ = void 0
61
- } = s, N = e.set("citations", B(l)).merge({
62
- answer: u,
63
- error: f,
64
- created_at: r,
61
+ contextSession: d = void 0
62
+ } = s, O = e.set("citations", B(r)).merge({
63
+ answer: i,
64
+ thinkingAnswer: f,
65
+ error: n,
66
+ created_at: R,
65
67
  isLoading: !1,
66
- isCompleted: a
68
+ isCompleted: l
67
69
  });
68
- let T;
69
- C && (T = {
70
+ let _;
71
+ C && (_ = {
70
72
  encodedSession: C
71
- }), _ && (T = {
72
- contextSession: _
73
- }), c(N, T);
74
- }, [c, B]), g = t.useCallback(
73
+ }), d && (_ = {
74
+ contextSession: d
75
+ }), c(O, _);
76
+ }, [c, B]), Q = t.useCallback(
75
77
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
78
  (s, e) => {
77
- var N, T, m;
78
- const a = (s == null ? void 0 : s.message) || "", u = ((N = s == null ? void 0 : s.response) == null ? void 0 : N.status) === 429 || Ls.test(a), f = (s == null ? void 0 : s.code) === z || (s == null ? void 0 : s.errorCode) === z, l = ((T = s == null ? void 0 : s.response) == null ? void 0 : T.status) === 204, r = ((m = s == null ? void 0 : s.response) == null ? void 0 : m.status) === 412, C = l ? R.NO_CONTENT : u ? R.RATE_LIMITING : r ? R.PRECONDITION_FAILED : f ? R.AGENT_NOT_FOUND : R.GENERAL, _ = e.merge({
79
- error: C,
79
+ var d, O, _;
80
+ const l = (s == null ? void 0 : s.message) || "", i = ((d = s == null ? void 0 : s.response) == null ? void 0 : d.status) === 429 || Ls.test(l), f = (s == null ? void 0 : s.code) === z || (s == null ? void 0 : s.errorCode) === z, n = ((O = s == null ? void 0 : s.response) == null ? void 0 : O.status) === 204, r = ((_ = s == null ? void 0 : s.response) == null ? void 0 : _.status) === 412, R = n ? T.NO_CONTENT : i ? T.RATE_LIMITING : r ? T.PRECONDITION_FAILED : f ? T.AGENT_NOT_FOUND : T.GENERAL, C = e.merge({
81
+ error: R,
80
82
  isLoading: !1,
81
83
  isCompleted: !0
82
84
  });
83
- c(_, void 0);
85
+ c(C, void 0);
84
86
  },
85
87
  [c]
86
- ), A = t.useCallback(async (s, e) => {
88
+ ), b = t.useCallback(async (s, e) => {
87
89
  try {
88
- const a = {
90
+ const l = {
89
91
  prompt: s.prompt,
90
92
  aiAgent: e || void 0,
91
93
  userId: W,
92
94
  enterpriseId: D
93
- }, u = `content-answers-${s.id}`;
95
+ }, i = `content-answers-${s.id}`;
94
96
  let f;
95
- S && (f = F.createAbortRequest(u));
96
- const l = await Ss(a, S, u, E, i, n, x, j, f, k, G);
97
- S ? F.receiveStreamedResponse(u, l, (r) => {
97
+ A && (f = F.createAbortRequest(i));
98
+ const n = await As(l, A, i, E, u, a, x, j, f, m, g);
99
+ A ? F.receiveStreamedResponse(i, n, (r) => {
98
100
  const {
99
- code: C,
100
- data: _,
101
- error: N,
102
- citations: T,
103
- contextSession: m,
101
+ code: R,
102
+ data: C,
103
+ error: d,
104
+ citations: O,
105
+ contextSession: _,
104
106
  isCompleted: os,
105
- createdAt: ts
107
+ createdAt: ts,
108
+ thinkingAnswer: ns
106
109
  } = r, ls = {
107
- answer: _,
108
- citations: T,
109
- error: N,
110
- contextSession: m,
110
+ thinkingAnswer: ns,
111
+ answer: C,
112
+ citations: O,
113
+ error: d,
114
+ contextSession: _,
111
115
  createdAt: ts
112
116
  };
113
- l.ok && l.status === 200 ? Q({
117
+ n.ok && n.status === 200 ? G({
114
118
  ...ls
115
- }, s, os) : g({
116
- response: l,
117
- code: C
119
+ }, s, os) : Q({
120
+ response: n,
121
+ code: R
118
122
  }, s);
119
- }, void 0, k, G) : (Object.entries(l).forEach(([r, C]) => {
120
- const _ = us(r);
121
- delete l[r], l[_] = C;
122
- }), Q(l, s, !0));
123
- } catch (a) {
124
- if (K && a instanceof Error && a.name === "AbortError") {
125
- const u = s.set("error", []).merge({
126
- error: R.RESPONSE_STOPPED,
123
+ }, void 0, m, g) : (Object.entries(n).forEach(([r, R]) => {
124
+ const C = us(r);
125
+ delete n[r], n[C] = R;
126
+ }), G(n, s, !0));
127
+ } catch (l) {
128
+ if (K && l instanceof Error && l.name === "AbortError") {
129
+ const i = s.set("error", []).merge({
130
+ error: T.RESPONSE_STOPPED,
127
131
  isLoading: !1,
128
132
  isCompleted: !0
129
133
  });
130
- c(u);
134
+ c(i);
131
135
  } else
132
- g(a, s);
136
+ Q(l, s);
133
137
  }
134
- }, [W, D, S, E, i, n, x, j, k, G, Q, g, K, c]), J = t.useCallback((s) => {
138
+ }, [W, D, A, E, u, a, x, j, m, g, G, Q, K, c]), J = t.useCallback((s) => {
135
139
  const {
136
140
  encoded_session: e,
137
141
  metadata: {
138
- is_large_file: a
142
+ is_large_file: l
139
143
  } = {
140
144
  is_large_file: !1
141
145
  }
142
146
  } = s;
143
147
  o({
144
- type: _s,
148
+ type: Ts,
145
149
  encodedSession: e,
146
- isLargeFile: a
150
+ isLargeFile: l
147
151
  });
148
152
  }, [o]), p = t.useCallback(async (s = !0, e = !0) => {
149
153
  try {
@@ -151,36 +155,36 @@ function Ms({
151
155
  type: X,
152
156
  isLoading: !0
153
157
  });
154
- const a = await O({
155
- items: i
158
+ const l = await y({
159
+ items: u
156
160
  }, E);
157
- J(a);
161
+ J(l);
158
162
  } catch {
159
- if (e && H(Es.GENERAL), !d && (o({
163
+ if (e && H(fs.GENERAL), !N && (o({
160
164
  type: X,
161
165
  isLoading: !1
162
- }), y.current)) {
163
- const u = y.current.set("error", R.GENERAL).merge({
166
+ }), S.current)) {
167
+ const i = S.current.set("error", T.GENERAL).merge({
164
168
  isLoading: !1,
165
169
  isCompleted: !0
166
170
  });
167
- c(u);
171
+ c(i);
168
172
  }
169
173
  }
170
- }, [O, i, E, J, o, d, H, c]), M = t.useCallback((s, e, a = !0) => {
171
- const u = !n.isLoading && !n.encodedSession && !L && O, f = (n == null ? void 0 : n.questions) || [];
172
- a && (s.id = `${f.length}`), !d && u && (s.error = R.GENERAL, s.isLoading = !1, s.isCompleted = !0);
173
- const l = new Ns(s);
174
- return c(l), d || n.encodedSession ? A(l, e) : !n.isLoading && !d && O && p(!0, !1), l;
175
- }, [n.encodedSession, n.isLoading, n == null ? void 0 : n.questions, p, O, L, A, d, c]), Z = t.useCallback((s, e) => {
174
+ }, [y, u, E, J, o, N, H, c]), M = t.useCallback((s, e, l = !0) => {
175
+ const i = !a.isLoading && !a.encodedSession && !L && y, f = (a == null ? void 0 : a.questions) || [];
176
+ l && (s.id = `${f.length}`), !N && i && (s.error = T.GENERAL, s.isLoading = !1, s.isCompleted = !0);
177
+ const n = new Os(s);
178
+ return c(n), N || a.encodedSession ? b(n, e) : !a.isLoading && !N && y && p(!0, !1), n;
179
+ }, [a.encodedSession, a.isLoading, a == null ? void 0 : a.questions, p, y, L, b, N, c]), Z = t.useCallback((s, e) => {
176
180
  o({
177
- type: Ts,
181
+ type: Rs,
178
182
  questionId: s,
179
183
  feedbackValue: e
180
184
  });
181
185
  }, [o]), q = t.useCallback(() => {
182
186
  o({
183
- type: Rs
187
+ type: ds
184
188
  });
185
189
  }, [o]), w = t.useCallback(async (s, e) => {
186
190
  M({
@@ -190,32 +194,32 @@ function Ms({
190
194
  isCompleted: !1,
191
195
  error: null
192
196
  }, e, !1);
193
- }, [M]), U = t.useCallback((s) => {
197
+ }, [M]), h = t.useCallback((s) => {
194
198
  let e;
195
- s ? e = s.id : y.current && (e = y.current.id), e && F.abortRequest(`content-answers-${e}`, !0);
196
- }, []), h = t.useCallback(async (s) => {
199
+ s ? e = s.id : S.current && (e = S.current.id), e && F.abortRequest(`content-answers-${e}`, !0);
200
+ }, []), U = t.useCallback(async (s) => {
197
201
  s && $({
198
- type: ns.SET_ASK_CONFIG,
202
+ type: is.SET_ASK_CONFIG,
199
203
  id: s.id,
200
204
  ask: s == null ? void 0 : s.ask
201
205
  });
202
- }, [$]), [b, ss] = t.useState("");
206
+ }, [$]), [k, ss] = t.useState("");
203
207
  t.useEffect(() => {
204
- if (!i || i.length === 0)
208
+ if (!u || u.length === 0)
205
209
  return;
206
- const s = i.map((e) => e.id).join(",");
207
- s !== b && ss(s);
208
- }, [i, b]);
210
+ const s = u.map((e) => e.id).join(",");
211
+ s !== k && ss(s);
212
+ }, [u, k]);
209
213
  const es = t.useCallback(async () => {
210
- if (!(!b || !I || L)) {
214
+ if (!(!k || !I || L)) {
211
215
  o({
212
216
  type: Y,
213
217
  requestState: V.IN_PROGRESS
214
218
  });
215
219
  try {
216
- const s = Os(await I(E, i));
220
+ const s = ys(await I(E, u));
217
221
  P && P(s), o({
218
- type: ds,
222
+ type: Ns,
219
223
  suggestedQuestions: s
220
224
  });
221
225
  } catch {
@@ -225,20 +229,20 @@ function Ms({
225
229
  });
226
230
  }
227
231
  }
228
- }, [o, I, L, E, b]);
232
+ }, [o, I, L, E, k]);
229
233
  return {
230
234
  clearConversation: q,
231
235
  createSession: p,
232
- fetchAgentConfig: h,
236
+ fetchAgentConfig: U,
233
237
  fetchSuggestedQuestions: es,
234
238
  retryQuestion: w,
235
239
  sendQuestion: M,
236
- sendQuestionAnswerRequest: A,
240
+ sendQuestionAnswerRequest: b,
237
241
  setAnswerFeedback: Z,
238
- stopQuestion: U,
242
+ stopQuestion: h,
239
243
  updateQuestionInState: c
240
244
  };
241
245
  }
242
246
  export {
243
- Ms as useContentAnswers
247
+ Fs as useContentAnswers
244
248
  };
@@ -1,16 +1,17 @@
1
1
  import { Record as e } from "immutable";
2
- import { R as s, U as n } from "../../../../chunks/types.js";
2
+ import { R as n, U as s } from "../../../../chunks/types.js";
3
3
  const o = e({
4
4
  has_streamed_responses: !0,
5
- has_citations_enabled: !1
5
+ has_citations_enabled: !1,
6
+ has_thinking_enabled: !1
6
7
  }), t = e({
7
8
  type: "file",
8
9
  id: null,
9
10
  version_id: null
10
11
  }), r = e({
11
12
  suggestions: [],
12
- requestState: s.NOT_STARTED
13
- }), u = e({
13
+ requestState: n.NOT_STARTED
14
+ }), a = e({
14
15
  config: new o(),
15
16
  encodedSession: null,
16
17
  contextSession: null,
@@ -21,22 +22,23 @@ const o = e({
21
22
  questions: [],
22
23
  shouldShowLandingPage: !0,
23
24
  suggestedQuestions: new r()
24
- }), a = e({
25
+ }), u = e({
25
26
  answer: null,
26
27
  citations: [],
27
28
  created_at: null,
28
29
  id: null,
29
30
  isCompleted: !1,
31
+ thinkingAnswer: null,
30
32
  isLoading: !0,
31
33
  error: null,
32
34
  prompt: null,
33
35
  feedbackValue: "none",
34
- promptType: n
36
+ promptType: s
35
37
  });
36
38
  export {
37
39
  o as ContentAnswersConfigRecord,
38
40
  t as ContentAnswersItemRecord,
39
- u as ContentAnswersRecord,
40
- a as QuestionRecord,
41
+ a as ContentAnswersRecord,
42
+ u as QuestionRecord,
41
43
  r as SuggestedQuestionsRecord
42
44
  };