@@ -10,15 +10,16 @@ import PersonIcon from '@mui/icons-material/Person'
10
10
import SmartToyIcon from '@mui/icons-material/SmartToy'
11
11
import SettingsIcon from '@mui/icons-material/Settings'
12
12
import { useTranslation } from 'react-i18next'
13
- import { Message , SessionType } from '../../shared/types'
14
- import { useAtomValue , useSetAtom } from 'jotai'
13
+ import { Message , SessionType , Settings } from '../../shared/types'
14
+ import { SetStateAction , useAtom , useAtomValue , useSetAtom , WritableAtom } from 'jotai'
15
15
import {
16
16
showMessageTimestampAtom ,
17
17
showModelNameAtom ,
18
18
showTokenCountAtom ,
19
19
showWordCountAtom ,
20
20
openSettingDialogAtom ,
21
21
enableMarkdownRenderingAtom ,
22
+ settingsAtom ,
22
23
} from '../stores/atoms'
23
24
import { currsentSessionPicUrlAtom , showTokenUsedAtom } from '../stores/atoms'
24
25
import * as scrollActions from '../stores/scrollActions'
@@ -29,6 +30,7 @@ import * as dateFns from "date-fns"
29
30
import { cn } from '@/lib/utils'
30
31
import { estimateTokensFromMessages } from '@/packages/token'
31
32
import { countWord } from '@/packages/word-count'
33
+ import React from 'react'
32
34
33
35
export interface Props {
34
36
id ?: string
@@ -44,6 +46,7 @@ export interface Props {
44
46
export default function Message ( props : Props ) {
45
47
const { t } = useTranslation ( )
46
48
const theme = useTheme ( )
49
+
47
50
48
51
const showMessageTimestamp = useAtomValue ( showMessageTimestampAtom )
49
52
const showModelName = useAtomValue ( showModelNameAtom )
@@ -102,6 +105,11 @@ export default function Message(props: Props) {
102
105
}
103
106
} , [ msg . content ] )
104
107
108
+ const hideInitMsg = ( ) => {
109
+ const [ settings , _1 ] = useAtom ( settingsAtom ) ;
110
+ return settings . hideInitialMessage ;
111
+ }
112
+
105
113
let content = msg . content
106
114
if ( typeof msg . content !== 'string' ) {
107
115
content = JSON . stringify ( msg . content )
@@ -146,6 +154,7 @@ export default function Message(props: Props) {
146
154
[ theme . breakpoints . down ( 'sm' ) ] : {
147
155
paddingX : '0.3rem' ,
148
156
} ,
157
+ display : msg ?. role === 'system' && hideInitMsg ( ) ? "none" : "initial"
149
158
} }
150
159
>
151
160
< Grid container wrap = "nowrap" spacing = { 1.5 } >
0 commit comments