Skip to content

Commit 7b04471

Browse files
committed
chore(compass-assistant): add disclaimer text COMPASS-9754
1 parent 4879fa3 commit 7b04471

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

packages/compass-assistant/src/assistant-chat.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ describe('AssistantChat', function () {
6363
expect(inputField.value).to.equal('What is MongoDB?');
6464
});
6565

66+
it('displays the disclaimer text', function () {
67+
renderWithChat([]);
68+
expect(screen.getByText(/This feature is powered by generative AI/)).to
69+
.exist;
70+
expect(screen.getByText(/Please review the outputs carefully/)).to.exist;
71+
});
72+
6673
it('send button is disabled when input is empty', function () {
6774
renderWithChat([]);
6875

packages/compass-assistant/src/assistant-chat.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ import {
1616
fontFamilies,
1717
palette,
1818
useDarkMode,
19+
LgChatChatDisclaimer,
20+
Link,
1921
} from '@mongodb-js/compass-components';
2022
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider';
2123

24+
const { DisclaimerText } = LgChatChatDisclaimer;
2225
const { ChatWindow } = LgChatChatWindow;
2326
const { LeafyGreenChatProvider, Variant } = LgChatLeafygreenChatProvider;
2427
const { Message } = LgChatMessage;
2528
const { MessageFeed } = LgChatMessageFeed;
2629
const { MessageActions } = LgChatMessageActions;
2730
const { InputBar } = LgChatInputBar;
2831

32+
const GEN_AI_FAQ_LINK = 'https://www.mongodb.com/docs/generative-ai-faq/';
33+
2934
interface AssistantChatProps {
3035
chat: Chat<AssistantMessage>;
3136
}
@@ -191,6 +196,17 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
191196
data-testid="assistant-chat-messages"
192197
className={messageFeedFixesStyles}
193198
>
199+
<DisclaimerText>
200+
This feature is powered by generative AI. See our{' '}
201+
<Link
202+
hideExternalIcon={false}
203+
href={GEN_AI_FAQ_LINK}
204+
target="_blank"
205+
>
206+
FAQ
207+
</Link>{' '}
208+
for more information. Please review the outputs carefully.
209+
</DisclaimerText>
194210
{lgMessages.map((messageFields) => (
195211
<Message
196212
key={messageFields.id}

0 commit comments

Comments
 (0)