@@ -16,16 +16,21 @@ import {
16
16
fontFamilies ,
17
17
palette ,
18
18
useDarkMode ,
19
+ LgChatChatDisclaimer ,
20
+ Link ,
19
21
} from '@mongodb-js/compass-components' ;
20
22
import { useTelemetry } from '@mongodb-js/compass-telemetry/provider' ;
21
23
24
+ const { DisclaimerText } = LgChatChatDisclaimer ;
22
25
const { ChatWindow } = LgChatChatWindow ;
23
26
const { LeafyGreenChatProvider, Variant } = LgChatLeafygreenChatProvider ;
24
27
const { Message } = LgChatMessage ;
25
28
const { MessageFeed } = LgChatMessageFeed ;
26
29
const { MessageActions } = LgChatMessageActions ;
27
30
const { InputBar } = LgChatInputBar ;
28
31
32
+ const GEN_AI_FAQ_LINK = 'https://www.mongodb.com/docs/generative-ai-faq/' ;
33
+
29
34
interface AssistantChatProps {
30
35
chat : Chat < AssistantMessage > ;
31
36
}
@@ -54,6 +59,9 @@ const headerStyleLightModeFixes = css({
54
59
55
60
// TODO(COMPASS-9751): These are temporary patches to make the Assistant chat take the entire
56
61
// width and height of the drawer since Leafygreen doesn't support this yet.
62
+ const inputBarFixesStyles = css ( {
63
+ marginBottom : - spacing [ 400 ] ,
64
+ } ) ;
57
65
const assistantChatFixesStyles = css ( {
58
66
// Negative margin to patch the padding of the drawer.
59
67
marginTop : - spacing [ 400 ] ,
@@ -95,6 +103,9 @@ const messageFeedFixesStyles = css({ height: '100%' });
95
103
const chatWindowFixesStyles = css ( {
96
104
height : '100%' ,
97
105
} ) ;
106
+ const welcomeMessageStyles = css ( {
107
+ padding : spacing [ 400 ] ,
108
+ } ) ;
98
109
99
110
function makeErrorMessage ( message : string ) {
100
111
message = message || 'An error occurred' ;
@@ -191,6 +202,17 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
191
202
data-testid = "assistant-chat-messages"
192
203
className = { messageFeedFixesStyles }
193
204
>
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 >
194
216
{ lgMessages . map ( ( messageFields ) => (
195
217
< Message
196
218
key = { messageFields . id }
@@ -206,13 +228,6 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
206
228
) }
207
229
</ Message >
208
230
) ) }
209
- { status === 'submitted' && (
210
- < Message
211
- id = "loading"
212
- messageBody = "Thinking..."
213
- isSender = { false }
214
- />
215
- ) }
216
231
</ MessageFeed >
217
232
{ error && (
218
233
< div className = { errorBannerWrapperStyles } >
@@ -221,9 +236,18 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({
221
236
</ Banner >
222
237
</ div >
223
238
) }
239
+ { lgMessages . length === 0 && (
240
+ < div className = { welcomeMessageStyles } >
241
+ < h4 > Welcome to your MongoDB Assistant.</ h4 >
242
+ Ask any question about MongoDB to receive expert guidance and
243
+ documentation right in your window.
244
+ </ div >
245
+ ) }
224
246
< InputBar
225
247
data-testid = "assistant-chat-input"
226
248
onMessageSend = { handleMessageSend }
249
+ className = { inputBarFixesStyles }
250
+ state = { status === 'submitted' ? 'loading' : undefined }
227
251
textareaProps = { {
228
252
placeholder : 'Ask MongoDB Assistant a question' ,
229
253
} }
0 commit comments