Skip to content

Commit e089602

Browse files
Merge remote-tracking branch 'origin/main' into beta-releases
2 parents 616b085 + 5b4ec13 commit e089602

File tree

9 files changed

+87
-51
lines changed

9 files changed

+87
-51
lines changed

.github/workflows/bump-packages.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ jobs:
5858
commit-message: 'chore(release): bump package versions'
5959
branch: ci/bump-packages
6060
title: 'chore(release): bump package versions'
61-
labels: no-title-validation
61+
labels: |
62+
no-title-validation
63+
bot
6264
author: '${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>'
6365
body: >-
6466
<p>This PR is autogenerated and updates the version of every package

.github/workflows/update-dependencies.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ jobs:
8484
commit-message: 'chore(deps): update ${{ matrix.group_name }} to latest'
8585
branch: ci/update-${{ matrix.group_name }}
8686
title: 'chore(deps): update ${{ matrix.group_name }} to latest'
87-
labels: no-title-validation
87+
labels: |
88+
no-title-validation
89+
bot
8890
author: '${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>'
8991
body: |
9092
<p>This PR is automatically generated and updates the versions of

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

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
LgChatChatWindow,
77
LgChatLeafygreenChatProvider,
88
LgChatMessage,
9-
LgChatMessageFeed,
109
LgChatMessageActions,
1110
LgChatInputBar,
1211
spacing,
@@ -25,7 +24,6 @@ const { DisclaimerText } = LgChatChatDisclaimer;
2524
const { ChatWindow } = LgChatChatWindow;
2625
const { LeafyGreenChatProvider, Variant } = LgChatLeafygreenChatProvider;
2726
const { Message } = LgChatMessage;
28-
const { MessageFeed } = LgChatMessageFeed;
2927
const { MessageActions } = LgChatMessageActions;
3028
const { InputBar } = LgChatInputBar;
3129

@@ -59,12 +57,8 @@ const headerStyleLightModeFixes = css({
5957

6058
// TODO(COMPASS-9751): These are temporary patches to make the Assistant chat take the entire
6159
// width and height of the drawer since Leafygreen doesn't support this yet.
62-
const inputBarFixesStyles = css({
63-
marginBottom: -spacing[400],
64-
});
6560
const assistantChatFixesStyles = css({
6661
// Negative margin to patch the padding of the drawer.
67-
marginTop: -spacing[400],
6862
'> div, > div > div, > div > div > div, > div > div > div': {
6963
height: '100%',
7064
},
@@ -99,12 +93,26 @@ const assistantChatFixesStyles = css({
9993
fontWeight: 'semibold',
10094
},
10195
});
102-
const messageFeedFixesStyles = css({ height: '100%' });
96+
const messageFeedFixesStyles = css({
97+
display: 'flex',
98+
flexDirection: 'column-reverse',
99+
overflowY: 'auto',
100+
flex: 1,
101+
padding: spacing[400],
102+
});
103103
const chatWindowFixesStyles = css({
104104
height: '100%',
105+
display: 'flex',
106+
flexDirection: 'column',
105107
});
106108
const welcomeMessageStyles = css({
107-
padding: spacing[400],
109+
paddingBottom: spacing[400],
110+
paddingLeft: spacing[400],
111+
paddingRight: spacing[400],
112+
});
113+
const disclaimerTextStyles = css({
114+
marginTop: spacing[400],
115+
marginBottom: spacing[400],
108116
});
109117

110118
function makeErrorMessage(message: string) {
@@ -130,18 +138,20 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
130138
},
131139
});
132140

133-
// Transform AI SDK messages to LeafyGreen chat format
134-
const lgMessages = messages.map((message) => ({
135-
id: message.id,
136-
messageBody:
137-
message.metadata?.displayText ||
138-
message.parts
139-
?.filter((part) => part.type === 'text')
140-
.map((part) => part.text)
141-
.join('') ||
142-
'',
143-
isSender: message.role === 'user',
144-
}));
141+
// Transform AI SDK messages to LeafyGreen chat format and reverse the order of the messages
142+
// for displaying it correctly with flex-direction: column-reverse.
143+
const lgMessages = messages
144+
.map((message) => ({
145+
id: message.id,
146+
messageBody:
147+
message.metadata?.displayText ||
148+
message.parts
149+
?.filter((part) => part.type === 'text')
150+
.map((part) => part.text)
151+
.join(''),
152+
isSender: message.role === 'user',
153+
}))
154+
.reverse();
145155

146156
const handleMessageSend = useCallback(
147157
(messageBody: string) => {
@@ -198,21 +208,10 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
198208
>
199209
<LeafyGreenChatProvider variant={Variant.Compact}>
200210
<ChatWindow title="MongoDB Assistant" className={chatWindowFixesStyles}>
201-
<MessageFeed
211+
<div
202212
data-testid="assistant-chat-messages"
203213
className={messageFeedFixesStyles}
204214
>
205-
<DisclaimerText>
206-
This feature is powered by generative AI. See our{' '}
207-
<Link
208-
hideExternalIcon={false}
209-
href={GEN_AI_FAQ_LINK}
210-
target="_blank"
211-
>
212-
FAQ
213-
</Link>{' '}
214-
for more information. Please review the outputs carefully.
215-
</DisclaimerText>
216215
{lgMessages.map((messageFields) => (
217216
<Message
218217
key={messageFields.id}
@@ -228,7 +227,18 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
228227
)}
229228
</Message>
230229
))}
231-
</MessageFeed>
230+
<DisclaimerText className={disclaimerTextStyles}>
231+
This feature is powered by generative AI. See our{' '}
232+
<Link
233+
hideExternalIcon={false}
234+
href={GEN_AI_FAQ_LINK}
235+
target="_blank"
236+
>
237+
FAQ
238+
</Link>{' '}
239+
for more information. Please review the outputs carefully.
240+
</DisclaimerText>
241+
</div>
232242
{error && (
233243
<div className={errorBannerWrapperStyles}>
234244
<Banner variant="danger" dismissible onClose={clearError}>
@@ -246,7 +256,6 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
246256
<InputBar
247257
data-testid="assistant-chat-input"
248258
onMessageSend={handleMessageSend}
249-
className={inputBarFixesStyles}
250259
state={status === 'submitted' ? 'loading' : undefined}
251260
textareaProps={{
252261
placeholder: 'Ask MongoDB Assistant a question',

packages/compass-components/src/components/drawer/drawer-toolbar-layout/drawer-toolbar-layout-container.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const DrawerToolbarLayoutContainer = forwardRef<
114114
data-testid={`${dataLgId}`}
115115
aria-live="polite"
116116
aria-atomic="true"
117+
hasPadding={false}
117118
>
118119
{content}
119120
</Drawer>

packages/compass-components/src/components/drawer/drawer/drawer.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ import {
2828
} from './drawer.styles';
2929
import { DisplayMode, type DrawerProps } from './drawer.types';
3030
import { Icon } from '../../leafygreen';
31+
import { css, cx } from '@leafygreen-ui/emotion';
32+
33+
const noPaddingFixesStyles = css({
34+
padding: 0,
35+
});
3136

3237
export const Drawer = forwardRef<HTMLDivElement, DrawerProps>(
3338
(
@@ -40,6 +45,7 @@ export const Drawer = forwardRef<HTMLDivElement, DrawerProps>(
4045
onClose,
4146
open = false,
4247
title,
48+
hasPadding = true,
4349
...rest
4450
},
4551
fwdRef
@@ -168,7 +174,11 @@ export const Drawer = forwardRef<HTMLDivElement, DrawerProps>(
168174
theme,
169175
})}
170176
>
171-
<div className={innerChildrenContainerStyles}>
177+
<div
178+
className={cx(innerChildrenContainerStyles, {
179+
[noPaddingFixesStyles]: !hasPadding,
180+
})}
181+
>
172182
{/* Empty span element used to track if children container has scrolled down */}
173183
{<span ref={interceptRef} />}
174184
{children}

packages/compass-components/src/components/drawer/drawer/drawer.types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@ export interface DrawerProps
4444
* Title of the Drawer
4545
*/
4646
title: React.ReactNode;
47+
48+
/**
49+
* Determines if the Drawer has padding
50+
* @defaultValue true
51+
*/
52+
hasPadding?: boolean;
4753
}

packages/compass-data-modeling/src/components/drawer/drawer-section-components.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ import {
1010
import React from 'react';
1111

1212
const containerStyles = css({
13-
'&:first-child': {
14-
marginTop: `-${spacing[400]}px`,
15-
},
1613
borderBottom: `1px solid ${palette.gray.light2}`,
17-
marginLeft: `-${spacing[400]}px`,
18-
marginRight: `-${spacing[400]}px`,
1914
padding: spacing[400],
2015
});
2116

packages/compass-generative-ai/src/components/ai-optin-modal.tsx

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,23 @@ const bodyDarkThemeStyles = css({
4747
color: palette.gray.light2,
4848
});
4949

50-
const disclaimerStyles = css({
51-
color: palette.gray.dark1,
50+
const disclaimerStylesCommon = {
5251
marginTop: spacing[400],
5352
marginLeft: spacing[800],
5453
marginRight: spacing[800],
55-
});
54+
textAlign: 'center',
55+
};
56+
57+
const disclaimerStyles = {
58+
[Theme.Light]: css({
59+
color: palette.gray.dark1,
60+
...disclaimerStylesCommon,
61+
}),
62+
[Theme.Dark]: css({
63+
color: palette.gray.light2,
64+
...disclaimerStylesCommon,
65+
}),
66+
};
5667

5768
const bannerStyles = css({
5869
width: '480px',
@@ -203,13 +214,14 @@ export const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
203214
onLinkClick={onOptInModalClose}
204215
graphic={<AiImageBanner />}
205216
disclaimer={
206-
<div className={disclaimerStyles}>
207-
This is a feature powered by generative AI, and may give inaccurate
208-
responses. Please see our{' '}
217+
<div className={disclaimerStyles[darkMode ? Theme.Dark : Theme.Light]}>
218+
Features in {isCloudOptIn ? 'Data Explorer' : 'Compass'} powered by
219+
generative AI may produce inaccurate responses. Please see our{' '}
209220
<Link hideExternalIcon={false} href={GEN_AI_FAQ_LINK} target="_blank">
210221
FAQ
211222
</Link>{' '}
212-
for more information.
223+
for more information. Continue to opt into all AI-powered features
224+
within {isCloudOptIn ? 'Data Explorer' : 'Compass'}.
213225
</div>
214226
}
215227
>

scripts/update-dependencies-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
'eslint-plugin-react',
2222
'eslint-plugin-react-hooks',
2323
],
24-
typescript: ['typescript', 'ts-node'],
24+
typescript: ['@microsoft/api-extractor', 'typescript', 'ts-node'],
2525
leafygreen: [
2626
'@emotion/*',
2727
'@leafygreen-ui/*',
@@ -32,6 +32,5 @@ module.exports = {
3232
// TODO(COMPASS-9443): Update update-* github actions to handle all groups as
3333
// a matrix inside one action instead of having separate action for every
3434
// group and add more groups following the ones in _dependabot
35-
// mongosh: [],
3635
// 'devtools-shared-prod': [],
3736
};

0 commit comments

Comments
 (0)