-
Notifications
You must be signed in to change notification settings - Fork 239
feat(compass-assistant): show related resources below messages if it exists COMPASS-9838 #7323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2a9422c
3f38951
ab74a2d
f660823
2ce150f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,6 @@ import { | |
| LgChatChatWindow, | ||
| LgChatLeafygreenChatProvider, | ||
| LgChatMessage, | ||
| LgChatMessageActions, | ||
| LgChatInputBar, | ||
| spacing, | ||
| css, | ||
|
|
@@ -26,7 +25,6 @@ const { DisclaimerText } = LgChatChatDisclaimer; | |
| const { ChatWindow } = LgChatChatWindow; | ||
| const { LeafyGreenChatProvider, Variant } = LgChatLeafygreenChatProvider; | ||
| const { Message } = LgChatMessage; | ||
| const { MessageActions } = LgChatMessageActions; | ||
| const { InputBar } = LgChatInputBar; | ||
|
|
||
| const GEN_AI_FAQ_LINK = 'https://www.mongodb.com/docs/generative-ai-faq/'; | ||
|
|
@@ -141,6 +139,12 @@ const errorBannerWrapperStyles = css({ | |
| margin: spacing[400], | ||
| }); | ||
|
|
||
| const messagesWrapStyles = css({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| gap: spacing[400], | ||
| }); | ||
|
|
||
| export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | ||
| chat, | ||
| hasNonGenuineConnections, | ||
|
|
@@ -185,6 +189,13 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
| .map((part) => part.text) | ||
| .join(''), | ||
| isSender: message.role === 'user', | ||
| sources: message.parts | ||
| .filter((part) => part.type === 'source-url') | ||
| .map((part) => ({ | ||
| children: part.title || part.url, | ||
| href: part.url, | ||
| variant: 'Docs', | ||
| })), | ||
| })); | ||
|
|
||
| const handleMessageSend = useCallback( | ||
|
|
@@ -247,7 +258,7 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
| data-testid="assistant-chat-messages" | ||
| className={messageFeedFixesStyles} | ||
| > | ||
| <div> | ||
| <div className={messagesWrapStyles}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drive-by: I broke the spacing between messages in the recent PR where I fixed the scrolling in a way where it didn't in turn break text selection across messages. |
||
| {lgMessages.map((messageFields) => ( | ||
| <Message | ||
| key={messageFields.id} | ||
|
|
@@ -256,11 +267,14 @@ export const AssistantChat: React.FunctionComponent<AssistantChatProps> = ({ | |
| data-testid={`assistant-message-${messageFields.id}`} | ||
| > | ||
| {messageFields.isSender === false && ( | ||
| <MessageActions | ||
| <Message.Actions | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. drive-by: MessageActions is deprecated. Just like MessageLinks. These are now on Message like Message.Actions and Message.Links. |
||
| onRatingChange={handleFeedback} | ||
| onSubmitFeedback={handleFeedback} | ||
| /> | ||
| )} | ||
| {messageFields.sources.length > 0 && ( | ||
| <Message.Links links={messageFields.sources} /> | ||
| )} | ||
| </Message> | ||
| ))} | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,8 @@ You CANNOT: | |
| 2. Query MongoDB directly or execute code. | ||
| 3. Access the current state of the UI | ||
| </inabilities> | ||
|
|
||
| Always call the 'search_content' tool when asked a technical question that would benefit from getting relevant info from the documentation. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Jedi mind trick of getting this thing to use the sources and therefore reliably return some. https://mongodb.github.io/chatbot/server/context-engineering#elicit-internal-retrieval-augmented-generation-tool-calls |
||
| `; | ||
| }; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.