Skip to content

Commit

Permalink
fix: fix some issues with berry (songquanpeng#913)
Browse files Browse the repository at this point in the history
* fix: login address error

* fix: Normal users display profile menu

* fix: remove redundant code
  • Loading branch information
MartialBE authored Jan 7, 2024
1 parent 34a327d commit 8500eaa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 69 deletions.
2 changes: 1 addition & 1 deletion web/berry/src/menu-items/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const panel = {
url: '/panel/profile',
icon: icons.IconUserScan,
breadcrumbs: false,
isAdmin: true
isAdmin: false
},
{
id: 'setting',
Expand Down
2 changes: 1 addition & 1 deletion web/berry/src/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ API.interceptors.response.use(
if (error.response?.status === 401) {
localStorage.removeItem('user');
store.dispatch({ type: LOGIN, payload: null });
window.location.href = config.basename + '/login';
window.location.href = config.basename + 'login';
}

if (error.response?.data?.message) {
Expand Down
67 changes: 0 additions & 67 deletions web/berry/src/views/Channel/component/EditModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ const validationSchema = Yup.object().shape({
then: Yup.string().required("密钥 不能为空"),
}),
other: Yup.string(),
proxy: Yup.string(),
test_model: Yup.string(),
models: Yup.array().min(1, "模型 不能为空"),
groups: Yup.array().min(1, "用户组 不能为空"),
base_url: Yup.string().when("type", {
Expand Down Expand Up @@ -623,71 +621,6 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
</FormHelperText>
)}
</FormControl>
<FormControl
fullWidth
error={Boolean(touched.proxy && errors.proxy)}
sx={{ ...theme.typography.otherInput }}
>
<InputLabel htmlFor="channel-proxy-label">
{inputLabel.proxy}
</InputLabel>
<OutlinedInput
id="channel-proxy-label"
label={inputLabel.proxy}
type="text"
value={values.proxy}
name="proxy"
onBlur={handleBlur}
onChange={handleChange}
inputProps={{}}
aria-describedby="helper-text-channel-proxy-label"
/>
{touched.proxy && errors.proxy ? (
<FormHelperText error id="helper-tex-channel-proxy-label">
{errors.proxy}
</FormHelperText>
) : (
<FormHelperText id="helper-tex-channel-proxy-label">
{" "}
{inputPrompt.proxy}{" "}
</FormHelperText>
)}
</FormControl>
{inputPrompt.test_model && (
<FormControl
fullWidth
error={Boolean(touched.test_model && errors.test_model)}
sx={{ ...theme.typography.otherInput }}
>
<InputLabel htmlFor="channel-test_model-label">
{inputLabel.test_model}
</InputLabel>
<OutlinedInput
id="channel-test_model-label"
label={inputLabel.test_model}
type="text"
value={values.test_model}
name="test_model"
onBlur={handleBlur}
onChange={handleChange}
inputProps={{}}
aria-describedby="helper-text-channel-test_model-label"
/>
{touched.test_model && errors.test_model ? (
<FormHelperText
error
id="helper-tex-channel-test_model-label"
>
{errors.test_model}
</FormHelperText>
) : (
<FormHelperText id="helper-tex-channel-test_model-label">
{" "}
{inputPrompt.test_model}{" "}
</FormHelperText>
)}
</FormControl>
)}
<DialogActions>
<Button onClick={onCancel}>取消</Button>
<Button
Expand Down

0 comments on commit 8500eaa

Please sign in to comment.