@@ -15,6 +15,7 @@ import { BlueButton, GrayButton, OutlineButtonBlack } from './general/Buttons'
15
15
import { useIsEmbedded } from '../../contexts/EmbeddedContext'
16
16
import useCurrentUser from '../../hooks/useCurrentUser'
17
17
import { SendPreferenceConfiguratorModal , ShiftEnterForNewline , ShiftEnterToSend } from './SendPreferenceConfigurator'
18
+ import { useKeyboardCommands } from './keyboardCommands'
18
19
19
20
export const ChatBox = ( {
20
21
disabled,
@@ -77,6 +78,10 @@ export const ChatBox = ({
77
78
78
79
const { t } = useTranslation ( )
79
80
81
+ useKeyboardCommands ( { resetChat : handleReset } )
82
+
83
+ const isShiftEnterSend = user ?. preferences ?. sendShortcutMode === 'shift+enter'
84
+
80
85
const handleDeleteFile = ( ) => {
81
86
if ( fileInputRef . current ) {
82
87
fileInputRef . current . value = ''
@@ -227,7 +232,7 @@ export const ChatBox = ({
227
232
/>
228
233
</ IconButton >
229
234
</ Tooltip >
230
- < Tooltip title = { t ( 'chat:emptyConversation ' ) } arrow placement = "top" >
235
+ < Tooltip title = { t ( 'chat:emptyConversationTooltip ' ) } arrow placement = "top" >
231
236
< IconButton onClick = { handleReset } >
232
237
< RestartAltIcon />
233
238
</ IconButton >
@@ -238,7 +243,7 @@ export const ChatBox = ({
238
243
) }
239
244
</ Box >
240
245
241
- < Tooltip title = { disabled ? t ( 'chat:cancelResponse' ) : t ( 'chat:shiftEnter ' ) } arrow placement = "top" >
246
+ < Tooltip title = { disabled ? t ( 'chat:cancelResponse' ) : isShiftEnterSend ? t ( 'chat:shiftEnterSend' ) : t ( 'chat:enterSend ') } arrow placement = "top" >
242
247
< IconButton type = { disabled ? 'button' : 'submit' } ref = { sendButtonRef } >
243
248
{ disabled ? < StopIcon /> : < Send /> }
244
249
</ IconButton >
@@ -285,7 +290,7 @@ export const ChatBox = ({
285
290
variant = "body1"
286
291
color = "textSecondary"
287
292
>
288
- { user ?. preferences ?. sendShortcutMode === 'enter' ? < ShiftEnterForNewline t = { t } /> : < ShiftEnterToSend t = { t } /> }
293
+ { isShiftEnterSend ? < ShiftEnterToSend t = { t } /> : < ShiftEnterForNewline t = { t } /> }
289
294
</ Typography >
290
295
) }
291
296
0 commit comments