@box/box-ai-content-answers 1.8.0 → 1.8.2
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/markdown.module.js +12 -15
- package/dist/esm/lib/box-ai-content-answers.js +50 -46
- package/dist/esm/lib/components/answer/answer-content.js +34 -23
- package/dist/esm/lib/components/answer/answer.js +95 -95
- package/dist/esm/lib/components/chat/chat.js +83 -81
- package/dist/esm/lib/components/common/inline-citation.js +27 -38
- package/dist/esm/lib/components/common/markdown-react.js +108 -93
- package/dist/esm/lib/utils/inlineCitationsUtils.js +20 -24
- package/dist/styles/markdown.css +1 -1
- package/dist/types/lib/box-ai-content-answers.d.ts +8 -0
- package/dist/types/lib/components/answer/answer-content.d.ts +13 -1
- package/dist/types/lib/components/answer/answer.d.ts +2 -0
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/components/common/inline-citation.d.ts +2 -0
- package/dist/types/lib/components/common/markdown-react.d.ts +2 -1
- package/dist/types/lib/types.d.ts +2 -0
- package/dist/types/lib/utils/inlineCitationsUtils.d.ts +9 -2
- package/package.json +4 -4
|
@@ -2,11 +2,23 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { StyleVariant } from '../../types';
|
|
3
3
|
export interface AnswerContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
answer?: string;
|
|
5
|
+
/** Array of items for inline citation processing */
|
|
6
|
+
items?: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
}>;
|
|
11
|
+
/** Whether the answer generation is completed */
|
|
12
|
+
isCompleted?: boolean;
|
|
5
13
|
/** Whether to render the answer with markdown */
|
|
6
14
|
isMarkdownEnabled?: boolean;
|
|
7
15
|
/** Whether to use the new React-based markdown renderer instead of the legacy one */
|
|
8
16
|
isReactMarkdownEnabled?: boolean;
|
|
17
|
+
/** Whether to use the V2 inline citation component (stylized hyperlink) instead of plain hyperlink */
|
|
18
|
+
isInlineCitationV2Enabled?: boolean;
|
|
19
|
+
/** Whether to show inline citations or not */
|
|
20
|
+
isInlineCitationsEnabled?: boolean;
|
|
9
21
|
variant?: StyleVariant;
|
|
10
22
|
}
|
|
11
|
-
export declare const AnswerContent: ({ answer, isMarkdownEnabled, isReactMarkdownEnabled, className, variant, ...rest }: AnswerContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const AnswerContent: ({ answer, items, isCompleted, isInlineCitationV2Enabled, isInlineCitationsEnabled, isMarkdownEnabled, isReactMarkdownEnabled, className, variant, ...rest }: AnswerContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
24
|
export default AnswerContent;
|
|
@@ -23,6 +23,8 @@ export interface AnswerProps {
|
|
|
23
23
|
isFeedbackTooltipOpen?: boolean;
|
|
24
24
|
/** Whether to show inline citations or not */
|
|
25
25
|
isInlineCitationsEnabled?: boolean;
|
|
26
|
+
/** Whether to use the V2 inline citation component (stylized hyperlink) instead of plain hyperlink */
|
|
27
|
+
isInlineCitationV2Enabled?: boolean;
|
|
26
28
|
/** Whether to show the loading state or not if the answer is empty */
|
|
27
29
|
isLoading?: boolean;
|
|
28
30
|
/** Whether the answer supports markdown */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChatProps } from '../../types';
|
|
2
|
-
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isInlineCitationsEnabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, embedTheAnswerButtonConfig, onFeedbackFormSubmit, onDropdownOpenChange, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldFeedbackFormIncludeFeedbackText, shouldFeedbackIncludePromptData, shouldShowLandingPage, useAnimation, variant, hostAppName, isReactMarkdownEnabled, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isInlineCitationsEnabled, isInlineCitationV2Enabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, embedTheAnswerButtonConfig, onFeedbackFormSubmit, onDropdownOpenChange, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldFeedbackFormIncludeFeedbackText, shouldFeedbackIncludePromptData, shouldShowLandingPage, useAnimation, variant, hostAppName, isReactMarkdownEnabled, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Chat;
|
|
@@ -2,6 +2,8 @@ import { default as React } from 'react';
|
|
|
2
2
|
interface InlineCitationProps {
|
|
3
3
|
fileName: string;
|
|
4
4
|
href: string;
|
|
5
|
+
/** Whether to use the V2 inline citation component (stylized hyperlink) instead of simple hyperlink */
|
|
6
|
+
isInlineCitationV2Enabled?: boolean;
|
|
5
7
|
}
|
|
6
8
|
declare const InlineCitation: React.FC<InlineCitationProps>;
|
|
7
9
|
export default InlineCitation;
|
|
@@ -7,8 +7,8 @@ declare const Table: React.FC<{
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}>;
|
|
9
9
|
declare const Link: React.FC<{
|
|
10
|
-
href?: string;
|
|
11
10
|
children: React.ReactNode;
|
|
11
|
+
href?: string;
|
|
12
12
|
}>;
|
|
13
13
|
declare const Blockquote: React.FC<{
|
|
14
14
|
children: React.ReactNode;
|
|
@@ -21,6 +21,7 @@ declare const Footnote: React.FC<{
|
|
|
21
21
|
}>;
|
|
22
22
|
declare const MarkdownRenderer: React.FC<{
|
|
23
23
|
children: string;
|
|
24
|
+
isInlineCitationV2Enabled?: boolean;
|
|
24
25
|
}>;
|
|
25
26
|
export default MarkdownRenderer;
|
|
26
27
|
export { Blockquote, CodeBlock, Footnote, Link, Ol, Table };
|
|
@@ -86,6 +86,8 @@ export type ChatProps = WelcomeMessageProps & {
|
|
|
86
86
|
isFeedbackFormEnabled?: boolean;
|
|
87
87
|
/** Whether to show inline citations or not */
|
|
88
88
|
isInlineCitationsEnabled?: boolean;
|
|
89
|
+
/** Whether to use the V2 inline citation component (stylized hyperlink) instead of plain hyperlink */
|
|
90
|
+
isInlineCitationV2Enabled?: boolean;
|
|
89
91
|
/** Whether if the answers supports markdown or not */
|
|
90
92
|
isMarkdownEnabled?: boolean;
|
|
91
93
|
/**
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
export interface InjectInlineCitationOptions {
|
|
2
|
+
/** Array of items to use for citation injection */
|
|
2
3
|
items?: Array<{
|
|
3
4
|
id: string;
|
|
4
5
|
name: string;
|
|
6
|
+
type: string;
|
|
5
7
|
}>;
|
|
8
|
+
/** Whether the content is completed (citations only injected for completed content) */
|
|
6
9
|
isCompleted?: boolean;
|
|
10
|
+
/** Whether inline citations are enabled */
|
|
7
11
|
isInlineCitationsEnabled?: boolean;
|
|
12
|
+
/** Base URL for file links (defaults to window.location.origin) */
|
|
8
13
|
baseUrl?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const isBoxDomain: (url: string) => boolean;
|
|
11
16
|
export declare const isBoxCitation: (url: string) => boolean;
|
|
12
17
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* @param text - The markdown text to process
|
|
20
|
+
* @param options - Configuration options for citation injection
|
|
21
|
+
* @returns The processed text with file references converted to markdown links
|
|
15
22
|
*/
|
|
16
23
|
export declare const injectInlineCitation: (text: string, options?: InjectInlineCitationOptions) => string;
|
|
17
24
|
export default injectInlineCitation;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/box-ai-content-answers",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@box/blueprint-web": "^7.8.0",
|
|
6
6
|
"@box/blueprint-web-assets": "^4.56.1",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
|
20
|
-
"@box/blueprint-web": "^12.
|
|
20
|
+
"@box/blueprint-web": "^12.91.0",
|
|
21
21
|
"@box/blueprint-web-assets": "^4.75.0",
|
|
22
|
-
"@box/box-ai-agent-selector": "^1.4.
|
|
23
|
-
"@box/item-icon": "^1.4.
|
|
22
|
+
"@box/box-ai-agent-selector": "^1.4.2",
|
|
23
|
+
"@box/item-icon": "^1.4.2",
|
|
24
24
|
"@box/storybook-utils": "^0.14.11",
|
|
25
25
|
"@testing-library/react": "^15.0.6",
|
|
26
26
|
"react": "^18.3.0",
|