@box/box-ai-content-answers 2.1.37 → 2.1.39
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/answer-content.js +1 -32
- package/dist/chunks/answer.js +1 -183
- package/dist/chunks/box-ai-content-answers.js +1 -78
- package/dist/chunks/chat.js +1 -116
- package/dist/chunks/citation.js +1 -124
- package/dist/chunks/clear-conversation-button.js +1 -37
- package/dist/chunks/content.js +1 -89
- package/dist/chunks/content2.js +1 -213
- package/dist/chunks/contextual-items-message.js +1 -43
- package/dist/chunks/embed-the-answer-button.js +1 -52
- package/dist/chunks/feedback-tooltip.js +1 -130
- package/dist/chunks/footer-actions.js +1 -44
- package/dist/chunks/inline-error.js +1 -63
- package/dist/chunks/items-dropdown.js +1 -67
- package/dist/chunks/markdown.js +6 -6776
- package/dist/chunks/markdown.module.js +1 -13
- package/dist/chunks/media-container.js +1 -32
- package/dist/chunks/question.js +1 -29
- package/dist/chunks/references.js +1 -43
- package/dist/chunks/stopResponseButton.js +1 -45
- package/dist/chunks/suggested-questions.js +1 -70
- package/dist/chunks/suggestions.js +1 -35
- package/dist/chunks/thinkingBubble.js +1 -111
- package/dist/chunks/thumb-buttons.js +1 -103
- package/dist/chunks/types.js +1 -14
- package/dist/chunks/unsupported-items-notice.js +1 -25
- package/dist/chunks/warning-message.js +1 -21
- package/dist/esm/index.js +1 -11
- package/dist/esm/lib/box-ai-content-answers.js +1 -2
- package/dist/esm/lib/components/answer/answer-content.js +1 -2
- package/dist/esm/lib/components/answer/answer.js +1 -2
- package/dist/esm/lib/components/answer/citation.js +1 -2
- package/dist/esm/lib/components/answer/constants.js +1 -2
- package/dist/esm/lib/components/answer/copy-button.js +1 -46
- package/dist/esm/lib/components/answer/embed-the-answer-button.js +1 -2
- package/dist/esm/lib/components/answer/feedback-tooltip.js +1 -2
- package/dist/esm/lib/components/answer/inline-error.js +1 -2
- package/dist/esm/lib/components/answer/loading-indicator.js +1 -29
- package/dist/esm/lib/components/answer/messages.js +1 -148
- package/dist/esm/lib/components/answer/no-citations.js +1 -29
- package/dist/esm/lib/components/answer/references.js +1 -2
- package/dist/esm/lib/components/answer/thumb-buttons.js +1 -2
- package/dist/esm/lib/components/api-wrapper/actions.js +1 -2
- package/dist/esm/lib/components/api-wrapper/api-wrapper.js +1 -8
- package/dist/esm/lib/components/api-wrapper/constants.js +1 -30
- package/dist/esm/lib/components/api-wrapper/content-answers-component.js +1 -83
- package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +1 -211
- package/dist/esm/lib/components/api-wrapper/records.js +1 -38
- package/dist/esm/lib/components/api-wrapper/reducer.js +1 -42
- package/dist/esm/lib/components/api-wrapper/utils/format.js +1 -13
- package/dist/esm/lib/components/api-wrapper/utils/request.js +1 -12
- package/dist/esm/lib/components/api-wrapper/utils/stream.js +2 -116
- package/dist/esm/lib/components/api-wrapper/utils/typed-record.js +1 -3
- package/dist/esm/lib/components/chat/chat.js +1 -2
- package/dist/esm/lib/components/chat/index.js +1 -2
- package/dist/esm/lib/components/common/agentUtils.js +1 -5
- package/dist/esm/lib/components/common/constants.js +1 -19
- package/dist/esm/lib/components/common/focusInputUtils.js +1 -5
- package/dist/esm/lib/components/common/inline-citation.js +1 -24
- package/dist/esm/lib/components/common/keyInputUtils.js +1 -3
- package/dist/esm/lib/components/common/markdown-react.js +1 -97
- package/dist/esm/lib/components/common/markdown.js +1 -2
- package/dist/esm/lib/components/common/media-container.js +1 -2
- package/dist/esm/lib/components/common/mock-data.js +1 -305
- package/dist/esm/lib/components/common/performance.js +1 -3
- package/dist/esm/lib/components/content/content.js +1 -2
- package/dist/esm/lib/components/content/index.js +1 -2
- package/dist/esm/lib/components/footer/constants.js +1 -12
- package/dist/esm/lib/components/footer/footer-actions.js +1 -2
- package/dist/esm/lib/components/footer/footer.js +1 -151
- package/dist/esm/lib/components/footer/index.js +1 -2
- package/dist/esm/lib/components/footer/messages.js +1 -36
- package/dist/esm/lib/components/footer/stopResponseButton.js +1 -2
- package/dist/esm/lib/components/modal/clear-conversation-button.js +1 -2
- package/dist/esm/lib/components/modal/hooks/useEventListeners.js +1 -10
- package/dist/esm/lib/components/modal/hooks/useStopPropagationOnEsc.js +1 -19
- package/dist/esm/lib/components/modal/messages.js +1 -20
- package/dist/esm/lib/components/modal/modal.js +1 -143
- package/dist/esm/lib/components/modal/title.js +1 -14
- package/dist/esm/lib/components/modal-error/index.js +1 -2
- package/dist/esm/lib/components/modal-error/messages.js +1 -16
- package/dist/esm/lib/components/modal-error/modal-error.js +1 -33
- package/dist/esm/lib/components/question/question.js +1 -2
- package/dist/esm/lib/components/sidebar/content.js +1 -2
- package/dist/esm/lib/components/sidebar/context.js +1 -16
- package/dist/esm/lib/components/sidebar/messages.js +1 -28
- package/dist/esm/lib/components/sidebar/sidebar.js +1 -80
- package/dist/esm/lib/components/sidebar/title.js +1 -14
- package/dist/esm/lib/components/suggested-questions/messages.js +1 -16
- package/dist/esm/lib/components/suggested-questions/mocks.js +1 -36
- package/dist/esm/lib/components/suggested-questions/suggested-questions.js +1 -2
- package/dist/esm/lib/components/suggested-questions/suggestions.js +1 -2
- package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +11 -277
- package/dist/esm/lib/components/thinkingBubble/messages.js +1 -24
- package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +1 -2
- package/dist/esm/lib/components/welcome-message/contextual-items-message.js +1 -2
- package/dist/esm/lib/components/welcome-message/items-dropdown.js +1 -2
- package/dist/esm/lib/components/welcome-message/messages.js +10 -52
- package/dist/esm/lib/components/welcome-message/unsupported-items-notice.js +1 -2
- package/dist/esm/lib/components/welcome-message/warning-message.js +1 -2
- package/dist/esm/lib/components/welcome-message/welcome-message.js +1 -53
- package/dist/esm/lib/constants.js +1 -9
- package/dist/esm/lib/hooks/usePromptFocus.js +1 -28
- package/dist/esm/lib/messages.js +1 -56
- package/dist/esm/lib/utils/constants.js +1 -2
- package/dist/esm/lib/utils/inlineCitationsUtils.js +1 -18
- package/package.json +11 -11
|
@@ -1,97 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { t as n } from "../../../../chunks/markdown.module.js";
|
|
3
|
-
import r from "./inline-citation.js";
|
|
4
|
-
import "react";
|
|
5
|
-
import { Link as i } from "@box/blueprint-web";
|
|
6
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
-
import s from "react-markdown";
|
|
8
|
-
import c from "remark-gfm";
|
|
9
|
-
var l = (e) => e?.startsWith("#user-content-fn") ?? !1, u = (t) => t ? e(t) : !1, d = (e) => e ? e.startsWith("http://") || e.startsWith("https://") : !1, f = (e) => e ? t(e) : !1, p = ({ children: e, className: t }) => {
|
|
10
|
-
let r = t ? t.replace("language-", "") : "";
|
|
11
|
-
return /* @__PURE__ */ o("div", {
|
|
12
|
-
className: n.hljs,
|
|
13
|
-
children: [/* @__PURE__ */ a("span", {
|
|
14
|
-
className: n.hljsLanguage,
|
|
15
|
-
children: r || "auto"
|
|
16
|
-
}), /* @__PURE__ */ a("code", { children: ((e) => e.trim().split(/\r?\n/).map((e, t) => /* @__PURE__ */ o("div", {
|
|
17
|
-
className: "hljs-line",
|
|
18
|
-
children: [/* @__PURE__ */ a("span", {
|
|
19
|
-
className: "hljs-line-number",
|
|
20
|
-
children: t + 1
|
|
21
|
-
}), /* @__PURE__ */ a("span", {
|
|
22
|
-
className: "hljs-line-content",
|
|
23
|
-
children: e
|
|
24
|
-
})]
|
|
25
|
-
}, `line-${e.substring(0, 20)}-${Date.now()}`)))(e) })]
|
|
26
|
-
});
|
|
27
|
-
}, m = ({ children: e }) => /* @__PURE__ */ a("div", {
|
|
28
|
-
className: n.tableWrapper,
|
|
29
|
-
children: /* @__PURE__ */ a("table", { children: e })
|
|
30
|
-
}), h = ({ children: e, href: t }) => !t || t === "" ? null : f(t) ? /* @__PURE__ */ a("a", {
|
|
31
|
-
href: t,
|
|
32
|
-
rel: "noopener noreferrer",
|
|
33
|
-
target: "_blank",
|
|
34
|
-
children: e
|
|
35
|
-
}) : /* @__PURE__ */ o("span", { children: [
|
|
36
|
-
e,
|
|
37
|
-
" (",
|
|
38
|
-
t,
|
|
39
|
-
")"
|
|
40
|
-
] }), g = ({ children: e }) => /* @__PURE__ */ a("blockquote", {
|
|
41
|
-
className: n.blockquote,
|
|
42
|
-
children: e
|
|
43
|
-
}), _ = ({ children: e }) => /* @__PURE__ */ a("ol", {
|
|
44
|
-
className: n.orderedList,
|
|
45
|
-
children: e
|
|
46
|
-
}), v = ({ children: e }) => {
|
|
47
|
-
let t = e?.toString().match(/^(\d+)/)?.[1] || e;
|
|
48
|
-
return /* @__PURE__ */ a("span", {
|
|
49
|
-
className: n.footnote,
|
|
50
|
-
children: t
|
|
51
|
-
});
|
|
52
|
-
}, y = {
|
|
53
|
-
code: p,
|
|
54
|
-
table: m,
|
|
55
|
-
blockquote: g,
|
|
56
|
-
ol: _,
|
|
57
|
-
sup: v,
|
|
58
|
-
p: ({ children: e }) => /* @__PURE__ */ a("div", {
|
|
59
|
-
className: n.inlineParagraph,
|
|
60
|
-
children: e
|
|
61
|
-
}),
|
|
62
|
-
a: h
|
|
63
|
-
}, b = ({ children: e, isInlineCitationV2Enabled: t = !1 }) => {
|
|
64
|
-
let o = {
|
|
65
|
-
...y,
|
|
66
|
-
a: (e) => {
|
|
67
|
-
let { href: o, children: s } = e;
|
|
68
|
-
if (l(o)) {
|
|
69
|
-
let e = s?.toString().match(/^(\d+)/)?.[1] || s;
|
|
70
|
-
return /* @__PURE__ */ a(i, {
|
|
71
|
-
href: o,
|
|
72
|
-
children: /* @__PURE__ */ a("span", {
|
|
73
|
-
className: n.footnoteReference,
|
|
74
|
-
children: e
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return u(o) ? /* @__PURE__ */ a(r, {
|
|
79
|
-
fileName: s?.toString() || "",
|
|
80
|
-
href: o,
|
|
81
|
-
isInlineCitationV2Enabled: t
|
|
82
|
-
}) : (d(o), /* @__PURE__ */ a(h, {
|
|
83
|
-
href: o,
|
|
84
|
-
children: s
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return /* @__PURE__ */ a("div", {
|
|
89
|
-
className: n.markdownContent,
|
|
90
|
-
children: /* @__PURE__ */ a(s, {
|
|
91
|
-
components: o,
|
|
92
|
-
remarkPlugins: [c],
|
|
93
|
-
children: e
|
|
94
|
-
})
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
export { g as Blockquote, p as CodeBlock, v as Footnote, h as Link, _ as Ol, m as Table, b as default };
|
|
1
|
+
import{isBoxCitation,isBoxDomain}from"../../utils/inlineCitationsUtils.js";import{t as markdown_module_default}from"../../../../chunks/markdown.module.js";import InlineCitation from"./inline-citation.js";import"react";import{Link as Link$1}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import ReactMarkdown from"react-markdown";import remarkGfm from"remark-gfm";var isFootnoteReference=href=>href?.startsWith(`#user-content-fn`)??!1,isInlineCitation=href=>href?isBoxCitation(href):!1,isExternalUrl=href=>href?href.startsWith(`http://`)||href.startsWith(`https://`):!1,isBoxDomainUrl=href=>href?isBoxDomain(href):!1,CodeBlock=({children,className})=>{let language=className?className.replace(`language-`,``):``;return jsxs(`div`,{className:markdown_module_default.hljs,children:[jsx(`span`,{className:markdown_module_default.hljsLanguage,children:language||`auto`}),jsx(`code`,{children:(content=>content.trim().split(/\r?\n/).map((line,index)=>jsxs(`div`,{className:`hljs-line`,children:[jsx(`span`,{className:`hljs-line-number`,children:index+1}),jsx(`span`,{className:`hljs-line-content`,children:line})]},`line-${line.substring(0,20)}-${Date.now()}`)))(children)})]})},Table=({children})=>jsx(`div`,{className:markdown_module_default.tableWrapper,children:jsx(`table`,{children})}),Link=({children,href})=>!href||href===``?null:isBoxDomainUrl(href)?jsx(`a`,{href,rel:`noopener noreferrer`,target:`_blank`,children}):jsxs(`span`,{children:[children,` (`,href,`)`]}),Blockquote=({children})=>jsx(`blockquote`,{className:markdown_module_default.blockquote,children}),Ol=({children})=>jsx(`ol`,{className:markdown_module_default.orderedList,children}),Footnote=({children})=>{let footnoteNumber=children?.toString().match(/^(\d+)/)?.[1]||children;return jsx(`span`,{className:markdown_module_default.footnote,children:footnoteNumber})},components={code:CodeBlock,table:Table,blockquote:Blockquote,ol:Ol,sup:Footnote,p:({children})=>jsx(`div`,{className:markdown_module_default.inlineParagraph,children}),a:Link},MarkdownRenderer=({children,isInlineCitationV2Enabled=!1})=>{let customComponents={...components,a:props=>{let{href,children:linkChildren}=props;if(isFootnoteReference(href)){let footnoteNumber=linkChildren?.toString().match(/^(\d+)/)?.[1]||linkChildren;return jsx(Link$1,{href,children:jsx(`span`,{className:markdown_module_default.footnoteReference,children:footnoteNumber})})}return isInlineCitation(href)?jsx(InlineCitation,{fileName:linkChildren?.toString()||``,href,isInlineCitationV2Enabled}):(isExternalUrl(href),jsx(Link,{href,children:linkChildren}))}};return jsx(`div`,{className:markdown_module_default.markdownContent,children:jsx(ReactMarkdown,{components:customComponents,remarkPlugins:[remarkGfm],children})})};export{Blockquote,CodeBlock,Footnote,Link,Ol,Table,MarkdownRenderer as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as markdownToHtmlString };
|
|
1
|
+
import{t as markdownToHtmlString}from"../../../../chunks/markdown.js";export{markdownToHtmlString};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { t as MediaContainer, t as default, e as MediaContainerBase };
|
|
1
|
+
import{n as MediaContainerBase,t as MediaContainer}from"../../../../chunks/media-container.js";export{MediaContainer,MediaContainer as default,MediaContainerBase};
|
|
@@ -1,305 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { agentList as n, agentState as r } from "../api-wrapper/constants.js";
|
|
3
|
-
import "react";
|
|
4
|
-
import "react/jsx-runtime";
|
|
5
|
-
var i = [
|
|
6
|
-
{
|
|
7
|
-
location: "location1",
|
|
8
|
-
fileId: "123",
|
|
9
|
-
content: "In the heart of the bustling city, amidst the cacophony of car horns and distant chatter, lies a hidden oasis of tranquility. This serene sanctuary, with its lush greenery and gentle trickling streams, offers a reprieve from the relentless pace of urban life. Here, amidst the whispering leaves and the soft rustle of wildlife, one can find solace and renewal."
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
location: "location2",
|
|
13
|
-
fileId: "456",
|
|
14
|
-
content: "High above the world, where the air is thin and the sky stretches endlessly, a lone eagle soars. With wings outstretched, it rides the currents of wind, a majestic silhouette against the backdrop of clouds. From this lofty vantage point, the world below seems small and insignificant, its troubles and worries mere specks in the grand tapestry of existence."
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
location: "location3",
|
|
18
|
-
fileId: "789",
|
|
19
|
-
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst."
|
|
20
|
-
}
|
|
21
|
-
];
|
|
22
|
-
e.HUBS_METADATA;
|
|
23
|
-
var a = [
|
|
24
|
-
{
|
|
25
|
-
answer: "I am a mock answer",
|
|
26
|
-
id: "1",
|
|
27
|
-
isCompleted: !0,
|
|
28
|
-
isLoading: !1,
|
|
29
|
-
error: null,
|
|
30
|
-
prompt: "Can you summarize this?",
|
|
31
|
-
citations: i
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
answer: "",
|
|
35
|
-
id: "2",
|
|
36
|
-
isCompleted: !0,
|
|
37
|
-
isLoading: !0,
|
|
38
|
-
error: null,
|
|
39
|
-
prompt: "Can you provide an answer for this?"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
answer: "Paris",
|
|
43
|
-
id: "3",
|
|
44
|
-
isCompleted: !0,
|
|
45
|
-
isLoading: !1,
|
|
46
|
-
error: t.GENERAL,
|
|
47
|
-
prompt: "What is the capital of France?"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
answer: "4",
|
|
51
|
-
id: "4",
|
|
52
|
-
isCompleted: !0,
|
|
53
|
-
isLoading: !1,
|
|
54
|
-
error: t.RATE_LIMITING,
|
|
55
|
-
prompt: "What is the square root of 16?"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
answer: "Harper Lee",
|
|
59
|
-
id: "5",
|
|
60
|
-
isCompleted: !0,
|
|
61
|
-
isLoading: !1,
|
|
62
|
-
error: t.RESPONSE_FAILED,
|
|
63
|
-
prompt: "Who is the author of \"To Kill a Mockingbird\"?"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
answer: "Tokyo",
|
|
67
|
-
id: "6",
|
|
68
|
-
isCompleted: !0,
|
|
69
|
-
isLoading: !1,
|
|
70
|
-
error: t.RESPONSE_INTERRUPTED,
|
|
71
|
-
prompt: "What is the capital of Japan?"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
answer: "Jupiter",
|
|
75
|
-
id: "7",
|
|
76
|
-
isCompleted: !0,
|
|
77
|
-
isLoading: !1,
|
|
78
|
-
error: t.RESPONSE_STOPPED,
|
|
79
|
-
prompt: "What is the largest planet in our solar system?"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
answer: "Washing",
|
|
83
|
-
id: "8",
|
|
84
|
-
isCompleted: !1,
|
|
85
|
-
isLoading: !1,
|
|
86
|
-
error: null,
|
|
87
|
-
prompt: "What is the capital of the United States?"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
answer: "9",
|
|
91
|
-
id: "9",
|
|
92
|
-
isCompleted: !0,
|
|
93
|
-
isLoading: !1,
|
|
94
|
-
error: t.NO_CONTENT,
|
|
95
|
-
prompt: "What is the capital of Italy?"
|
|
96
|
-
}
|
|
97
|
-
], o = [{
|
|
98
|
-
answer: "Washington, D.C.",
|
|
99
|
-
id: "0",
|
|
100
|
-
isCompleted: !0,
|
|
101
|
-
isLoading: !1,
|
|
102
|
-
error: null,
|
|
103
|
-
prompt: "What is the capital of United States?"
|
|
104
|
-
}, {
|
|
105
|
-
answer: "Warsaw",
|
|
106
|
-
id: "1",
|
|
107
|
-
isCompleted: !0,
|
|
108
|
-
isLoading: !1,
|
|
109
|
-
error: null,
|
|
110
|
-
prompt: "What is the capital of Poland?"
|
|
111
|
-
}], s = n, c = r, l = [
|
|
112
|
-
{
|
|
113
|
-
type: "file",
|
|
114
|
-
name: "Document.docx",
|
|
115
|
-
status: "supported",
|
|
116
|
-
fileType: "word-document",
|
|
117
|
-
id: "0"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
type: "file",
|
|
121
|
-
name: "Spreadsheet.xlsx",
|
|
122
|
-
status: "supported",
|
|
123
|
-
fileType: "spreadsheet",
|
|
124
|
-
id: "1"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type: "file",
|
|
128
|
-
name: "Presentation.pptx",
|
|
129
|
-
status: "supported",
|
|
130
|
-
fileType: "powerpoint-presentation",
|
|
131
|
-
id: "2"
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: "file",
|
|
135
|
-
name: "PDFFile.pdf",
|
|
136
|
-
status: "supported",
|
|
137
|
-
fileType: "pdf",
|
|
138
|
-
id: "3"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
type: "file",
|
|
142
|
-
name: "Image.jpg",
|
|
143
|
-
status: "unsupported",
|
|
144
|
-
fileType: "image",
|
|
145
|
-
id: "4"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
type: "file",
|
|
149
|
-
name: "Video.mp4",
|
|
150
|
-
status: "unsupported",
|
|
151
|
-
fileType: "video",
|
|
152
|
-
id: "5"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: "file",
|
|
156
|
-
name: "Audio.mp3",
|
|
157
|
-
status: "no_permission",
|
|
158
|
-
fileType: "audio",
|
|
159
|
-
id: "6"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
type: "file",
|
|
163
|
-
name: "Code.js",
|
|
164
|
-
status: "supported",
|
|
165
|
-
fileType: "code",
|
|
166
|
-
id: "7"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
type: "file",
|
|
170
|
-
name: "Archive.zip",
|
|
171
|
-
status: "supported",
|
|
172
|
-
fileType: "archive",
|
|
173
|
-
id: "8"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
type: "file",
|
|
177
|
-
name: "Note.boxnote",
|
|
178
|
-
status: "supported",
|
|
179
|
-
fileType: "boxnote",
|
|
180
|
-
id: "9"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: "file",
|
|
184
|
-
name: "Note.boxnote",
|
|
185
|
-
status: "no_permission",
|
|
186
|
-
id: "10"
|
|
187
|
-
}
|
|
188
|
-
], u = l[1], d = [
|
|
189
|
-
{
|
|
190
|
-
status: "supported",
|
|
191
|
-
fileType: "word-document"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
status: "supported",
|
|
195
|
-
fileType: "spreadsheet"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
status: "supported",
|
|
199
|
-
fileType: "powerpoint-presentation"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
status: "supported",
|
|
203
|
-
fileType: "pdf"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
status: "unsupported",
|
|
207
|
-
fileType: "image"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
status: "unsupported",
|
|
211
|
-
fileType: "video"
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
status: "no_permission",
|
|
215
|
-
fileType: "audio"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
status: "supported",
|
|
219
|
-
fileType: "code"
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
status: "supported",
|
|
223
|
-
fileType: "archive"
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
status: "supported",
|
|
227
|
-
fileType: "boxnote"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
status: "no_permission",
|
|
231
|
-
fileType: void 0
|
|
232
|
-
}
|
|
233
|
-
], f = [
|
|
234
|
-
{
|
|
235
|
-
type: "file",
|
|
236
|
-
name: "This_is_a_very_long_file_name_that_tests_the_boundary_conditions_for_file_names.docx",
|
|
237
|
-
status: "supported",
|
|
238
|
-
fileType: "word-document",
|
|
239
|
-
id: "0"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
type: "file",
|
|
243
|
-
name: "Another_extremely_long_file_name_that_could_exist_in_the_real_world_but_is_unlikely.pdf",
|
|
244
|
-
status: "supported",
|
|
245
|
-
fileType: "pdf",
|
|
246
|
-
id: "1"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
type: "file",
|
|
250
|
-
name: "Presentation_with_a_very_descriptive_and_lengthy_title_about_its_content.pptx",
|
|
251
|
-
status: "supported",
|
|
252
|
-
fileType: "powerpoint-presentation",
|
|
253
|
-
id: "2"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
type: "file",
|
|
257
|
-
name: "Spreadsheet_with_detailed_information_about_company_finances_and_other_details.xlsx",
|
|
258
|
-
status: "supported",
|
|
259
|
-
fileType: "spreadsheet",
|
|
260
|
-
id: "3"
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
type: "file",
|
|
264
|
-
name: "Image_with_a_very_long_description_of_what_the_image_is_about_and_its_context.jpg",
|
|
265
|
-
status: "unsupported",
|
|
266
|
-
fileType: "image",
|
|
267
|
-
id: "4"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
type: "file",
|
|
271
|
-
name: "Video_with_a_long_title_describing_its_contents_and_context_in_full.mp4",
|
|
272
|
-
status: "unsupported",
|
|
273
|
-
fileType: "video",
|
|
274
|
-
id: "5"
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
type: "file",
|
|
278
|
-
name: "Audio_file_with_a_detailed_and_verbose_description_of_its_contents_and_purpose.mp3",
|
|
279
|
-
status: "unsupported",
|
|
280
|
-
fileType: "audio",
|
|
281
|
-
id: "6"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
type: "file",
|
|
285
|
-
name: "Document_with_restricted_access_and_a_long_title_describing_its_sensitivity.docx",
|
|
286
|
-
status: "no_permission",
|
|
287
|
-
fileType: "word-document",
|
|
288
|
-
id: "7"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
type: "file",
|
|
292
|
-
name: "PDF_with_restricted_access_and_a_long_title_about_its_contents_and_privacy.pdf",
|
|
293
|
-
status: "no_permission",
|
|
294
|
-
fileType: "pdf",
|
|
295
|
-
id: "8"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
type: "file",
|
|
299
|
-
name: "Image_with_a_restricted_access_and_a_lengthy_name_describing_its_context.jpg",
|
|
300
|
-
status: "no_permission",
|
|
301
|
-
fileType: "image",
|
|
302
|
-
id: "9"
|
|
303
|
-
}
|
|
304
|
-
];
|
|
305
|
-
export { c as mockAgentState, s as mockAgents, o as mockConversation, l as mockItemsAllTypes, f as mockItemsWithLongNames, d as mockLogAllTypes, a as mockQuestions, u as spreadsheetItem };
|
|
1
|
+
import{n as CITATION_SOURCE,t as ANSWER_ERROR}from"../../../../chunks/types.js";import{agentList,agentState}from"../api-wrapper/constants.js";import"react";import"react/jsx-runtime";var citations=[{location:`location1`,fileId:`123`,content:`In the heart of the bustling city, amidst the cacophony of car horns and distant chatter, lies a hidden oasis of tranquility. This serene sanctuary, with its lush greenery and gentle trickling streams, offers a reprieve from the relentless pace of urban life. Here, amidst the whispering leaves and the soft rustle of wildlife, one can find solace and renewal.`},{location:`location2`,fileId:`456`,content:`High above the world, where the air is thin and the sky stretches endlessly, a lone eagle soars. With wings outstretched, it rides the currents of wind, a majestic silhouette against the backdrop of clouds. From this lofty vantage point, the world below seems small and insignificant, its troubles and worries mere specks in the grand tapestry of existence.`},{location:`location3`,fileId:`789`,content:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.`}];CITATION_SOURCE.HUBS_METADATA;var mockQuestions=[{answer:`I am a mock answer`,id:`1`,isCompleted:!0,isLoading:!1,error:null,prompt:`Can you summarize this?`,citations},{answer:``,id:`2`,isCompleted:!0,isLoading:!0,error:null,prompt:`Can you provide an answer for this?`},{answer:`Paris`,id:`3`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.GENERAL,prompt:`What is the capital of France?`},{answer:`4`,id:`4`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.RATE_LIMITING,prompt:`What is the square root of 16?`},{answer:`Harper Lee`,id:`5`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.RESPONSE_FAILED,prompt:`Who is the author of "To Kill a Mockingbird"?`},{answer:`Tokyo`,id:`6`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.RESPONSE_INTERRUPTED,prompt:`What is the capital of Japan?`},{answer:`Jupiter`,id:`7`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.RESPONSE_STOPPED,prompt:`What is the largest planet in our solar system?`},{answer:`Washing`,id:`8`,isCompleted:!1,isLoading:!1,error:null,prompt:`What is the capital of the United States?`},{answer:`9`,id:`9`,isCompleted:!0,isLoading:!1,error:ANSWER_ERROR.NO_CONTENT,prompt:`What is the capital of Italy?`}],mockConversation=[{answer:`Washington, D.C.`,id:`0`,isCompleted:!0,isLoading:!1,error:null,prompt:`What is the capital of United States?`},{answer:`Warsaw`,id:`1`,isCompleted:!0,isLoading:!1,error:null,prompt:`What is the capital of Poland?`}],mockAgents=agentList,mockAgentState=agentState,mockItemsAllTypes=[{type:`file`,name:`Document.docx`,status:`supported`,fileType:`word-document`,id:`0`},{type:`file`,name:`Spreadsheet.xlsx`,status:`supported`,fileType:`spreadsheet`,id:`1`},{type:`file`,name:`Presentation.pptx`,status:`supported`,fileType:`powerpoint-presentation`,id:`2`},{type:`file`,name:`PDFFile.pdf`,status:`supported`,fileType:`pdf`,id:`3`},{type:`file`,name:`Image.jpg`,status:`unsupported`,fileType:`image`,id:`4`},{type:`file`,name:`Video.mp4`,status:`unsupported`,fileType:`video`,id:`5`},{type:`file`,name:`Audio.mp3`,status:`no_permission`,fileType:`audio`,id:`6`},{type:`file`,name:`Code.js`,status:`supported`,fileType:`code`,id:`7`},{type:`file`,name:`Archive.zip`,status:`supported`,fileType:`archive`,id:`8`},{type:`file`,name:`Note.boxnote`,status:`supported`,fileType:`boxnote`,id:`9`},{type:`file`,name:`Note.boxnote`,status:`no_permission`,id:`10`}],spreadsheetItem=mockItemsAllTypes[1],mockLogAllTypes=[{status:`supported`,fileType:`word-document`},{status:`supported`,fileType:`spreadsheet`},{status:`supported`,fileType:`powerpoint-presentation`},{status:`supported`,fileType:`pdf`},{status:`unsupported`,fileType:`image`},{status:`unsupported`,fileType:`video`},{status:`no_permission`,fileType:`audio`},{status:`supported`,fileType:`code`},{status:`supported`,fileType:`archive`},{status:`supported`,fileType:`boxnote`},{status:`no_permission`,fileType:void 0}],mockItemsWithLongNames=[{type:`file`,name:`This_is_a_very_long_file_name_that_tests_the_boundary_conditions_for_file_names.docx`,status:`supported`,fileType:`word-document`,id:`0`},{type:`file`,name:`Another_extremely_long_file_name_that_could_exist_in_the_real_world_but_is_unlikely.pdf`,status:`supported`,fileType:`pdf`,id:`1`},{type:`file`,name:`Presentation_with_a_very_descriptive_and_lengthy_title_about_its_content.pptx`,status:`supported`,fileType:`powerpoint-presentation`,id:`2`},{type:`file`,name:`Spreadsheet_with_detailed_information_about_company_finances_and_other_details.xlsx`,status:`supported`,fileType:`spreadsheet`,id:`3`},{type:`file`,name:`Image_with_a_very_long_description_of_what_the_image_is_about_and_its_context.jpg`,status:`unsupported`,fileType:`image`,id:`4`},{type:`file`,name:`Video_with_a_long_title_describing_its_contents_and_context_in_full.mp4`,status:`unsupported`,fileType:`video`,id:`5`},{type:`file`,name:`Audio_file_with_a_detailed_and_verbose_description_of_its_contents_and_purpose.mp3`,status:`unsupported`,fileType:`audio`,id:`6`},{type:`file`,name:`Document_with_restricted_access_and_a_long_title_describing_its_sensitivity.docx`,status:`no_permission`,fileType:`word-document`,id:`7`},{type:`file`,name:`PDF_with_restricted_access_and_a_long_title_about_its_contents_and_privacy.pdf`,status:`no_permission`,fileType:`pdf`,id:`8`},{type:`file`,name:`Image_with_a_restricted_access_and_a_lengthy_name_describing_its_context.jpg`,status:`no_permission`,fileType:`image`,id:`9`}];export{mockAgentState,mockAgents,mockConversation,mockItemsAllTypes,mockItemsWithLongNames,mockLogAllTypes,mockQuestions,spreadsheetItem};
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
var t = typeof e(window, "performance.mark") == "function", n = (e) => t && window.performance.mark(e);
|
|
3
|
-
export { t as isMarkSupported, n as mark };
|
|
1
|
+
import getProp from"lodash/get";var isMarkSupported=typeof getProp(window,`performance.mark`)==`function`,mark=markName=>isMarkSupported&&window.performance.mark(markName);export{isMarkSupported,mark};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as Content, e as default };
|
|
1
|
+
import{t as Content}from"../../../../chunks/content.js";export{Content,Content as default};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as Content };
|
|
1
|
+
import{t as Content}from"../../../../chunks/content.js";export{Content};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
ENTER: 13,
|
|
3
|
-
X: 88,
|
|
4
|
-
X_LOWERCASE: 120
|
|
5
|
-
}, t = {
|
|
6
|
-
DEBUG_MAX_ROWS: 25,
|
|
7
|
-
MAX_ROWS: 4,
|
|
8
|
-
MAX_ROWS_MOBILE: 10,
|
|
9
|
-
MAX_LENGTH: 1e3,
|
|
10
|
-
MIN_ROWS: 1
|
|
11
|
-
}, n = "TextArea-contentAnswersQuestionInput";
|
|
12
|
-
export { n as INPUT_TARGET_ID, e as KEY_CODE, t as TEXT_AREA };
|
|
1
|
+
var KEY_CODE={ENTER:13,X:88,X_LOWERCASE:120},TEXT_AREA={DEBUG_MAX_ROWS:25,MAX_ROWS:4,MAX_ROWS_MOBILE:10,MAX_LENGTH:1e3,MIN_ROWS:1},INPUT_TARGET_ID=`TextArea-contentAnswersQuestionInput`;export{INPUT_TARGET_ID,KEY_CODE,TEXT_AREA};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as FooterActions };
|
|
1
|
+
import{t as FooterActions}from"../../../../chunks/footer-actions.js";export{FooterActions};
|
|
@@ -1,151 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LOGGER_ACTION_CLICK as t, LOGGER_ACTION_KEYPRESS as ee, LOGGER_BASE_CONFIG as n } from "../common/constants.js";
|
|
3
|
-
import { INPUT_TARGET_ID as r, TEXT_AREA as i } from "./constants.js";
|
|
4
|
-
import { getAIAgentConfig as a } from "../common/agentUtils.js";
|
|
5
|
-
import { isDebugModeTrigger as o, isEnterTrigger as te } from "../common/keyInputUtils.js";
|
|
6
|
-
import s from "./messages.js";
|
|
7
|
-
import { t as c } from "../../../../chunks/footer-actions.js";
|
|
8
|
-
import { n as l, t as u } from "../../../../chunks/stopResponseButton.js";
|
|
9
|
-
import d from "clsx";
|
|
10
|
-
import * as f from "react";
|
|
11
|
-
import { Breakpoint as ne, Button as p, FilterChip as m, TextArea as h, Tooltip as g, useBreakpoint as _ } from "@box/blueprint-web";
|
|
12
|
-
import { useIntl as v } from "react-intl";
|
|
13
|
-
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
14
|
-
import { BubbleStar as re } from "@box/blueprint-web-assets/icons/Medium";
|
|
15
|
-
import { ArrowUp as ie } from "@box/blueprint-web-assets/icons/Fill";
|
|
16
|
-
import { useAgents as ae } from "@box/box-ai-agent-selector";
|
|
17
|
-
import oe from "lodash/noop";
|
|
18
|
-
var x = ({ askSuggestedQuestion: x, enableDebugMode: S = !1, hasRequestInProgress: C, isAIStudioAgentSelectorEnabled: w, isDebugModeShown: T, isStopResponseEnabled: E, isStreamingEnabled: D, lastQuestion: O, onRetryQuestion: k, onStopQuestion: se, onUserInteraction: A = oe, promptValue: j, recordAction: M, sendQuestion: N, setAskSuggestedQuestion: P, setPromptValue: F, toggleDebugMode: I, promptButtonClickHandler: L, variant: R = "modal" }) => {
|
|
19
|
-
let z = R === "sidebar", B = v(), V = _(), H = f.useRef(null), U = V <= ne.Medium && !z ? i.MAX_ROWS_MOBILE : i.MAX_ROWS, [W, G] = f.useState(!0), [ce, K] = f.useState(!1), { selectedAgent: q } = ae(), { answer: le, isCompleted: ue } = O ?? {}, de = D && ue === !1 && (E || le), J = f.useCallback(() => {
|
|
20
|
-
H.current && H.current.focus();
|
|
21
|
-
}, [H]), Y = f.useCallback(() => {
|
|
22
|
-
A();
|
|
23
|
-
let e = H.current?.value ?? "";
|
|
24
|
-
H.current && e.length > i.MAX_LENGTH && (H.current.value = e.slice(0, i.MAX_LENGTH), e = H.current.value), F && F(e), K(e.length >= i.MAX_LENGTH), G(e.trim().length === 0);
|
|
25
|
-
}, [A, F]), X = f.useCallback((t = e) => {
|
|
26
|
-
if (J(), !C && H.current) {
|
|
27
|
-
let e = {
|
|
28
|
-
prompt: H.current.value,
|
|
29
|
-
promptType: t
|
|
30
|
-
};
|
|
31
|
-
e.prompt && e.prompt.trim() && (N(e, a(w, q)), H.current.value = "", F && F(""), G(!0), K(!1)), T && I && I();
|
|
32
|
-
}
|
|
33
|
-
}, [
|
|
34
|
-
q,
|
|
35
|
-
J,
|
|
36
|
-
C,
|
|
37
|
-
w,
|
|
38
|
-
T,
|
|
39
|
-
N,
|
|
40
|
-
F,
|
|
41
|
-
I
|
|
42
|
-
]), fe = f.useCallback((e) => {
|
|
43
|
-
e.preventDefault(), !C && !W && M && M({
|
|
44
|
-
...n,
|
|
45
|
-
action: t,
|
|
46
|
-
target: "ask"
|
|
47
|
-
}), X();
|
|
48
|
-
}, [
|
|
49
|
-
C,
|
|
50
|
-
W,
|
|
51
|
-
M,
|
|
52
|
-
X
|
|
53
|
-
]), Z = f.useCallback((e) => {
|
|
54
|
-
S && I && o(e) && I(), te(e) && (e.preventDefault(), !C && !W && M && M({
|
|
55
|
-
...n,
|
|
56
|
-
action: ee,
|
|
57
|
-
target: "ask"
|
|
58
|
-
}), X());
|
|
59
|
-
}, [
|
|
60
|
-
S,
|
|
61
|
-
C,
|
|
62
|
-
W,
|
|
63
|
-
M,
|
|
64
|
-
X,
|
|
65
|
-
I
|
|
66
|
-
]), pe = f.useCallback((e) => {
|
|
67
|
-
k(e, a(w, q));
|
|
68
|
-
}, [
|
|
69
|
-
q,
|
|
70
|
-
w,
|
|
71
|
-
k
|
|
72
|
-
]);
|
|
73
|
-
f.useEffect(() => {
|
|
74
|
-
queueMicrotask(J);
|
|
75
|
-
}, []), f.useEffect(() => {
|
|
76
|
-
H.current && j !== void 0 && H.current.value !== j && (H.current.value = j, G(j.trim().length === 0), K(j.length >= i.MAX_LENGTH));
|
|
77
|
-
}, [j]), f.useEffect(() => {
|
|
78
|
-
if (x && H.current && !C && P) {
|
|
79
|
-
let { prompt: e, type: t } = x;
|
|
80
|
-
H.current.value = e, F && F(e), X(t), P(null);
|
|
81
|
-
}
|
|
82
|
-
}, [x?.id]);
|
|
83
|
-
let me = f.useCallback((e) => {
|
|
84
|
-
H.current && (H.current.value = e, Y(), J());
|
|
85
|
-
}, [Y, J]), Q = !!L, he = () => /* @__PURE__ */ y(m.Group, {
|
|
86
|
-
name: "prompt-library",
|
|
87
|
-
type: "single",
|
|
88
|
-
children: /* @__PURE__ */ b(m.ChipButton, {
|
|
89
|
-
"aria-label": B.formatMessage(s.openPromptLibraryBtn),
|
|
90
|
-
className: l.promptButton,
|
|
91
|
-
"data-target-id": "open-prompt-library-button",
|
|
92
|
-
"data-testid": "open-prompt-library-button",
|
|
93
|
-
onClick: () => {
|
|
94
|
-
L(me);
|
|
95
|
-
},
|
|
96
|
-
value: "add-prompt",
|
|
97
|
-
children: [/* @__PURE__ */ y(m.Icon, { icon: re }), /* @__PURE__ */ y(m.Label, { children: B.formatMessage(s.promptsBtn) })]
|
|
98
|
-
})
|
|
99
|
-
}), $ = (e) => de ? /* @__PURE__ */ y(u, {
|
|
100
|
-
lastQuestion: O,
|
|
101
|
-
onStopQuestion: se,
|
|
102
|
-
recordAction: M,
|
|
103
|
-
size: e
|
|
104
|
-
}) : /* @__PURE__ */ y(g, {
|
|
105
|
-
content: B.formatMessage(s.ask),
|
|
106
|
-
"data-testid": "ask-tooltip",
|
|
107
|
-
variant: "standard",
|
|
108
|
-
children: /* @__PURE__ */ y(p, {
|
|
109
|
-
"aria-label": B.formatMessage(s.ask),
|
|
110
|
-
className: l.inputAreaButton,
|
|
111
|
-
"data-testid": "content-answers-submit-button",
|
|
112
|
-
disabled: W || C,
|
|
113
|
-
endIcon: ie,
|
|
114
|
-
loading: !1,
|
|
115
|
-
loadingAriaLabel: B.formatMessage(s.askDisabledTooltip),
|
|
116
|
-
onClick: fe,
|
|
117
|
-
size: e,
|
|
118
|
-
"data-target-id": "Button-ask"
|
|
119
|
-
})
|
|
120
|
-
});
|
|
121
|
-
return /* @__PURE__ */ b("div", { children: [O && /* @__PURE__ */ y(c, {
|
|
122
|
-
lastQuestion: O,
|
|
123
|
-
onRetryButtonInteraction: A,
|
|
124
|
-
onRetryQuestion: pe,
|
|
125
|
-
recordAction: M
|
|
126
|
-
}), /* @__PURE__ */ b("div", {
|
|
127
|
-
className: d(l.questionInput, z && l.sidebar, !Q && l.questionInputWithOutPromptLibrary),
|
|
128
|
-
children: [
|
|
129
|
-
/* @__PURE__ */ y(h, {
|
|
130
|
-
ref: H,
|
|
131
|
-
className: l.textArea,
|
|
132
|
-
"data-target-id": r,
|
|
133
|
-
"data-testid": "content-answers-question-input",
|
|
134
|
-
error: ce && B.formatMessage(s.maxCharactersReachedError, { characterLimit: i.MAX_LENGTH }),
|
|
135
|
-
hideLabel: !0,
|
|
136
|
-
label: B.formatMessage(s.askQuestionPlaceholder),
|
|
137
|
-
maxLength: i.MAX_LENGTH,
|
|
138
|
-
maxRows: U,
|
|
139
|
-
onChange: Y,
|
|
140
|
-
onKeyDown: Z,
|
|
141
|
-
placeholder: B.formatMessage(s.askQuestionPlaceholder)
|
|
142
|
-
}),
|
|
143
|
-
Q && /* @__PURE__ */ b("div", {
|
|
144
|
-
className: l.actionContainer,
|
|
145
|
-
children: [he(), $("small")]
|
|
146
|
-
}),
|
|
147
|
-
!Q && $("large")
|
|
148
|
-
]
|
|
149
|
-
})] });
|
|
150
|
-
};
|
|
151
|
-
export { x as Footer };
|
|
1
|
+
import{s as USER_INPUT_PROMPT_TYPE}from"../../../../chunks/types.js";import{LOGGER_ACTION_CLICK,LOGGER_ACTION_KEYPRESS,LOGGER_BASE_CONFIG}from"../common/constants.js";import{INPUT_TARGET_ID,TEXT_AREA}from"./constants.js";import{getAIAgentConfig}from"../common/agentUtils.js";import{isDebugModeTrigger,isEnterTrigger}from"../common/keyInputUtils.js";import messages from"./messages.js";import{t as FooterActions}from"../../../../chunks/footer-actions.js";import{n as footer_module_default,t as StopResponseButton}from"../../../../chunks/stopResponseButton.js";import clsx from"clsx";import*as React$1 from"react";import{Breakpoint,Button,FilterChip,TextArea,Tooltip,useBreakpoint}from"@box/blueprint-web";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import{BubbleStar}from"@box/blueprint-web-assets/icons/Medium";import{ArrowUp}from"@box/blueprint-web-assets/icons/Fill";import{useAgents}from"@box/box-ai-agent-selector";import noop from"lodash/noop";var Footer=({askSuggestedQuestion,enableDebugMode=!1,hasRequestInProgress,isAIStudioAgentSelectorEnabled,isDebugModeShown,isStopResponseEnabled,isStreamingEnabled,lastQuestion,onRetryQuestion,onStopQuestion,onUserInteraction=noop,promptValue,recordAction,sendQuestion,setAskSuggestedQuestion,setPromptValue,toggleDebugMode,promptButtonClickHandler,variant=`modal`})=>{let hasSidebarVariant=variant===`sidebar`,intl=useIntl(),breakpointProvider=useBreakpoint(),inputRef=React$1.useRef(null),maxInputRows=breakpointProvider<=Breakpoint.Medium&&!hasSidebarVariant?TEXT_AREA.MAX_ROWS_MOBILE:TEXT_AREA.MAX_ROWS,[isSubmitDisabled,setIsSubmitDisabled]=React$1.useState(!0),[hasMaxCharacterError,setHasMaxCharacterError]=React$1.useState(!1),{selectedAgent}=useAgents(),{answer,isCompleted}=lastQuestion??{},shouldShowStopButton=isStreamingEnabled&&isCompleted===!1&&(isStopResponseEnabled||answer),focusOnInput=React$1.useCallback(()=>{inputRef.current&&inputRef.current.focus()},[inputRef]),handleInputChange=React$1.useCallback(()=>{onUserInteraction();let text=inputRef.current?.value??``;inputRef.current&&text.length>TEXT_AREA.MAX_LENGTH&&(inputRef.current.value=text.slice(0,TEXT_AREA.MAX_LENGTH),text=inputRef.current.value),setPromptValue&&setPromptValue(text),setHasMaxCharacterError(text.length>=TEXT_AREA.MAX_LENGTH),setIsSubmitDisabled(text.trim().length===0)},[onUserInteraction,setPromptValue]),submitQuestion=React$1.useCallback((promptType=USER_INPUT_PROMPT_TYPE)=>{if(focusOnInput(),!hasRequestInProgress&&inputRef.current){let question={prompt:inputRef.current.value,promptType};question.prompt&&question.prompt.trim()&&(sendQuestion(question,getAIAgentConfig(isAIStudioAgentSelectorEnabled,selectedAgent)),inputRef.current.value=``,setPromptValue&&setPromptValue(``),setIsSubmitDisabled(!0),setHasMaxCharacterError(!1)),isDebugModeShown&&toggleDebugMode&&toggleDebugMode()}},[selectedAgent,focusOnInput,hasRequestInProgress,isAIStudioAgentSelectorEnabled,isDebugModeShown,sendQuestion,setPromptValue,toggleDebugMode]),handleSubmitQuestionOnClick=React$1.useCallback(event=>{event.preventDefault(),!hasRequestInProgress&&!isSubmitDisabled&&recordAction&&recordAction({...LOGGER_BASE_CONFIG,action:LOGGER_ACTION_CLICK,target:`ask`}),submitQuestion()},[hasRequestInProgress,isSubmitDisabled,recordAction,submitQuestion]),handleKeyDown=React$1.useCallback(event=>{enableDebugMode&&toggleDebugMode&&isDebugModeTrigger(event)&&toggleDebugMode(),isEnterTrigger(event)&&(event.preventDefault(),!hasRequestInProgress&&!isSubmitDisabled&&recordAction&&recordAction({...LOGGER_BASE_CONFIG,action:LOGGER_ACTION_KEYPRESS,target:`ask`}),submitQuestion())},[enableDebugMode,hasRequestInProgress,isSubmitDisabled,recordAction,submitQuestion,toggleDebugMode]),handleRetryQuestion=React$1.useCallback(question=>{onRetryQuestion(question,getAIAgentConfig(isAIStudioAgentSelectorEnabled,selectedAgent))},[selectedAgent,isAIStudioAgentSelectorEnabled,onRetryQuestion]);React$1.useEffect(()=>{queueMicrotask(focusOnInput)},[]),React$1.useEffect(()=>{inputRef.current&&promptValue!==void 0&&inputRef.current.value!==promptValue&&(inputRef.current.value=promptValue,setIsSubmitDisabled(promptValue.trim().length===0),setHasMaxCharacterError(promptValue.length>=TEXT_AREA.MAX_LENGTH))},[promptValue]),React$1.useEffect(()=>{if(askSuggestedQuestion&&inputRef.current&&!hasRequestInProgress&&setAskSuggestedQuestion){let{prompt,type}=askSuggestedQuestion;inputRef.current.value=prompt,setPromptValue&&setPromptValue(prompt),submitQuestion(type),setAskSuggestedQuestion(null)}},[askSuggestedQuestion?.id]);let handlePromptContentInsert=React$1.useCallback(content=>{inputRef.current&&(inputRef.current.value=content,handleInputChange(),focusOnInput())},[handleInputChange,focusOnInput]),isPromptLibraryEnabled=!!promptButtonClickHandler,renderPromptsButton=()=>jsx(FilterChip.Group,{name:`prompt-library`,type:`single`,children:jsxs(FilterChip.ChipButton,{"aria-label":intl.formatMessage(messages.openPromptLibraryBtn),className:footer_module_default.promptButton,"data-target-id":`open-prompt-library-button`,"data-testid":`open-prompt-library-button`,onClick:()=>{promptButtonClickHandler(handlePromptContentInsert)},value:`add-prompt`,children:[jsx(FilterChip.Icon,{icon:BubbleStar}),jsx(FilterChip.Label,{children:intl.formatMessage(messages.promptsBtn)})]})}),renderAskButton=size=>shouldShowStopButton?jsx(StopResponseButton,{lastQuestion,onStopQuestion,recordAction,size}):jsx(Tooltip,{content:intl.formatMessage(messages.ask),"data-testid":`ask-tooltip`,variant:`standard`,children:jsx(Button,{"aria-label":intl.formatMessage(messages.ask),className:footer_module_default.inputAreaButton,"data-testid":`content-answers-submit-button`,disabled:isSubmitDisabled||hasRequestInProgress,endIcon:ArrowUp,loading:!1,loadingAriaLabel:intl.formatMessage(messages.askDisabledTooltip),onClick:handleSubmitQuestionOnClick,size,"data-target-id":`Button-ask`})});return jsxs(`div`,{children:[lastQuestion&&jsx(FooterActions,{lastQuestion,onRetryButtonInteraction:onUserInteraction,onRetryQuestion:handleRetryQuestion,recordAction}),jsxs(`div`,{className:clsx(footer_module_default.questionInput,hasSidebarVariant&&footer_module_default.sidebar,!isPromptLibraryEnabled&&footer_module_default.questionInputWithOutPromptLibrary),children:[jsx(TextArea,{ref:inputRef,className:footer_module_default.textArea,"data-target-id":INPUT_TARGET_ID,"data-testid":`content-answers-question-input`,error:hasMaxCharacterError&&intl.formatMessage(messages.maxCharactersReachedError,{characterLimit:TEXT_AREA.MAX_LENGTH}),hideLabel:!0,label:intl.formatMessage(messages.askQuestionPlaceholder),maxLength:TEXT_AREA.MAX_LENGTH,maxRows:maxInputRows,onChange:handleInputChange,onKeyDown:handleKeyDown,placeholder:intl.formatMessage(messages.askQuestionPlaceholder)}),isPromptLibraryEnabled&&jsxs(`div`,{className:footer_module_default.actionContainer,children:[renderPromptsButton(),renderAskButton(`small`)]}),!isPromptLibraryEnabled&&renderAskButton(`large`)]})]})};export{Footer};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { e as Footer };
|
|
1
|
+
import{Footer}from"./footer.js";export{Footer};
|