Skip to content

Commit

Permalink
do not display hide of cot toggle is hide cot is true on the server (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
willydouhard authored Jan 10, 2024
1 parent f761689 commit 8e09839
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion backend/chainlit/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_jwt_secret():
def ensure_jwt_secret():
if require_login() and get_jwt_secret() is None:
raise ValueError(
"You must provide a JWT secret in the environment to use password authentication. Run `chainlit create-secret` to generate one."
"You must provide a JWT secret in the environment to use authentication. Run `chainlit create-secret` to generate one."
)


Expand Down
42 changes: 23 additions & 19 deletions frontend/src/components/molecules/settingsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRecoilState } from 'recoil';
import { useRecoilState, useRecoilValue } from 'recoil';

import DarkModeOutlined from '@mui/icons-material/DarkModeOutlined';
import EmojiObjectsIcon from '@mui/icons-material/EmojiObjects';
Expand All @@ -16,9 +16,11 @@ import {

import { SwitchInput } from '@chainlit/react-components';

import { projectSettingsState } from 'state/project';
import { settingsState } from 'state/settings';

export default function SettingsModal() {
const projectSettings = useRecoilValue(projectSettingsState);
const [settings, setSettings] = useRecoilState(settingsState);

return (
Expand Down Expand Up @@ -55,24 +57,26 @@ export default function SettingsModal() {
/>
</Box>
</ListItem>
<ListItem sx={{ display: 'flex', gap: 2 }}>
<ListItemIcon>
<EmojiObjectsIcon />
</ListItemIcon>
<ListItemText id="hide-cot" primary="Hide Chain of Thought" />
<Box>
<SwitchInput
id="switch-hide-cot"
onChange={() =>
setSettings((old) => ({ ...old, hideCot: !old.hideCot }))
}
checked={settings.hideCot}
inputProps={{
'aria-labelledby': 'hide-cot'
}}
/>
</Box>
</ListItem>
{projectSettings?.ui.hide_cot ? null : (
<ListItem sx={{ display: 'flex', gap: 2 }}>
<ListItemIcon>
<EmojiObjectsIcon />
</ListItemIcon>
<ListItemText id="hide-cot" primary="Hide Chain of Thought" />
<Box>
<SwitchInput
id="switch-hide-cot"
onChange={() =>
setSettings((old) => ({ ...old, hideCot: !old.hideCot }))
}
checked={settings.hideCot}
inputProps={{
'aria-labelledby': 'hide-cot'
}}
/>
</Box>
</ListItem>
)}
<ListItem sx={{ display: 'flex', gap: 2 }}>
<ListItemIcon>
<DarkModeOutlined />
Expand Down

0 comments on commit 8e09839

Please sign in to comment.