@@ -16,6 +16,7 @@ import useFiles from '../hooks/useFiles';
1616import FileCard from './FileCard' ;
1717import { FileLimit } from 'generative-ai-use-cases' ;
1818import { useTranslation } from 'react-i18next' ;
19+ import useUserSetting from '../hooks/useUserSetting' ;
1920
2021type Props = {
2122 content : string ;
@@ -49,6 +50,7 @@ type Props = {
4950
5051const InputChatContent : React . FC < Props > = ( props ) => {
5152 const { t } = useTranslation ( ) ;
53+ const { settingSubmitCmdOrCtrlEnter } = useUserSetting ( ) ;
5254 const { pathname } = useLocation ( ) ;
5355 const { loading : chatLoading , isEmpty } = useChat ( pathname ) ;
5456 const {
@@ -122,7 +124,11 @@ const InputChatContent: React.FC<Props> = (props) => {
122124 ) }
123125 < div
124126 className = { `relative flex items-end rounded-xl border border-black/10 bg-gray-100 shadow-[0_0_30px_1px] shadow-gray-400/40 ${
125- props . disableMarginBottom ? '' : 'mb-7'
127+ props . disableMarginBottom
128+ ? ''
129+ : settingSubmitCmdOrCtrlEnter
130+ ? 'mb-2'
131+ : 'mb-7'
126132 } `} >
127133 < div className = "flex grow flex-col" >
128134 { props . fileUpload && uploadedFiles . length > 0 && (
@@ -246,6 +252,15 @@ const InputChatContent: React.FC<Props> = (props) => {
246252 </ Button >
247253 ) }
248254 </ div >
255+
256+ { /* Show keyboard shortcut hint when cmd/ctrl+enter setting is enabled */ }
257+ { settingSubmitCmdOrCtrlEnter && (
258+ < div className = "mb-2 text-right text-xs text-gray-500" >
259+ { navigator . platform . toLowerCase ( ) . includes ( 'mac' )
260+ ? t ( 'chat.hint_cmd_enter' )
261+ : t ( 'chat.hint_ctrl_enter' ) }
262+ </ div >
263+ ) }
249264 </ div >
250265 ) ;
251266} ;
0 commit comments