diff --git a/packages/compass-assistant/src/compass-assistant-drawer.tsx b/packages/compass-assistant/src/compass-assistant-drawer.tsx
index f21ced59d11..fe0e0f0e107 100644
--- a/packages/compass-assistant/src/compass-assistant-drawer.tsx
+++ b/packages/compass-assistant/src/compass-assistant-drawer.tsx
@@ -25,6 +25,20 @@ const assistantTitleStyles = css({
justifyContent: 'space-between',
});
+const assistantTitleTextWrapperStyles = css({
+ display: 'flex',
+ alignItems: 'center',
+ flexWrap: 'wrap',
+ transition: 'transform 0.16s ease-in',
+
+ // Shrink the title text and badge when the drawer is narrow
+ '@container (width < 320px)': {
+ '&': {
+ transform: 'scale(0.8) translateX(-10%)',
+ },
+ },
+});
+
const assistantTitleTextStyles = css({
marginRight: spacing[200],
});
@@ -55,7 +69,7 @@ export const CompassAssistantDrawer: React.FunctionComponent<{
'data-testid': 'assistant-confirm-clear-chat-modal',
});
if (confirmed) {
- clearChat?.();
+ await clearChat?.();
}
}, [clearChat]);
@@ -74,7 +88,7 @@ export const CompassAssistantDrawer: React.FunctionComponent<{
id={ASSISTANT_DRAWER_ID}
title={
-
+
MongoDB Assistant
Preview
diff --git a/packages/compass-assistant/src/compass-assistant-provider.tsx b/packages/compass-assistant/src/compass-assistant-provider.tsx
index 2ab43362b28..2f17904e6e0 100644
--- a/packages/compass-assistant/src/compass-assistant-provider.tsx
+++ b/packages/compass-assistant/src/compass-assistant-provider.tsx
@@ -77,7 +77,7 @@ type AssistantActionsContextType = {
connectionInfo: ConnectionInfo;
error: Error;
}) => void;
- clearChat?: () => void;
+ clearChat?: () => Promise
;
tellMoreAboutInsight?: (context: ProactiveInsightsContext) => void;
ensureOptInAndSend?: (
message: SendMessage,
@@ -98,7 +98,7 @@ export const AssistantActionsContext =
interpretExplainPlan: () => {},
interpretConnectionError: () => {},
tellMoreAboutInsight: () => {},
- clearChat: () => {},
+ clearChat: async () => {},
ensureOptInAndSend: async () => {},
});
@@ -215,7 +215,9 @@ export const AssistantProvider: React.FunctionComponent<
'performance insights',
buildProactiveInsightsPrompt
),
- clearChat: () => {
+ clearChat: async () => {
+ await chat.stop();
+ chat.clearError();
chat.messages = chat.messages.filter(
(message) => message.metadata?.isPermanent
);
diff --git a/packages/compass-assistant/src/components/assistant-chat.tsx b/packages/compass-assistant/src/components/assistant-chat.tsx
index b3fa99f467e..144c4c44b63 100644
--- a/packages/compass-assistant/src/components/assistant-chat.tsx
+++ b/packages/compass-assistant/src/components/assistant-chat.tsx
@@ -134,6 +134,8 @@ const messageFeedFixesStyles = css({
display: 'flex',
flexDirection: 'column-reverse',
overflowY: 'auto',
+ width: '100%',
+ wordBreak: 'break-word',
flex: 1,
padding: spacing[400],
gap: spacing[400],
@@ -161,6 +163,12 @@ const disclaimerTextStyles = css({
fontSize: 'inherit',
},
});
+// On small screens, many components end up breaking words which we don't want.
+// This is a general temporary fix for all components that we want to prevent from wrapping.
+const noWrapFixesStyles = css({
+ whiteSpace: 'nowrap',
+});
+
/** TODO(COMPASS-9751): This should be handled by Leafygreen's disclaimers update */
const inputBarStyleFixes = css({
width: '100%',
@@ -400,9 +408,15 @@ export const AssistantChat: React.FunctionComponent = ({
onSubmitFeedback={(event, state) =>
handleFeedback({ message, state })
}
+ className={noWrapFixesStyles}
+ />
+ )}
+ {sources.length > 0 && (
+
)}
- {sources.length > 0 && }
);
})}
@@ -423,7 +437,7 @@ export const AssistantChat: React.FunctionComponent = ({
size="large"
style={{ color: palette.green.dark1 }}
/>
- MongoDB Assistant.
+ MongoDB Assistant
Welcome to the MongoDB Assistant!
@@ -446,6 +460,7 @@ export const AssistantChat: React.FunctionComponent = ({
AI can make mistakes. Review for accuracy.{' '}
title content