diff --git a/redisinsight/ui/src/components/side-panels/components/copilot-panel/CopilotPanel.tsx b/redisinsight/ui/src/components/side-panels/components/copilot-panel/CopilotPanel.tsx index 13d52a6a91..891e0587a4 100644 --- a/redisinsight/ui/src/components/side-panels/components/copilot-panel/CopilotPanel.tsx +++ b/redisinsight/ui/src/components/side-panels/components/copilot-panel/CopilotPanel.tsx @@ -4,6 +4,7 @@ import styles from 'uiSrc/components/side-panels/styles.module.scss' import AiAssistant from 'uiSrc/components/side-panels/panels/ai-assistant' import { ONBOARDING_FEATURES } from 'uiSrc/components/onboarding-features' import { OnboardingTour } from 'uiSrc/components' +import { Text } from 'uiSrc/components/base/text' export interface Props { isFullScreen: boolean @@ -25,7 +26,9 @@ const CopilotPanel = (props: Props) => { fullSize >
- Redis Copilot + + Redis Copilot +
diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/components/expert-chat-header/ExpertChatHeader.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/components/expert-chat-header/ExpertChatHeader.tsx index 6a934a32c8..54cf16d426 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/components/expert-chat-header/ExpertChatHeader.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/components/expert-chat-header/ExpertChatHeader.tsx @@ -18,7 +18,7 @@ import { setExplorePanelIsPageOpen, } from 'uiSrc/slices/panels/sidePanels' import { RestartChat } from 'uiSrc/components/side-panels/panels/ai-assistant/components/shared' - +import { Row } from 'uiSrc/components/base/layout/flex' import { Spacer } from 'uiSrc/components/base/layout/spacer' import { EmptyButton, PrimaryButton } from 'uiSrc/components/base/forms/buttons' import { EraserIcon, LightBulbIcon } from 'uiSrc/components/base/icons' @@ -102,18 +102,20 @@ const ExpertChatHeader = (props: Props) => { } > <> - + Open relevant tutorials to learn more about search and query. - - - Open tutorials - + + + + Open tutorials + + diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx index 6550ec8602..250d0739bd 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx @@ -3,6 +3,7 @@ import React, { Ref, useRef, useState } from 'react' import cx from 'classnames' import { isModifiedEvent } from 'uiSrc/services' +import { Row } from 'uiSrc/components/base/layout/flex' import { RiPopover, RiTooltip } from 'uiSrc/components/base' import { Spacer } from 'uiSrc/components/base/layout/spacer' import { PrimaryButton } from 'uiSrc/components/base/forms/buttons' @@ -99,12 +100,12 @@ const ChatForm = (props: Props) => {
{validation.title && ( <> - {validation.title} + {validation.title} )} {validation.content && ( - {validation.content} + {validation.content} )}
{validation.icon} @@ -150,21 +151,24 @@ const ChatForm = (props: Props) => { > <> {agreements} - - e.stopPropagation()} - type="button" - data-testid="ai-accept-agreements" - > - I accept - + + + e.stopPropagation()} + type="button" + data-testid="ai-accept-agreements" + > + I accept + + + Verify the accuracy of any information provided by Redis Copilot before using it diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.styles.ts b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.styles.ts new file mode 100644 index 0000000000..fab50310cd --- /dev/null +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.styles.ts @@ -0,0 +1,58 @@ +import styled from 'styled-components' +import { AiChatMessageType } from 'uiSrc/slices/interfaces/aiAssistant' + +export const HistoryWrapper = styled.div` + width: 100%; + height: 100%; +` + +export const HistoryContainer = styled.div` + display: flex; + flex-direction: column; + height: 100%; + overflow-y: auto; + padding: 8px 12px; + + > :first-child { + margin-top: auto; + } +` + +export const MessageWrapper = styled.div<{ + messageType: AiChatMessageType +}>` + max-width: 90%; + margin: 8px 0; + align-self: ${({ messageType }) => + messageType === AiChatMessageType.AIMessage ? 'flex-start' : 'flex-end'}; +` + +export const MessageContainer = styled.div<{ + messageType: AiChatMessageType + hasError?: boolean +}>` + overflow-wrap: break-word; + padding: 8px 16px; + border-radius: 8px; + gap: 6px; + + ${({ messageType, theme }) => + messageType === AiChatMessageType.AIMessage && + ` + background-color: ${theme.components.button.variants.primary.disabled?.bgColor}; + `} + + ${({ messageType, theme }) => + messageType === AiChatMessageType.HumanMessage && + ` + background-color: ${theme.components.button.variants['secondary-invert'].normal?.bgColor}; + color: ${theme.components.button.variants['secondary-invert'].normal?.textColor}; + `} + + ${({ hasError }) => + hasError && + ` + opacity: .66; + display: flex; + `} +` diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.tsx index bb6bd2a852..49a95fdebd 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/ChatHistory.tsx @@ -5,7 +5,6 @@ import React, { useEffect, useRef, } from 'react' -import cx from 'classnames' import { throttle } from 'lodash' import { @@ -21,7 +20,12 @@ import LoadingMessage from '../loading-message' import MarkdownMessage from '../markdown-message' import ErrorMessage from '../error-message' -import styles from './styles.module.scss' +import { + HistoryContainer, + HistoryWrapper, + MessageContainer, + MessageWrapper, +} from './ChatHistory.styles' export interface Props { autoScroll?: boolean @@ -113,25 +117,16 @@ const ChatHistory = (props: Props) => { return ( -
-
+ {error && ( - + )} {messageType === AiChatMessageType.HumanMessage ? ( content @@ -144,8 +139,8 @@ const ChatHistory = (props: Props) => { {content} )} -
-
+ +
) @@ -155,50 +150,51 @@ const ChatHistory = (props: Props) => { if (isLoading) { return ( -
+ -
+ ) } if (history.length === 0) { return ( -
-
-
-
+ + + {initialMessage} -
-
-
-
+ + + + ) } const { content } = inProgressMessage || {} return ( -
-
+ + {history.map(getMessage)} {getMessage(inProgressMessage)} {content === '' && ( -
-
+ + -
-
+ + )} -
-
-
+
+ + ) } diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/styles.module.scss b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/styles.module.scss deleted file mode 100644 index 17f2010555..0000000000 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-history/styles.module.scss +++ /dev/null @@ -1,79 +0,0 @@ -$spacing: 6px; -$delay: .13s; - -.wrapper { - width: 100%; - height: 100%; - - :global { - code { - background-color: var(--euiColorEmptyShade) !important; - } - pre > code { - background-color: var(--browserTableRowEven) !important; - } - } -} - -.loader { - display: flex; - align-items: center; - justify-content: center; -} - -.history { - height: 100%; - display: flex; - flex-direction: column; - - overflow-y: auto; - @include eui.scrollBar; - padding: 8px 12px; - - font-size: 12px; - - > :first-child { - margin-top: auto; - } -} -.answerWrapper, .questionWrapper { - max-width: 90%; - margin: 8px 0; -} - -.answer, .question { - overflow-wrap: break-word; - padding: 8px 16px; - border-radius: 8px; - - &.error { - opacity: .66; - display: flex; - - .errorIcon { - width: 12px; - height: 12px; - color: var(--euiColorDangerText); - margin-top: 2px; - margin-right: 6px; - } - } -} - -.answerWrapper { - align-self: flex-start; -} - -.answer { - background-color: var(--euiColorLightestShade); -} - -.questionWrapper { - align-self: flex-end; -} - -.question { - background-color: var(--insightsTriggerBgColor); -} - - diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/restart-chat/RestartChat.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/restart-chat/RestartChat.tsx index 650ba61b5a..7a8c97ad90 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/restart-chat/RestartChat.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/restart-chat/RestartChat.tsx @@ -6,6 +6,7 @@ import { PrimaryButton } from 'uiSrc/components/base/forms/buttons' import { Title } from 'uiSrc/components/base/text/Title' import { Text } from 'uiSrc/components/base/text' import { RiPopover } from 'uiSrc/components/base' +import { Row } from 'uiSrc/components/base/layout/flex' import styles from './styles.module.scss' export interface Props { @@ -41,21 +42,25 @@ const RestartChat = (props: Props) => { button={extendedButton} > <> - Restart session + + Restart session + - + This will delete the current message history and initiate a new session. - - - Restart - + + + + Restart + + ) diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/texts.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/texts.tsx index 6f90ecf897..4165c8b9dc 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/texts.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/texts.tsx @@ -6,16 +6,16 @@ import { Text } from 'uiSrc/components/base/text' export const ASSISTANCE_CHAT_AGREEMENTS = ( <> - + Redis Copilot is powered by OpenAI API and is designed for general information only. - + Please do not input any personal data or confidential information. - + By accessing and/or using Redis Copilot, you acknowledge that you agree to the{' '} - Redis Copilot is powered by OpenAI API. + + Redis Copilot is powered by OpenAI API. + - + Please do not include any personal data (except as expressly required for the use of Redis Copilot) or confidential information. - + Redis Copilot needs access to the information in your database to provide you context-aware assistance. - + By accepting these terms, you consent to the processing of any information included in your database, and you agree to the{' '} { {(form: React.ReactNode) => ( <> - - Welcome to Redis Copilot. - + + Welcome to Redis Copilot + - + Learn about Redis and explore your data, in a conversational manner. - + Build faster with Redis Copilot. - - Sign in to get started. + + + Sign in to get started + {form} +