Skip to content

Commit e139009

Browse files
authored
chore(compass-assistant): update the placeholder text and disclaimer COMPASS-9836 (#7333)
1 parent 434e00a commit e139009

File tree

3 files changed

+42
-48
lines changed

3 files changed

+42
-48
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,7 @@ describe('CompassAssistantProvider', function () {
390390

391391
await renderOpenAssistantDrawer({ chat: mockChat });
392392

393-
const input = screen.getByPlaceholderText(
394-
'Ask MongoDB Assistant a question'
395-
);
393+
const input = screen.getByPlaceholderText('Ask a question');
396394
const sendButton = screen.getByLabelText('Send message');
397395

398396
userEvent.type(input, 'Hello assistant');
@@ -430,7 +428,7 @@ describe('CompassAssistantProvider', function () {
430428
await renderOpenAssistantDrawer({ chat: mockChat });
431429

432430
userEvent.type(
433-
screen.getByPlaceholderText('Ask MongoDB Assistant a question'),
431+
screen.getByPlaceholderText('Ask a question'),
434432
'Hello assistant!'
435433
);
436434
userEvent.click(screen.getByLabelText('Send message'));
@@ -473,7 +471,7 @@ describe('CompassAssistantProvider', function () {
473471
await renderOpenAssistantDrawer({ chat, atlastAiService });
474472

475473
userEvent.type(
476-
screen.getByPlaceholderText('Ask MongoDB Assistant a question'),
474+
screen.getByPlaceholderText('Ask a question'),
477475
'Hello assistant!'
478476
);
479477
userEvent.click(screen.getByLabelText('Send message'));

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

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ describe('AssistantChat', function () {
8585
it('renders input field and send button', function () {
8686
renderWithChat([]);
8787

88-
const inputField = screen.getByPlaceholderText(
89-
'Ask MongoDB Assistant a question'
90-
);
88+
const inputField = screen.getByPlaceholderText('Ask a question');
9189
const sendButton = screen.getByLabelText('Send message');
9290

9391
expect(inputField).to.exist;
@@ -99,7 +97,7 @@ describe('AssistantChat', function () {
9997

10098
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
10199
const inputField = screen.getByPlaceholderText(
102-
'Ask MongoDB Assistant a question'
100+
'Ask a question'
103101
) as HTMLTextAreaElement;
104102

105103
userEvent.type(inputField, 'What is MongoDB?');
@@ -109,9 +107,8 @@ describe('AssistantChat', function () {
109107

110108
it('displays the disclaimer and welcome text', function () {
111109
renderWithChat([]);
112-
expect(screen.getByText(/This feature is powered by generative AI/)).to
110+
expect(screen.getByText(/AI can make mistakes. Review for accuracy./)).to
113111
.exist;
114-
expect(screen.getByText(/Please review the outputs carefully/)).to.exist;
115112
});
116113

117114
it('displays the welcome text when there are no messages', function () {
@@ -149,9 +146,7 @@ describe('AssistantChat', function () {
149146
it('send button is enabled when input has text', function () {
150147
renderWithChat([]);
151148

152-
const inputField = screen.getByPlaceholderText(
153-
'Ask MongoDB Assistant a question'
154-
);
149+
const inputField = screen.getByPlaceholderText('Ask a question');
155150
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
156151
const sendButton = screen.getByLabelText(
157152
'Send message'
@@ -165,9 +160,7 @@ describe('AssistantChat', function () {
165160
it('send button is disabled for whitespace-only input', async function () {
166161
renderWithChat([]);
167162

168-
const inputField = screen.getByPlaceholderText(
169-
'Ask MongoDB Assistant a question'
170-
);
163+
const inputField = screen.getByPlaceholderText('Ask a question');
171164
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
172165
const sendButton = screen.getByLabelText(
173166
'Send message'
@@ -246,9 +239,7 @@ describe('AssistantChat', function () {
246239
it('calls sendMessage when form is submitted', async function () {
247240
const { result, ensureOptInAndSendStub } = renderWithChat([]);
248241
const { track } = result;
249-
const inputField = screen.getByPlaceholderText(
250-
'Ask MongoDB Assistant a question'
251-
);
242+
const inputField = screen.getByPlaceholderText('Ask a question');
252243
const sendButton = screen.getByLabelText('Send message');
253244

254245
userEvent.type(inputField, 'What is aggregation?');
@@ -268,7 +259,7 @@ describe('AssistantChat', function () {
268259

269260
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
270261
const inputField = screen.getByPlaceholderText(
271-
'Ask MongoDB Assistant a question'
262+
'Ask a question'
272263
) as HTMLTextAreaElement;
273264

274265
userEvent.type(inputField, 'Test message');
@@ -282,9 +273,7 @@ describe('AssistantChat', function () {
282273
const { ensureOptInAndSendStub, result } = renderWithChat([]);
283274
const { track } = result;
284275

285-
const inputField = screen.getByPlaceholderText(
286-
'Ask MongoDB Assistant a question'
287-
);
276+
const inputField = screen.getByPlaceholderText('Ask a question');
288277

289278
userEvent.type(inputField, ' What is sharding? ');
290279
userEvent.click(screen.getByLabelText('Send message'));
@@ -301,9 +290,7 @@ describe('AssistantChat', function () {
301290
it('does not call ensureOptInAndSend when input is empty or whitespace-only', function () {
302291
const { ensureOptInAndSendStub } = renderWithChat([]);
303292

304-
const inputField = screen.getByPlaceholderText(
305-
'Ask MongoDB Assistant a question'
306-
);
293+
const inputField = screen.getByPlaceholderText('Ask a question');
307294
const chatForm = screen.getByTestId('assistant-chat-input');
308295

309296
// Test empty input

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

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,16 @@ const welcomeMessageStyles = css({
127127
paddingRight: spacing[400],
128128
});
129129
const disclaimerTextStyles = css({
130-
marginTop: spacing[400],
131-
marginBottom: spacing[400],
130+
paddingBottom: spacing[400],
131+
paddingLeft: spacing[400],
132+
paddingRight: spacing[400],
133+
});
134+
/** TODO(COMPASS-9751): This should be handled by Leafygreen's disclaimers update */
135+
const inputBarStyleFixes = css({
136+
width: '100%',
137+
paddingLeft: spacing[400],
138+
paddingRight: spacing[400],
139+
paddingBottom: spacing[400],
132140
});
133141

134142
function makeErrorMessage(message: string) {
@@ -345,17 +353,6 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
345353
);
346354
})}
347355
</div>
348-
<DisclaimerText className={disclaimerTextStyles}>
349-
This feature is powered by generative AI. See our{' '}
350-
<Link
351-
hideExternalIcon={false}
352-
href={GEN_AI_FAQ_LINK}
353-
target="_blank"
354-
>
355-
FAQ
356-
</Link>{' '}
357-
for more information. Please review the outputs carefully.
358-
</DisclaimerText>
359356
</div>
360357
{error && (
361358
<div className={errorBannerWrapperStyles}>
@@ -371,14 +368,26 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
371368
documentation right in your window.
372369
</div>
373370
)}
374-
<InputBar
375-
data-testid="assistant-chat-input"
376-
onMessageSend={handleMessageSend}
377-
state={status === 'submitted' ? 'loading' : undefined}
378-
textareaProps={{
379-
placeholder: 'Ask MongoDB Assistant a question',
380-
}}
381-
/>
371+
<div className={inputBarStyleFixes}>
372+
<InputBar
373+
data-testid="assistant-chat-input"
374+
onMessageSend={handleMessageSend}
375+
state={status === 'submitted' ? 'loading' : undefined}
376+
textareaProps={{
377+
placeholder: 'Ask a question',
378+
}}
379+
/>
380+
</div>
381+
<DisclaimerText className={disclaimerTextStyles}>
382+
AI can make mistakes. Review for accuracy.{' '}
383+
<Link
384+
hideExternalIcon={false}
385+
href={GEN_AI_FAQ_LINK}
386+
target="_blank"
387+
>
388+
Learn more
389+
</Link>
390+
</DisclaimerText>
382391
</ChatWindow>
383392
</LeafyGreenChatProvider>
384393
</div>

0 commit comments

Comments
 (0)