@box/box-ai-content-answers 0.116.1 → 0.117.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.
@@ -1,69 +1,78 @@
1
- import { FilterChip as a, Popover as n, Status as S, SmallList as c } from "@box/blueprint-web";
2
- import { useState as f, useCallback as C } from "react";
3
- import { useIntl as I } from "react-intl";
4
- import { useAgents as v, useAgentsDispatch as N } from "../../contexts/AgentsContext.js";
5
- import { LOGGER_BASE_CONFIG as G, LOGGER_ACTION_CLICK as O } from "../common/constants.js";
6
- import p from "./messages.js";
7
- import { jsx as e, jsxs as d } from "react/jsx-runtime";
8
- import '../../../../styles/agent-selector.css';const A = "_agentSelector_avzc4_1", E = "_agentStatus_avzc4_5", x = "_agentList_avzc4_19", T = "_agentListItem_avzc4_19", s = {
9
- agentSelector: A,
10
- agentStatus: E,
11
- agentList: x,
12
- agentListItem: T
13
- }, F = ({
14
- onSelectAgent: o,
1
+ import { FilterChip as n, Popover as s, Status as C, SmallList as m } from "@box/blueprint-web";
2
+ import { useLocalStorageAIAgents as I, AI_AGENTS_LOCAL_STORAGE_KEY as E } from "@box/box-ai-agent-selector";
3
+ import { useState as N, useCallback as G, useEffect as v } from "react";
4
+ import { useIntl as O } from "react-intl";
5
+ import { useAgents as T, useAgentsDispatch as x } from "../../contexts/AgentsContext.js";
6
+ import { LOGGER_BASE_CONFIG as y, LOGGER_ACTION_CLICK as z } from "../common/constants.js";
7
+ import f from "./messages.js";
8
+ import { jsx as t, jsxs as L } from "react/jsx-runtime";
9
+ import '../../../../styles/agent-selector.css';const R = "_agentSelector_avzc4_1", b = "_agentStatus_avzc4_5", K = "_agentList_avzc4_19", P = "_agentListItem_avzc4_19", o = {
10
+ agentSelector: R,
11
+ agentStatus: b,
12
+ agentList: K,
13
+ agentListItem: P
14
+ }, Y = ({
15
+ onSelectAgent: a,
15
16
  recordAction: r
16
17
  }) => {
17
18
  const {
18
- formatMessage: i
19
- } = I(), {
20
- agents: h,
21
- selectedAgent: l
22
- } = v(), m = N(), [_, g] = f(!1), u = i(p.selectAgent), L = C((t) => {
23
- g(!1), m({
19
+ formatMessage: g
20
+ } = O(), {
21
+ agents: i,
22
+ selectedAgent: p
23
+ } = T(), [d, c] = I(E), l = x(), [u, _] = N(!1), S = g(f.selectAgent), h = G((e) => {
24
+ _(!1), l({
24
25
  type: "SELECT_AGENT",
25
- agentName: t.name
26
- }), r && r({
27
- ...G,
28
- action: O,
26
+ agentName: e.name
27
+ }), c(e.id), r && r({
28
+ ...y,
29
+ action: z,
29
30
  target: "agentSelector",
30
31
  data: {
31
- agentSelected: t.name
32
+ agentSelected: e.name
32
33
  }
33
- }), o && o(t);
34
- }, [m, o, r]);
35
- return /* @__PURE__ */ e(a.Group, {
36
- className: s.agentSelector,
37
- name: u,
34
+ }), a && a(e);
35
+ }, [l, a, r, c]);
36
+ return v(() => {
37
+ if (d) {
38
+ const e = i.find((A) => A.id === d);
39
+ e ? (l({
40
+ type: "SELECT_AGENT",
41
+ agentName: e.name
42
+ }), a && a(e)) : c(null);
43
+ }
44
+ }, [i]), /* @__PURE__ */ t(n.Group, {
45
+ className: o.agentSelector,
46
+ name: S,
38
47
  type: "multiple",
39
- children: /* @__PURE__ */ d(n.Root, {
48
+ children: /* @__PURE__ */ L(s.Root, {
40
49
  modal: !1,
41
- onOpenChange: g,
42
- open: _,
43
- children: [/* @__PURE__ */ e(n.Trigger, {
44
- children: /* @__PURE__ */ d(a.TriggerChip, {
50
+ onOpenChange: _,
51
+ open: u,
52
+ children: [/* @__PURE__ */ t(s.Trigger, {
53
+ children: /* @__PURE__ */ L(n.TriggerChip, {
45
54
  value: "trigger-chip",
46
- children: [/* @__PURE__ */ e(S, {
47
- className: s.agentStatus,
55
+ children: [/* @__PURE__ */ t(C, {
56
+ className: o.agentStatus,
48
57
  colorIndex: 0,
49
- text: i(p.agent)
50
- }), /* @__PURE__ */ e(a.Label, {
51
- children: l.name
52
- }), /* @__PURE__ */ e(a.DropdownIndicator, {})]
58
+ text: g(f.agent)
59
+ }), /* @__PURE__ */ t(n.Label, {
60
+ children: p.name
61
+ }), /* @__PURE__ */ t(n.DropdownIndicator, {})]
53
62
  })
54
- }), /* @__PURE__ */ e(n.ContentContainer, {
55
- children: /* @__PURE__ */ e(n.MainContent, {
56
- children: /* @__PURE__ */ e(c, {
57
- className: s.agentList,
58
- selectedKeys: [l.name],
59
- children: h.map((t) => /* @__PURE__ */ e(c.Item, {
60
- className: s.agentListItem,
61
- id: t.name,
62
- onAction: () => L(t),
63
- children: /* @__PURE__ */ e(c.Header, {
64
- children: t.name
63
+ }), /* @__PURE__ */ t(s.ContentContainer, {
64
+ children: /* @__PURE__ */ t(s.MainContent, {
65
+ children: /* @__PURE__ */ t(m, {
66
+ className: o.agentList,
67
+ selectedKeys: [p.name],
68
+ children: i.map((e) => /* @__PURE__ */ t(m.Item, {
69
+ className: o.agentListItem,
70
+ id: e.name,
71
+ onAction: () => h(e),
72
+ children: /* @__PURE__ */ t(m.Header, {
73
+ children: e.name
65
74
  })
66
- }, t.name))
75
+ }, e.name))
67
76
  })
68
77
  })
69
78
  })]
@@ -71,5 +80,5 @@ import '../../../../styles/agent-selector.css';const A = "_agentSelector_avzc4_1
71
80
  });
72
81
  };
73
82
  export {
74
- F as AgentSelector
83
+ Y as AgentSelector
75
84
  };
@@ -1,29 +1,29 @@
1
- const a = (t) => ({
1
+ const a = (e) => ({
2
2
  ask: {
3
3
  type: "ai_agent_ask",
4
4
  longText: {
5
- model: t
5
+ model: e
6
6
  },
7
7
  longTextMulti: {
8
- model: t
8
+ model: e
9
9
  },
10
10
  basicText: {
11
- model: t
11
+ model: e
12
12
  },
13
13
  basicTextMulti: {
14
- model: t
14
+ model: e
15
15
  }
16
16
  }
17
- }), e = (t, _ = null, n = !1) => ({
17
+ }), t = (e, _ = null, n = !1) => ({
18
18
  id: _,
19
- name: t,
20
- config: _ ? a(_) : null,
19
+ name: e,
20
+ config: _ && _ !== "0" ? a(_) : null,
21
21
  isDefault: n,
22
22
  isEnterpriseDefault: n,
23
23
  isSelected: n
24
- }), i = [e("Box (default)", null, !0), e("Box (gpt-3.5-turbo)", "azure__openai__gpt_3_5_turbo_16k"), e("Box (gpt-4o)", "openai__gpt_4o_2024_05_13"), e("Box (gemini 1.5 flash", "google__gemini_1_5_flash_001"), e("Box (gemini 1.5 pro)", "google__gemini_1_5_pro_001"), e("Box (gemini 2.0 flash)", "google__gemini_2_0_flash_exp"), e("Box (claude 3 sonnet)", "aws__claude_3_sonnet"), e("Box (claude 3.5 sonnet)", "aws__claude_3_5_sonnet"), e("Box (claude 3 haiku)", "aws__claude_3_haiku"), e("Box (titan text lite)", "aws__titan_text_lite"), e("Box (titan text express)", "aws__titan_text_express")], o = {
24
+ }), i = [t("Box (default)", "0", !0), t("Box (gpt-3.5-turbo)", "azure__openai__gpt_3_5_turbo_16k"), t("Box (gpt-4o)", "openai__gpt_4o_2024_05_13"), t("Box (gemini 1.5 flash", "google__gemini_1_5_flash_001"), t("Box (gemini 1.5 pro)", "google__gemini_1_5_pro_001"), t("Box (gemini 2.0 flash)", "google__gemini_2_0_flash_exp"), t("Box (claude 3 sonnet)", "aws__claude_3_sonnet"), t("Box (claude 3.5 sonnet)", "aws__claude_3_5_sonnet"), t("Box (claude 3 haiku)", "aws__claude_3_haiku"), t("Box (titan text lite)", "aws__titan_text_lite"), t("Box (titan text express)", "aws__titan_text_express")], o = {
25
25
  agents: i,
26
- selectedAgent: i.find((t) => t.isSelected)
26
+ selectedAgent: i.find((e) => e.isSelected)
27
27
  };
28
28
  export {
29
29
  i as agentList,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/box-ai-content-answers",
3
- "version": "0.116.1",
3
+ "version": "0.117.0",
4
4
  "peerDependencies": {
5
5
  "@box/blueprint-web": "^7.8.0",
6
6
  "@box/blueprint-web-assets": "^4.35.0",
@@ -16,10 +16,10 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@box/babel-plugin-target-attributes": "1.3.0",
19
- "@box/blueprint-web": "^11.0.3",
19
+ "@box/blueprint-web": "^11.1.0",
20
20
  "@box/blueprint-web-assets": "^4.40.0",
21
- "@box/box-ai-agent-selector": "^0.37.1",
22
- "@box/item-icon": "^0.9.113",
21
+ "@box/box-ai-agent-selector": "^0.38.0",
22
+ "@box/item-icon": "^0.9.114",
23
23
  "@box/storybook-utils": "^0.9.2",
24
24
  "@testing-library/react": "^15.0.6",
25
25
  "react": "^18.3.0",