fix: deduplicate in select provider models and target models

This commit is contained in:
jialin
2026-02-08 17:20:05 +08:00
parent ec6f5d1ad3
commit 379eeedde2
6 changed files with 80 additions and 43 deletions
+14 -4
View File
@@ -65,8 +65,13 @@ const ModelRoutes: React.FC = () => {
const { watchDataList: allRouteTargets, deleteItemFromCache } =
useWatchList(MODEL_ROUTE_TARGETS);
const [expandAtom] = useAtom(expandKeysAtom);
const { handleExpandChange, handleExpandAll, expandedRowKeys } =
useExpandedRowKeys(expandAtom);
const {
handleExpandChange,
handleExpandAll,
updateExpandedRowKeys,
removeExpandedRowKey,
expandedRowKeys
} = useExpandedRowKeys(expandAtom);
const intl = useIntl();
const { openRouteModalStatus, openRouteModal, closeRouteModal } =
useCreateRoute();
@@ -109,17 +114,22 @@ const ModelRoutes: React.FC = () => {
...data
};
try {
let data: ListItem = {} as any;
if (openRouteModalStatus.action === PageAction.EDIT) {
await updateModelRoute({
data = await updateModelRoute({
data: params,
id: openRouteModalStatus.currentData!.id
});
}
if (openRouteModalStatus.action === PageAction.CREATE) {
await createModelRoute({
data = await createModelRoute({
data: params
});
}
if (data.targets > 0) {
updateExpandedRowKeys([data.id, ...expandedRowKeys]);
}
fetchData();
closeRouteModal();
message.success(intl.formatMessage({ id: 'common.message.success' }));