diff --git a/web/berry/src/views/Channel/component/EditModal.js b/web/berry/src/views/Channel/component/EditModal.js
index cbf411b9..03b4df57 100644
--- a/web/berry/src/views/Channel/component/EditModal.js
+++ b/web/berry/src/views/Channel/component/EditModal.js
@@ -21,15 +21,16 @@ import {
Container,
Autocomplete,
FormHelperText,
- Checkbox
+ Switch,
+ Checkbox,
} from "@mui/material";
import { Formik } from "formik";
import * as Yup from "yup";
import { defaultConfig, typeConfig } from "../type/Config"; //typeConfig
import { createFilterOptions } from "@mui/material/Autocomplete";
-import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
-import CheckBoxIcon from '@mui/icons-material/CheckBox';
+import CheckBoxOutlineBlankIcon from "@mui/icons-material/CheckBoxOutlineBlank";
+import CheckBoxIcon from "@mui/icons-material/CheckBox";
const icon = ;
const checkedIcon = ;
@@ -79,6 +80,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
const [inputPrompt, setInputPrompt] = useState(defaultConfig.prompt);
const [groupOptions, setGroupOptions] = useState([]);
const [modelOptions, setModelOptions] = useState([]);
+ const [batchAdd, setBatchAdd] = useState(false);
const initChannel = (typeValue) => {
if (typeConfig[typeValue]?.inputLabel) {
@@ -151,7 +153,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
try {
let res = await API.get(`/api/channel/models`);
const { data } = res.data;
- data.forEach(item => {
+ data.forEach((item) => {
if (!item.owned_by) {
item.owned_by = "未知";
}
@@ -166,7 +168,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
});
setModelOptions(
- data.map((model) => {
+ data.map((model) => {
return {
id: model.id,
group: model.owned_by,
@@ -258,7 +260,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
2
);
}
- data.base_url = data.base_url ?? '';
+ data.base_url = data.base_url ?? "";
data.is_edit = true;
initChannel(data.type);
setInitialInput(data);
@@ -273,6 +275,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
}, []);
useEffect(() => {
+ setBatchAdd(false);
if (channelId) {
loadChannel().then();
} else {
@@ -340,15 +343,17 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
},
}}
>
- {Object.values(CHANNEL_OPTIONS).sort((a, b) => {
- return a.text.localeCompare(b.text)
- }).map((option) => {
- return (
-
- );
- })}
+ {Object.values(CHANNEL_OPTIONS)
+ .sort((a, b) => {
+ return a.text.localeCompare(b.text);
+ })
+ .map((option) => {
+ return (
+
+ );
+ })}
{touched.type && errors.type ? (
@@ -553,7 +558,12 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
}}
renderOption={(props, option, { selected }) => (
-
+
{option.id}
)}
@@ -599,20 +609,38 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
error={Boolean(touched.key && errors.key)}
sx={{ ...theme.typography.otherInput }}
>
-
- {inputLabel.key}
-
-
+ {!batchAdd ? (
+ <>
+
+ {inputLabel.key}
+
+
+ >
+ ) : (
+
+ )}
+
{touched.key && errors.key ? (
{errors.key}
@@ -624,6 +652,19 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
)}
+ {channelId === 0 && (
+
+ setBatchAdd(e.target.checked)}
+ />
+ 批量添加
+
+ )}