Skip to content

Commit 97eb271

Browse files
authored
Merge pull request #3363 from RedisInsight/fe/feature/RI-5701_chatbot
#RI-5701, #RI-5730 - chatbot enhancements
2 parents f29fdaa + e952e7a commit 97eb271

File tree

16 files changed

+170
-113
lines changed

16 files changed

+170
-113
lines changed

redisinsight/ui/src/assets/img/telescope-dark.svg

Lines changed: 85 additions & 54 deletions
Loading

redisinsight/ui/src/components/bottom-group-components/components/bottom-group-minimized/BottomGroupMinimized.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const BottomGroupMinimized = () => {
136136
<>
137137
<EuiIcon type={SurveyIcon} className={styles.surveyIcon} />
138138
<EuiHideFor sizes={['xs', 's']}>
139-
<span>We value your input. Please take our survey.</span>
139+
<span>Let us know what you think</span>
140140
</EuiHideFor>
141141
<EuiShowFor sizes={['xs', 's']}>
142142
<span>Survey</span>

redisinsight/ui/src/components/oauth/oauth-sign-in-button/OAuthSignInButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EuiButton, EuiImage } from '@elastic/eui'
33

44
import { OAuthSsoHandlerDialog } from 'uiSrc/components'
55

6-
import RedisLogo from 'uiSrc/assets/img/logo.svg'
6+
import RedisLogo from 'uiSrc/assets/img/logo_small.svg'
77

88
import { OAuthSocialAction, OAuthSocialSource } from 'uiSrc/slices/interfaces'
99
import styles from './styles.module.scss'

redisinsight/ui/src/components/oauth/oauth-sign-in-button/styles.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
.logo {
18-
width: 20px;
19-
margin-right: 10px;
18+
width: 14px;
19+
margin-right: 6px;
2020
}
2121
}

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/assistance-chat/AssistanceChat.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
createAssistantChatAction,
99
getAssistantChatHistoryAction,
1010
removeAssistantChatAction,
11+
sendQuestion,
1112
} from 'uiSrc/slices/panels/aiAssistant'
1213
import { getCommandsFromQuery, Nullable, scrollIntoView } from 'uiSrc/utils'
1314
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
@@ -16,6 +17,7 @@ import { AiChatMessage, AiChatType } from 'uiSrc/slices/interfaces/aiAssistant'
1617
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
1718
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
1819

20+
import { generateHumanMessage } from 'uiSrc/utils/transformers/chatbot'
1921
import { AssistanceChatInitialMessage, ChatHistory, ChatForm, RestartChat } from '../shared'
2022

2123
import styles from './styles.module.scss'
@@ -44,7 +46,18 @@ const AssistanceChat = () => {
4446
scrollToBottom('smooth')
4547

4648
if (!id) {
47-
dispatch(createAssistantChatAction((chatId) => sendChatMessage(chatId, message)))
49+
dispatch(
50+
createAssistantChatAction(
51+
(chatId) => sendChatMessage(chatId, message),
52+
// if cannot create a chat - just put message with error
53+
() => dispatch(
54+
sendQuestion({
55+
...generateHumanMessage(message),
56+
error: { statusCode: 500 },
57+
})
58+
)
59+
)
60+
)
4861
return
4962
}
5063

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/chats-wrapper/ChatsWrapper.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import React, { useEffect } from 'react'
22

3-
import { EuiImage, EuiTab, EuiTabs } from '@elastic/eui'
3+
import { EuiTab, EuiTabs } from '@elastic/eui'
44

55
import { useDispatch, useSelector } from 'react-redux'
66
import cx from 'classnames'
77
import { filter } from 'lodash'
88
import { aiChatSelector, setSelectedTab } from 'uiSrc/slices/panels/aiAssistant'
99
import { AiChatType } from 'uiSrc/slices/interfaces/aiAssistant'
10-
import AiChatImg from 'uiSrc/assets/img/ai/ai-chat-small.svg'
1110

1211
import { FeatureFlags } from 'uiSrc/constants'
1312
import { appFeatureFlagsFeaturesSelector } from 'uiSrc/slices/app/features'
@@ -69,7 +68,6 @@ const ChatsWrapper = () => {
6968
<div className={styles.wrapper} data-testid="chat-wrapper">
7069
{chats.length > 1 && (
7170
<div className={styles.tabsWrapper}>
72-
<EuiImage className={styles.chatImg} src={AiChatImg} alt="chat" />
7371
<EuiTabs className={cx('tabs-active-borders', styles.tabs)}>
7472
{documentationChatFeature?.flag && (
7573
<EuiTab

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/chats-wrapper/styles.module.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
padding: 0 12px;
1313
}
1414

15-
.chatImg {
16-
width: 18px;
17-
margin-right: 12px;
18-
margin-left: 4px;
19-
}
20-
2115
.tabs {
2216
:global(.euiTab) {
2317
margin-bottom: -1px;

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/ExpertChat.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { Ref, useCallback, useEffect, useRef, useState } from 'react'
22
import { useDispatch, useSelector } from 'react-redux'
33
import { useParams } from 'react-router-dom'
4+
import { EuiIcon } from '@elastic/eui'
45
import {
56
aiExpertChatSelector,
67
askExpertChatbotAction,
@@ -15,6 +16,7 @@ import { AiChatMessage, AiChatType } from 'uiSrc/slices/interfaces/aiAssistant'
1516
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
1617
import { oauthCloudUserSelector } from 'uiSrc/slices/oauth/cloud'
1718
import { fetchRedisearchListAction } from 'uiSrc/slices/browser/redisearch'
19+
import TelescopeImg from 'uiSrc/assets/img/telescope-dark.svg?react'
1820
import NoIndexesInitialMessage from './components/no-indexes-initial-message'
1921
import ExpertChatHeader from './components/expert-chat-header'
2022
import { ChatForm, ChatHistory, ExpertChatInitialMessage } from '../shared'
@@ -159,7 +161,13 @@ const ExpertChat = () => {
159161
title: 'Search & query capability is not available',
160162
content: freeInstances?.length
161163
? 'Use your free all-in-one Redis Cloud database to start exploring these capabilities.'
162-
: 'Create a free Redis Stack database with search & query capability that extends the core capabilities of open-source Redis.'
164+
: 'Create a free Redis Stack database with search & query capability that extends the core capabilities of open-source Redis.',
165+
icon: (
166+
<EuiIcon
167+
className={styles.iconTelescope}
168+
type={TelescopeImg}
169+
/>
170+
)
163171
}
164172
}
165173

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/expert-chat/styles.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@
3434
}
3535
}
3636
}
37+
38+
.iconTelescope {
39+
width: 80px !important;
40+
height: 60px !important;
41+
margin-left: 12px;
42+
43+
transform: rotateY(180deg) !important;
44+
}

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/chat-form/ChatForm.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Ref, useRef, useState } from 'react'
2-
import { EuiButton, EuiForm, EuiTextArea, EuiToolTip, keys } from '@elastic/eui'
2+
import { EuiButton, EuiForm, EuiSpacer, EuiText, EuiTextArea, EuiTitle, EuiToolTip, keys } from '@elastic/eui'
33

44
import cx from 'classnames'
55
import { isModifiedEvent } from 'uiSrc/services'
@@ -12,6 +12,7 @@ export interface Props {
1212
validation?: {
1313
title?: React.ReactNode
1414
content?: React.ReactNode
15+
icon?: React.ReactNode
1516
}
1617
isDisabled?: boolean
1718
placeholder?: string
@@ -69,9 +70,21 @@ const ChatForm = (props: Props) => {
6970

7071
return (
7172
<EuiToolTip
72-
title={validation?.title}
73-
content={validation?.content}
74-
anchorClassName={styles.validationTooltip}
73+
content={validation ? (
74+
<div className={styles.tooltipContent}>
75+
<div>
76+
{validation.title && (
77+
<>
78+
<EuiTitle size="xxs"><span>{validation.title}</span></EuiTitle>
79+
<EuiSpacer size="s" />
80+
</>
81+
)}
82+
{validation.content && (<EuiText size="xs">{validation.content}</EuiText>)}
83+
</div>
84+
{validation.icon}
85+
</div>
86+
) : undefined}
87+
className={styles.validationTooltip}
7588
display="block"
7689
>
7790
<EuiForm

0 commit comments

Comments
 (0)