🐛 fix(EditTagModal): add fetchTagModels function to retrieve models based on tag

This commit is contained in:
RedwindA
2025-06-08 01:16:39 +08:00
parent b7c742166a
commit 4989892830

View File

@@ -194,6 +194,24 @@ const EditTagModal = (props) => {
}, [originModelOptions, inputs.models]);
useEffect(() => {
const fetchTagModels = async () => {
if (!tag) return;
setLoading(true);
try {
const res = await API.get(`/api/channel/tag/models?tag=${tag}`);
if (res?.data?.success) {
const models = res.data.data ? res.data.data.split(',') : [];
setInputs((inputs) => ({ ...inputs, models: models }));
} else {
showError(res.data.message);
}
} catch (error) {
showError(error.message);
} finally {
setLoading(false);
}
};
setInputs({
...originInputs,
tag: tag,
@@ -201,7 +219,8 @@ const EditTagModal = (props) => {
});
fetchModels().then();
fetchGroups().then();
}, [visible]);
fetchTagModels().then(); // Call the new function
}, [visible, tag]); // Add tag to dependency array
const addCustomModels = () => {
if (customModel.trim() === '') return;