Skip to content

Commit d8f73c0

Browse files
committed
bugfix, fix tests
1 parent b6edfbd commit d8f73c0

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ describe('AssistanceChat', () => {
131131
fireEvent.click(screen.getByTestId('ai-general-restart-session-btn'))
132132

133133
await waitForEuiPopoverVisible()
134-
135-
fireEvent.click(screen.getByTestId('ai-chat-restart-confirm'))
134+
await act(async () => {
135+
fireEvent.click(screen.getByTestId('ai-chat-restart-confirm'))
136+
})
136137

137138
expect(store.getActions()).toEqual([
138139
...afterRenderActions,

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { AiChatMessage, AiChatType } from 'uiSrc/slices/interfaces/aiAssistant'
1616
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
1717
import { appRedisCommandsSelector } from 'uiSrc/slices/app/redis-commands'
1818

19-
import { AssistanceChatInitialMessage, ChatHistory, ChatForm } from '../shared'
19+
import { AssistanceChatInitialMessage, ChatHistory, ChatForm, RestartChat } from '../shared'
2020

2121
import styles from './styles.module.scss'
2222

@@ -121,13 +121,17 @@ const AssistanceChat = () => {
121121
<div className={styles.wrapper} data-testid="ai-general-chat">
122122
<div className={styles.header}>
123123
<span />
124-
<EuiButtonEmpty
125-
disabled={!!inProgressMessage || !messages?.length}
126-
iconType="eraser"
127-
size="xs"
128-
onClick={onClearSession}
129-
className={styles.headerBtn}
130-
data-testid="ai-general-restart-session-btn"
124+
<RestartChat
125+
button={(
126+
<EuiButtonEmpty
127+
disabled={!!inProgressMessage || !messages?.length}
128+
iconType="eraser"
129+
size="xs"
130+
className={styles.headerBtn}
131+
data-testid="ai-general-restart-session-btn"
132+
/>
133+
)}
134+
onConfirm={onClearSession}
131135
/>
132136
</div>
133137
<div className={styles.chatHistory}>

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/error-message/ErrorMessage.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('ErrorMessage', () => {
1616
expect(screen.getByTestId('ai-chat-error-message')).toHaveTextContent(AiChatErrors.Default)
1717
expect(screen.getByTestId('ai-chat-error-report-link')).toBeInTheDocument()
1818

19-
expect(screen.getByTestId('ai-general-restart-session-btn')).toBeInTheDocument()
19+
expect(screen.getByTestId('ai-chat-error-restart-session-btn')).toBeInTheDocument()
2020
})
2121

2222
it('should not render restart button with timeout error', () => {
@@ -26,6 +26,6 @@ describe('ErrorMessage', () => {
2626
expect(screen.getByTestId('ai-chat-error-message')).toHaveTextContent(AiChatErrors.Timeout)
2727
expect(screen.getByTestId('ai-chat-error-report-link')).toBeInTheDocument()
2828

29-
expect(screen.queryByTestId('ai-general-restart-session-btn')).not.toBeInTheDocument()
29+
expect(screen.queryByTestId('ai-chat-error-restart-session-btn')).not.toBeInTheDocument()
3030
})
3131
})

redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/shared/error-message/ErrorMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const ErrorMessage = (props: Props) => {
5454
color="secondary"
5555
iconType="eraser"
5656
className={styles.restartSessionBtn}
57-
data-testid="ai-general-restart-session-btn"
57+
data-testid="ai-chat-error-restart-session-btn"
5858
>
5959
Restart session
6060
</EuiButton>

redisinsight/ui/src/utils/api/chatbots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CustomHeaders } from 'uiSrc/constants/api'
22
import { isStatusSuccessful } from 'uiSrc/utils'
33
import ApiStatusCode from '../../constants/apiStatusCode'
44

5-
const TIMEOUT_FOR_MESSAGE_REQUEST = 50_000
5+
const TIMEOUT_FOR_MESSAGE_REQUEST = 30_000
66

77
export const getStreamedAnswer = async (
88
url: string,

0 commit comments

Comments
 (0)