mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): sort model select options with compatible base model first
This commit is contained in:
parent
e32eb2a649
commit
77f2aabda4
@ -1124,7 +1124,7 @@
|
||||
"noControlImageForControlAdapter": "Control Adapter #{{number}} has no control image",
|
||||
"noInitialImageSelected": "No initial image selected",
|
||||
"noModelForControlAdapter": "Control Adapter #{{number}} has no model selected.",
|
||||
"incompatibleBaseModelForControlAdapter": "Control Adapter #{{number}} model is invalid with main model.",
|
||||
"incompatibleBaseModelForControlAdapter": "Control Adapter #{{number}} model is incompatible with main model.",
|
||||
"noModelSelected": "No model selected",
|
||||
"noPrompts": "No prompts generated",
|
||||
"noNodesInGraph": "No nodes in graph",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { EntityState } from '@reduxjs/toolkit';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import type { GroupBase } from 'chakra-react-select';
|
||||
import { groupBy, map, reduce } from 'lodash-es';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
@ -28,6 +29,9 @@ export const useGroupedModelInvSelect = <T extends AnyModelConfigEntity>(
|
||||
arg: UseGroupedModelInvSelectArg<T>
|
||||
): UseGroupedModelInvSelectReturn => {
|
||||
const { t } = useTranslation();
|
||||
const base_model = useAppSelector(
|
||||
(state) => state.generation.model?.base_model ?? 'sdxl'
|
||||
);
|
||||
const { modelEntities, selectedModel, getIsDisabled, onChange, isLoading } =
|
||||
arg;
|
||||
const options = useMemo(() => {
|
||||
@ -51,8 +55,9 @@ export const useGroupedModelInvSelect = <T extends AnyModelConfigEntity>(
|
||||
},
|
||||
[] as GroupBase<InvSelectOption>[]
|
||||
);
|
||||
_options.sort((a) => (a.label === base_model ? -1 : 1));
|
||||
return _options;
|
||||
}, [getIsDisabled, modelEntities]);
|
||||
}, [getIsDisabled, modelEntities, base_model]);
|
||||
|
||||
const value = useMemo(
|
||||
() =>
|
||||
|
Loading…
Reference in New Issue
Block a user